scaleSPL: Scale SPL

View source: R/loudness_utilities.R

scaleSPLR Documentation

Scale SPL

Description

Internal soundgen function

Usage

scaleSPL(x, scale = NULL, SPL_measured = 70, Pref = 2e-05)

Arguments

x

numeric vector ranging from -1 to +1

scale

maximum possible amplitude of input used for normalization of input vector (only needed if x is a numeric vector)

SPL_measured

sound pressure level at which the sound is presented, dB

Pref

reference pressure, Pa (currently has no effect on the estimate)

Details

Converts a sound from SPL on any scale to a desired level of dB SPL. See Timoney et al. (2004) "Implementing loudness models in MATLAB"

Examples

sound = rnorm(100) * getSmoothContour(c(0, 1, 0), len = 100)
sound = sound / max(abs(sound))
# plot(sound, type = 'l')
sound_scaled = soundgen:::scaleSPL(sound, Pref = 2e-1)
plot(sound_scaled, type = 'l')

sound2 = sound / 3
range(soundgen:::scaleSPL(sound2, scale = NULL))
range(soundgen:::scaleSPL(sound2, scale = 1))

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