THE AUDITORY MODELING TOOLBOX

Applies to version: 1.6.0

View the code

Go to function

SCALETODBSPL
Scale a signal to have a specific SPL (in dB)

Usage:

outsig = scaletodbspl(insig,spl);
outsig = scaletodbspl(insig,spl,dboffset);
outsig = scaletodbspl(insig,spl,'ac');
outsig = scaletodbspl(spl);
outsig = scaletodbspl(spl,[],dboffset);

Description:

scaletodbspl(insig,spl) scales the signal insig such that its sound pressure level (SPL) corresponds to spl (in dB). For the scaling, the AMT default level convention is used, which, unless modified by the user, is SPL of 93.98 dB for an RMS of 1.

scaletodbspl(insig,spl,dboffset) scales the signal insig such that its SPL corresponds to spl (in dB). For the scaling, the user's level convention provided by dboffset defining the SPL for an RMS of 1.

scaletodbspl(spl) returns the scaling constant required to scale a signal having RMS of 1 to SPL of spl (in dB), corresponding to the AMT default level convention.

scaletodbspl(0) returns the reference ref used to calculate the SPL in the formula \(SPL = 20*log_10 (signal/ref)\)

scaletodbspl(spl,[],dboffset) returns the scaling constant required to scale a signal having RMS of 1 to SPL of spl (in dB), corresponding to the user's level convention provided by dboffset defining the SPL for an RMS of 1.

If the input is a matrix, it is assumed that each column is a signal.

scaletodbspl(insig,spl,'ac') does the same, but considers only the AC component of the signal (i.e. the mean is removed).

References:

B. C. J. Moore. An Introduction to the Psychology of Hearing. Academic Press, 5th edition, 2003.