# Is there a function in python which returns the Amplitude/Sound Pressure Level of a sound file(like .wav) file?

I found a function called scipy.io.wavefile.read() which returns the sampling rate and an array. But in the documentation, it is not specified that whether the array returned by this function is of Amplitude or Sound Pressure Level. Which one is it?

• Digital Amplitude. In essence, something proportional to the voltage at the ADC. So strictly speaking, since this is DSP, there's no such function, because the information about actual air pressure values is lost during recording and playback. – Marcus Müller Feb 16 '17 at 22:57
• You mean that this function returns array of Digital Amplitude ? – user26612 Feb 16 '17 at 23:04
• The digital amplitude is proportional to pressure, but you need to know mic sensitivity, gain, ADC max voltage to map it to an actual number – endolith Feb 17 '17 at 3:17
• Not an exact duplicate, but I think that you might find this question and responses relevant (?) – A_A Feb 17 '17 at 9:53

## 2 Answers

No, you need to know the full Transfer function from the acoustic response at the sensors face to your A/D converter. Transducer responses vary with frequency. You need a calibrated reference at a minimum.

A reference sensor will have a response curve from the manufacturer. An average would be useful as well.

It's amplitude data. Assuming the file contains a recording of an acoustic event the data may well be strongly correlated to the original SPL but it's not that data.

According to the docs, depending on the nature of the audio file scipy.io.wavefile.read() gives the data in one of the formats below:

 WAV format Min Max NumPy dtype 32-bit floating-point -1.0 +1.0 float32 32-bit PCM -2147483648 +2147483647 int32 16-bit PCM -32768 +32767 int16 8-bit PCM 0 255 uint8 

You can convert the value in your to dBFS using 20*log10(val/max). Where max is the max appropriate to your wav file as per the above table.