getLoudnessPerFrame: Get loudness per frame

View source: R/loudness_utilities.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 Sept. 12, 2024, 6:29 a.m.