Code covered by the BSD License  

Highlights from
Sound Pressure Level Calculator


1.5 | 2 ratings Rate this file 42 Downloads (last 30 days) File Size: 1.71 KB File ID: #35876
image thumbnail

Sound Pressure Level Calculator



Function calculates sound pressure level in decibels, given a pressure signal in pascals.

| Watch this File

File Information

SPL_dB = spl(p_Pa,ref)

Calculate sound pressure level (in dB) of given pressure signal 'p_Pa'. Input variable 'ref' can be any user-defined reference pressure or simply 'air' or 'water' to use standard values for air and water.

Pressure signal input p_Pa must be in units of pascals if 'air' or 'water' are used to define the reference pressure. Otherwise any pressure signal units are acceptable, given they match the units of the reference pressure.

Pressure signal vector should be long enough to capture nature of the signal. In other words, a single pressure value is not sufficient for root-mean-square calculation. Note that this does account for frequency content. A-weighted decibels (dBA) are frequency-dependent. This function does not compute dBA.

Example using Matlab's built-in train whistle sound:

load train % (let's assume y is has pascals as its units)

ans =
The example above gives the same as the following:

load train % (let's assume y is has pascals as its units)
ans =

Note: Typically we only write decibels to integer values or one decimal place. Anything on the hundredth-of-a-decibel level is probably just noise and can be ignored.


This file inspired Water Sound Speed Calculator and Seawater Acoustic Absorption Calculator.

Required Products MATLAB
MATLAB release MATLAB 7.12 (R2011a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (2)
11 Jan 2013 AndrĂ©  
27 Sep 2012 Piao zhigang  

Contact us