getLoudnessPerFrame: Get loudness per frame

View source: R/utilities_loudness.R

getLoudnessPerFrameR Documentation

Get loudness per frame

Description

Internal soundgen function

Usage

getLoudnessPerFrame(spec, samplingRate, spreadSpectrum = TRUE)

Arguments

samplingRate

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

spreadSpectrum

if TRUE, applies a spreading function to account for frequency masking

Details

Takes as input the absolute (not power) spectrum of a single STFT frame and estimates its loudness in sone. See getLoudness for details.

Examples

sound = sin(2*pi*1000/16000*(1:1000))
sound_scaled = soundgen:::scaleSPL(sound, SPL_measured = 40)
spec = spectrogram(
  sound_scaled, samplingRate = 16000, windowLength = 10,
  normalize = FALSE, output = 'original')[, 10]
# plot(spec, type = 'l')
soundgen:::getLoudnessPerFrame(spec, samplingRate = 16000)  # 1 sone

soundgen documentation built on Aug. 14, 2022, 5:05 p.m.