getAM_env: Get Amplitude Modulation

View source: R/am.R

getAM_envR Documentation

Get Amplitude Modulation

Description

Internal soundgen function

Usage

getAM_env(
  audio,
  amRange = c(20, 100),
  overlap = 80,
  parab = TRUE,
  plot = FALSE
)

Details

Measures AM

Examples

s = soundgen(sylLen = 1500, pitch = c(300, 550, 320, 220),
             amFreq = c(50, 120, 100), amDep = c(10, 60, 30))
# spectrogram(s)
# playme(s)
am = soundgen:::getAM_env(audio = soundgen:::readAudio(s, samplingRate = 16000),
  amRange = c(20, 200), overlap = 80, plot = TRUE)
plot(am$time, am$freq, cex = am$dep * 2)
# compare to getAM from modulation spectrum:
ms = modulationSpectrum(s, 16000, plot = FALSE)
plot(x = seq(1, 1500, length.out = length(ms$amMsFreq)), y = ms$amMsFreq,
     cex = 10^(ms$amMsPurity/20) * 10, xlab = 'Time, ms', ylab = 'AM frequency, Hz')

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