getSmoothSpectrum: Get smooth spectrum

View source: R/spectrogram.R

getSmoothSpectrumR Documentation

Get smooth spectrum

Description

Internal soundgen function.

Usage

getSmoothSpectrum(
  sound,
  samplingRate = NULL,
  spectrum = NULL,
  len,
  loessSpan,
  windowLength = 100,
  overlap = 0,
  plot = FALSE,
  xlab = "Frequency, kHz",
  ylab = "dB",
  type = "l",
  ...
)

Arguments

sound

the audio (numeric, any scale)

samplingRate

sampling rate of x (only needed if x is a numeric vector)

spectrum

pre-extracted spectrum in dB with columns "freq" and "ampl"

len

the desired resolution of the output

loessSpan

passed to loess to control the amount of smoothing (.01 = minimal smoothing, 1 = strong smoothing)

windowLength

length of FFT window, ms

overlap

overlap between successive FFT frames, %

plot

should a spectrogram be plotted? TRUE / FALSE

...

other graphical parameters

Examples

s = soundgen(sylLen = 100, pitch = 500, addSilence = FALSE)
soundgen:::getSmoothSpectrum(s, 16000, len = 500, loessSpan = .01, plot = TRUE)
soundgen:::getSmoothSpectrum(s, 16000, len = 500, loessSpan = .1, plot = TRUE)
soundgen:::getSmoothSpectrum(s, 16000, len = 500, loessSpan = .5, plot = TRUE)
soundgen:::getSmoothSpectrum(s, 16000, len = 500, loessSpan = 1, plot = TRUE)

sp = seewave::meanspec(s, f = 16000, dB = 'max0')
colnames(sp) = c('freq', 'ampl')
soundgen:::getSmoothSpectrum(spectrum = sp, len = 500, loessSpan = .1, plot = TRUE)

soundgen documentation built on Sept. 12, 2024, 6:29 a.m.