how to get amplitude of mp3 audio file?

11 views (last 30 days)
I need to know the amplitude value of a mp3 file to calculate PSNR. Is there any function in matlab that can show the amplitude value of a mp3 file? May someone help me to answer my question please? thank you.

Accepted Answer

Jan
Jan on 21 May 2017
The command audioread imports an MP3 or WAV file to a matrix, which contains the amplitudes. This is not the amplitude of the original signal, but it is exactly, what you want: The amplitude of the signal stored in the file.
Steganography in an MP3 file requires to de-compress the file at first, embed the secret information, and re-compress the signal to a new MP3 file. Note that the process of un- and re-compressing will degrade the quality of the signal already, even without inserting additional information.
  2 Comments
Rini Indrayani
Rini Indrayani on 21 May 2017
Actually, i had done steganography using homogenous frame from mp3 file. I had used audioread function to get the amplitude value to compare both of mp3 audio files (before and after steganography process). But i got the same value for all amplitudes from both mp3 audio files. So when i used that amplitudo values to calculate PSNR, the value is infinite. Because the difference value between both audio files is zero.that's why i am not sure about is it the true way to get amplitude or not.

Sign in to comment.

More Answers (1)

Star Strider
Star Strider on 20 May 2017
The audioread function limits the amplitude of the output to ±1, so the original amplitude information will be lost unless you recorded a scaling value when you recorded it. You have to read the file in order to estimate the amplitude as a function of time.
  7 Comments
Walter Roberson
Walter Roberson on 21 May 2017
"If I use WAV, is there any function in matlab to know the amplitude of that WAV file?"
No.
Walter Roberson
Walter Roberson on 21 May 2017
You write asking about "amplitude", but you do not define what kind of amplitude you are talking about. Are you looking for Sound Pressure Level ?
"I need to compare the mp3 audio quality before and after embedding of steganography process."
Then why do you care about "amplitude" ? How are you measuring "audio quality" ? Is the measurement of audio quality something to do with Sound Pressure Level? Does it matter for your purposes whether the "amplitude" is a number from 0 to 1023, or a number from -512 to +511, or a number between -1 and +1 ? Is your quest for "audio quality" aided by knowing that the recording was a "line-in" level or at "mic level"?

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!