Learn R Programming

soundgen (version 2.7.0)

modulationSpectrumFragment: Modulation spectrum per fragment

Description

Internal soundgen function.

Usage

modulationSpectrumFragment(
  sound,
  samplingRate,
  specSource = "STFT",
  audSpec_pars = NULL,
  msType = c("2D", "1D")[1],
  windowLength,
  windowLength_points,
  step,
  step_points,
  lowestFreq,
  wn = "hanning",
  zp = 0,
  specMethod = c("spec", "meanspec")[2],
  logSpec = FALSE,
  logMPS = FALSE,
  power = 1,
  normalize = TRUE
)

Arguments

sound

numeric vector

samplingRate

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

specSource

'STFT' = Short-Time Fourier Transform; 'audSpec' = a bank of bandpass filters (see audSpectrogram)

audSpec_pars

parameters for extracting an auditory spectrogram if specType = 'audSpec'. If specType = 'STFT', these settings have no effect

msType

'2D' = two-dimensional Fourier transform of a spectrogram; '1D' = separately calculated spectrum of each frequency band

windowLength, step, wn, zp

parameters for extracting a spectrogram if specType = 'STFT'. Window length and step are specified in ms (see spectrogram). If specType = 'audSpec', these settings have no effect

specMethod

the function to call when calculating the spectrum of each frequency band (only used when msType = '1D'); 'meanspec' is faster and less noisy, whereas 'spec' produces higher resolution

logSpec

if TRUE, the spectrogram is log-transformed prior to taking 2D FFT

logMPS

if TRUE, the modulation spectrum is log-transformed prior to calculating roughness

power

raise modulation spectrum to this power (eg power = 2 for ^2, or "power spectrum")

normalize

if TRUE, the modulation spectrum of each analyzed fragment maxDur in duration is separately normalized to have max = 1

Examples

Run this code
s = soundgen(amFreq = 25, amDep = 100)
ms = soundgen:::modulationSpectrumFragment(s, 16000,
  windowLength = 50, windowLength_points = .05 * 16000,
  step = 5, step_points = .005 * 16000)
image(as.numeric(colnames(ms$ms_half)), as.numeric(rownames(ms$ms_half)),
      t(log(ms$ms_half)))

Run the code above in your browser using DataLab