IPB

Welcome Guest ( Log In | Register )

2 Pages V   1 2 >  
Reply to this topicStart new topic
Typical signal to noise ratio of ADPCM
Neuron
post Jan 28 2013, 15:08
Post #1





Group: Members
Posts: 141
Joined: 14-December 12
Member No.: 105171



So, I have decided to return to this forum (despite my little conflict with greynol) and I have kind of a weird question. I would like to know what is the rough SNR of a 4-bit ADPCM recording (IMA and Microsoft). For those curious why I am asking this, well, I like ripping music and sound effects from old games, and I would like know the technical side as well.
Go to the top of the page
+Quote Post
saratoga
post Jan 28 2013, 16:56
Post #2





Group: Members
Posts: 4715
Joined: 2-September 02
Member No.: 3264



There are various adpcm flavors. Which are you using specifically? A
Go to the top of the page
+Quote Post
Garf
post Jan 28 2013, 17:51
Post #3


Server Admin


Group: Admin
Posts: 4853
Joined: 24-September 01
Member No.: 13



CompAudio from AFsp can calculate this, IIRC. But this will give you raw SNR, wheras you might be more interested in A-weighted SNR, I'd think.
Go to the top of the page
+Quote Post
Neuron
post Jan 28 2013, 20:16
Post #4





Group: Members
Posts: 141
Joined: 14-December 12
Member No.: 105171



QUOTE (saratoga @ Jan 28 2013, 16:56) *
There are various adpcm flavors. Which are you using specifically? A


The games I am ripping sound files from use IMA or Microsoft ADPCM.
Go to the top of the page
+Quote Post
kode54
post Jan 29 2013, 06:07
Post #5





Group: Admin
Posts: 4498
Joined: 15-December 02
Member No.: 4082



Cool, game soundtrack ripping for the win. I may be able to calculate those parameters for codecs like that, but I guess it really depends on the average error of the encoders used in the first place... which would require that you either have the original encoders handy, or the original uncompressed audio for comparison.
Go to the top of the page
+Quote Post
Neuron
post Jan 29 2013, 11:54
Post #6





Group: Members
Posts: 141
Joined: 14-December 12
Member No.: 105171



QUOTE (kode54 @ Jan 29 2013, 06:07) *
Cool, game soundtrack ripping for the win. I may be able to calculate those parameters for codecs like that, but I guess it really depends on the average error of the encoders used in the first place... which would require that you either have the original encoders handy, or the original uncompressed audio for comparison.


Well I have the soundtrack in both FLAC original (released by the author years after the original game, I also have a mod that includes them in the game as 44 Khz uncompressed WAVs) form and 22 Khz IMA ADPCM form included in the game. The sounds are more important for me through as they cannot really be downloaded from the internet (at least I haven't seen any of them). I will upload some as soon as possible.
Go to the top of the page
+Quote Post
Neuron
post Jan 29 2013, 12:46
Post #7





Group: Members
Posts: 141
Joined: 14-December 12
Member No.: 105171



Here it is:http://www.hydrogenaudio.org/forums/index.php?showtopic=99152 .
Go to the top of the page
+Quote Post
Neuron
post Jan 29 2013, 16:47
Post #8





Group: Members
Posts: 141
Joined: 14-December 12
Member No.: 105171



QUOTE (kode54 @ Jan 29 2013, 06:07) *
Cool, game soundtrack ripping for the win. I may be able to calculate those parameters for codecs like that, but I guess it really depends on the average error of the encoders used in the first place... which would require that you either have the original encoders handy, or the original uncompressed audio for comparison.


Well, IMA ADPCM and Microsoft ADPCM pretty much has the same encoder always (the one built in Windows).
Go to the top of the page
+Quote Post
saratoga
post Jan 29 2013, 17:37
Post #9





Group: Members
Posts: 4715
Joined: 2-September 02
Member No.: 3264



If you have the lossless and lossy encoded files you can compute the snr by subtraction and comparison of the level of the signal to the error.
Go to the top of the page
+Quote Post
Neuron
post Jan 29 2013, 22:42
Post #10





Group: Members
Posts: 141
Joined: 14-December 12
Member No.: 105171



I have to admit I don't really know how to do such a thing but I've found something http://www.baudline.com/solutions/codec/index.html .

The curious thing is, why does ADPCM achieve lower SNR than 8-bit PCM according to that website even through ADPCM usually sounds much better? Is it because a sine wave was used? Same for u and A-law, I thought they were supposed to increase SNR (and u-law and A-law files indeed hear much cleaner than linear 8 bit).

This post has been edited by Neuron: Jan 29 2013, 22:44
Go to the top of the page
+Quote Post
Neuron
post Jan 29 2013, 23:15
Post #11





Group: Members
Posts: 141
Joined: 14-December 12
Member No.: 105171



I've added the song in 44 Khz MS ADPCM to the sample thread. MS ADPCM has a far lower noise level in my opinion and I provide an ABX test here:

QUOTE
foo_abx 1.3.4 report
foobar2000 v1.1.16
2013/01/29 22:59:35

File A: C:\Documents and Settings\Administrator.MISO-33497FE14F.000\My Documents\Med Sci 1 msadpcm.wav
File B: C:\Documents and Settings\Administrator.MISO-33497FE14F.000\My Documents\Med Sci 1 dvi.wav

22:59:35 : Test started.
23:00:14 : 01/01 50.0%
23:00:23 : 02/02 25.0%
23:00:34 : 03/03 12.5%
23:00:43 : 04/04 6.3%
23:01:01 : 05/05 3.1%
23:01:23 : 06/06 1.6%
23:01:32 : 07/07 0.8%
23:01:51 : 08/08 0.4%
23:02:06 : 09/09 0.2%
23:02:12 : 10/10 0.1%
23:02:22 : 11/11 0.0%
23:02:31 : 12/12 0.0%
23:02:33 : Test finished.

----------
Total: 12/12 (0.0%)


(For those who wonder why the filenames are different from those in the sample thread, I have renamed them when I uploaded them to the forum, this is how they are named on my harddrive).

This post has been edited by Neuron: Jan 29 2013, 23:16
Go to the top of the page
+Quote Post
extrabigmehdi
post Jan 30 2013, 00:08
Post #12





Group: Members
Posts: 400
Joined: 15-August 09
Member No.: 72330



Well, I used the normalize function of soundforge .
It says that the RMS for file "Eric_Brosius___02___Med_Sci_1___44_Khz_lossless.flac" (i.e 44khz, lossless) is -19db
Now for the error , I compute the difference between the previous file and ADCPM version, (i.e Eric_Brosius___02___Med_Sci_1___44_Khz_IMA_ADPCM.wav)
using the channel converter function of soundforge.
The normalize function says that the RMS of error is -38.2 db


So basically you have two number for 44hz version :
signal: -19 db
noise: -38.2 db


but sorry I don't know the final formula to compute the snr, especially if you consider that soundforge give negative values for RMS .




Go to the top of the page
+Quote Post
bandpass
post Jan 30 2013, 08:46
Post #13





Group: Members
Posts: 321
Joined: 3-August 08
From: UK
Member No.: 56644



QUOTE (Neuron @ Jan 29 2013, 22:15) *
MS ADPCM has a far lower noise level in my opinion...

This is not unexpected as it uses a 2nd-order predictor (IMA & OKI ADPCM are 1st order).
Go to the top of the page
+Quote Post
Neuron
post Jan 30 2013, 11:29
Post #14





Group: Members
Posts: 141
Joined: 14-December 12
Member No.: 105171



QUOTE (extrabigmehdi @ Jan 30 2013, 00:08) *
Well, I used the normalize function of soundforge .
It says that the RMS for file "Eric_Brosius___02___Med_Sci_1___44_Khz_lossless.flac" (i.e 44khz, lossless) is -19db
Now for the error , I compute the difference between the previous file and ADCPM version, (i.e Eric_Brosius___02___Med_Sci_1___44_Khz_IMA_ADPCM.wav)
using the channel converter function of soundforge.
The normalize function says that the RMS of error is -38.2 db


So basically you have two number for 44hz version :
signal: -19 db
noise: -38.2 db


but sorry I don't know the final formula to compute the snr, especially if you consider that soundforge give negative values for RMS .


Thank you very much, but what does the first value mean? RMS of what? The second I understand is of noise but the first...
Can you do to the same comparision for the MS ADPCM file please? And perhaps verify it by doing the same with an 8-bit LPCM file? An 8-bit LPCM file should have a SNR of around 48 dB (42 dB with dithering). If the results will be too different something is off.

This post has been edited by Neuron: Jan 30 2013, 11:32
Go to the top of the page
+Quote Post
extrabigmehdi
post Jan 30 2013, 13:48
Post #15





Group: Members
Posts: 400
Joined: 15-August 09
Member No.: 72330



QUOTE (Neuron @ Jan 30 2013, 10:29) *
Thank you very much, but what does the first value mean? RMS of what? The second I understand is of noise but the first...


Well to compute the SNR , you need to compare "loudness" of noise, to "loudness" of original signal.
So basically I compute how loud is the original lossless file (i.e RMS of file "Eric_Brosius___02___Med_Sci_1___44_Khz_lossless.flac").


Here are more measurements:
"Standard RMS":
signal: -19 db
noise IMA ADPCM: -38.2 db
noise Micosoft ADPCM: -38 db


So the IMA is slightly less noisy, but the difference measured is not significant.

But we don't hear all frequencies at same level, and soundforge offers the option to compute RMS
by taking account of "equal loudness curve".

"RMS using equal loudness curve option":
signal: -16.6db
noise IMA ADPCM: -33db
noise Micosoft ADPCM: -32.9

So the difference is even less significant while using "equal loudness contour" option.

And finally, a last experiment, I've computed the average of both ADCPM versions (IMA + Microsoft) ,
and measured the "standard RMS" of the noise level difference (compared to lossless) .
I find -39.6 db, which is better than both ADPCM version , separately.
So it "might" be interesting to combine two game rips.

This post has been edited by extrabigmehdi: Jan 30 2013, 13:57
Go to the top of the page
+Quote Post
Neuron
post Jan 30 2013, 14:14
Post #16





Group: Members
Posts: 141
Joined: 14-December 12
Member No.: 105171



Thank you, but what does "signal: -19 db", ratio of signal to what? If the next values compute the RMS of noise.
Can you try doing it with regular 8-bit PCM vs. 16-bit original? The results seem counter-intuitive, MS ADPCM sounds better than IMA (and I provided an ABX test to prove that I indeed hear a difference and that it is the IMA file which sounds noisier to me). The SNR you got corresponds to a 5-7 bit signal which sounds much worse than either of the ADPCM or an 8-bit version.

I understand that in for example mp3, dynamic range and SNR don't really relate and mp3 has a dynamic range of about 144 dB while frequently having a SNR of 20 dB or even lower. However, mp3 masks the noise by clever psychoacoustic methods. ADPCM does not do any psychoacoustic tricks so if the SNR is about 38 dB it should sound as bad as 6-bit PCM but it doesn't. When I'm thinking about it, what is the dynamic range of ADPCM anyways? Will it be 96 dB because of being decoded to 16-bit PCM, but with a low SNR, thus explaining the paradox?
Go to the top of the page
+Quote Post
pdq
post Jan 30 2013, 15:24
Post #17





Group: Members
Posts: 3304
Joined: 1-September 05
From: SE Pennsylvania
Member No.: 24233



The "dynamic range" of mp3 is actually quite a bit more than that. To understand this, you need to think in terms of a floating point number. Mp3 has, in effect, a fairly small mantissa, so it can only represent any value with limited precision. However, its exponent can range from very large to very small, making the range of values that can be represented quite large.
Go to the top of the page
+Quote Post
db1989
post Jan 30 2013, 15:29
Post #18





Group: Super Moderator
Posts: 5141
Joined: 23-June 06
Member No.: 32180



QUOTE (Neuron @ Jan 30 2013, 13:14) *
ADPCM does not do any psychoacoustic tricks so if the SNR is about 38 dB it should sound as bad as 6-bit PCM but it doesn't.
No, it shouldn’t, because it doesn’t output at 6-bit.

QUOTE
When I'm thinking about it, what is the dynamic range of ADPCM anyways? Will it be 96 dB because of being decoded to 16-bit PCM, but with a low SNR, thus explaining the paradox
Yes.
Go to the top of the page
+Quote Post
extrabigmehdi
post Jan 30 2013, 15:49
Post #19





Group: Members
Posts: 400
Joined: 15-August 09
Member No.: 72330



QUOTE (Neuron @ Jan 30 2013, 13:14) *
Thank you, but what does "signal: -19 db", ratio of signal to what? If the next values compute the RMS of noise.

It's the value returned by the normalize function of soundforge.
If you have -19 db for signal, and -38.2 db for noize, then you can deduce,
that the signal is 19.2 db louder than the noize (38.2-19).
I guess 0 db, would represent the loudest signal that the normalize function could measure on a file.

Regarding 8 bit , well I decreased the bit depth of your file "Eric_Brosius___02___Med_Sci_1___44_Khz_lossless.flac"
to 8 bit using the most straightforward algorithm (no noise shaping).
Then again using most straightforward algorithm, I've converted it to 16 bit,
and calculated difference with original file.
RMS of difference measured , is -96 db, which could be interpreted that there's no meaningful (or no) difference.

EDIT: I've done the same experience, with a random file, similar result, not sure what to conclude.

EDIT 2: Listened to 8bit version of my random file from speakers, it doesn't sound bad to me. I won't do an ABX test though.


This post has been edited by extrabigmehdi: Jan 30 2013, 16:06
Go to the top of the page
+Quote Post
Neuron
post Jan 30 2013, 16:00
Post #20





Group: Members
Posts: 141
Joined: 14-December 12
Member No.: 105171



I did an Audacity convert to mono + match both volumes using Amplify + invert one of the track and Mix and render way of subtracting one track from the other. I got a "noise signal", peaking only 11.3 dB below the top. The weird thing is, the quieter parts of the song (not silence, only 9-10 dB below maximum) had "noise" as quiet as -45 dB while the louder parts went up to 11.3 dB. This is not all that is strange, because the "noise" left by the subtraction is actually a recognisable signal of the music, although very noisy (I will post a sample in the uploads section). By contrast, the dithered 8-bit signal is very audibly noisy, but it leaves a normal noise signal at -35.3 dB (which is a bit weird as well as 8-bit sound should have a 48 dB SNR and dithered 42 dB as I used only 1-bits of triangular dither, plus, the original signal is slightly present in the noise as well). The undithered 8-bit signal produces normal random noise at -48.2 dB as expected. Both dithered and undithered 8-bit signal have obvious, strong noise in them, unlike the ADPCM files.

So, how to make sense of this? And why every difference signal except for the non-dithered 8-bit one has recognisable music it it?
Go to the top of the page
+Quote Post
Neuron
post Jan 30 2013, 16:07
Post #21





Group: Members
Posts: 141
Joined: 14-December 12
Member No.: 105171



QUOTE (extrabigmehdi @ Jan 30 2013, 15:49) *
QUOTE (Neuron @ Jan 30 2013, 13:14) *
Thank you, but what does "signal: -19 db", ratio of signal to what? If the next values compute the RMS of noise.

It's the value returned by the normalize function of soundforge.
If you have -19 db for signal, and -38.2 db for noize, then you can deduce,
that the signal is 19.2 db louder than the noize (38.2-19).
I guess 0 db, would represent the loudest signal that the normalize function could measure on a file.

Regarding 8 bit , well I decreased the bit depth of your file "Eric_Brosius___02___Med_Sci_1___44_Khz_lossless.flac"
to 8 bit using the most straightforward algorithm (no noise shaping).
Then again using most straightforward algorithm, I've converted it to 16 bit,
and calculated difference with original file.
RMS of difference measured , is -96 db, which could be interpreted that there's no meaningful (or no) difference.

EDIT: I've done the same experience, with a random file, similar result, not sure what to conclude.


It is not an 8-bit file converted to 16-bit. I've done the same thing as you did and I got a normal noise signal at -48.2 dB as expected with an undithered 8-bit file (and the result was usual 8 bit noisy music), as I said in the post before. The other results of my experiments are very weird through...
Go to the top of the page
+Quote Post
Neuron
post Jan 30 2013, 16:13
Post #22





Group: Members
Posts: 141
Joined: 14-December 12
Member No.: 105171



QUOTE (extrabigmehdi @ Jan 30 2013, 15:49) *
EDIT: I've done the same experience, with a random file, similar result, not sure what to conclude.

EDIT 2: Listened to 8bit version of my random file from speakers, it doesn't sound bad to me. I won't do an ABX test though.


Well, neither 4-bit ADPCM or 8-bit PCM are really "bad". 8-bit PCM was used in pretty much all 1980s samplers and 4-bit ADPCM of all flavours was present in pretty much all software with sound or music until about 2005. You can listen to the ADPCM versions too and they will sound even better than 8-bit. It is just that it is... weird, from a technical standpoint. Weird that it is so hard to get a simple SNR value for it. Are there any formulas for ADPCM like there is the famous 6x number of bits = SNR in dB for PCM?

If you want bad, try 1-bit Nintendo DPCM wink.gif .

This post has been edited by Neuron: Jan 30 2013, 16:15
Go to the top of the page
+Quote Post
extrabigmehdi
post Jan 30 2013, 17:03
Post #23





Group: Members
Posts: 400
Joined: 15-August 09
Member No.: 72330



QUOTE (Neuron @ Jan 30 2013, 15:00) *
I got a "noise signal", peaking only 11.3 dB below the top.


Measuring RMS is more representative of loudness than peak.

QUOTE
Well, neither 4-bit ADPCM or 8-bit PCM are really "bad".


I guess , that higher bit depth is only useful, if you want to reach higher dynamic range.
Go to the top of the page
+Quote Post
saratoga
post Jan 30 2013, 18:20
Post #24





Group: Members
Posts: 4715
Joined: 2-September 02
Member No.: 3264



QUOTE (Neuron @ Jan 30 2013, 10:00) *
I did an Audacity convert to mono + match both volumes using Amplify + invert one of the track and Mix and render way of subtracting one track from the other. I got a "noise signal", peaking only 11.3 dB below the top. The weird thing is, the quieter parts of the song (not silence, only 9-10 dB below maximum) had "noise" as quiet as -45 dB while the louder parts went up to 11.3 dB. This is not all that is strange, because the "noise" left by the subtraction is actually a recognisable signal of the music, although very noisy (I will post a sample in the uploads section). By contrast, the dithered 8-bit signal is very audibly noisy, but it leaves a normal noise signal at -35.3 dB (which is a bit weird as well as 8-bit sound should have a 48 dB SNR and dithered 42 dB as I used only 1-bits of triangular dither, plus, the original signal is slightly present in the noise as well). The undithered 8-bit signal produces normal random noise at -48.2 dB as expected. Both dithered and undithered 8-bit signal have obvious, strong noise in them, unlike the ADPCM files.

So, how to make sense of this? And why every difference signal except for the non-dithered 8-bit one has recognisable music it it?


Have you looked at the wikipedia page on ADPCM? What you're describing is basically the difference between PCM and ADPCM:

QUOTE
The default signal compression encoding on a DS0 is either μ-law (mu-law) PCM (North America and Japan) or A-law PCM (Europe and most of the rest of the world). These are logarithmic compression systems where a 13 or 14 bit linear PCM sample number is mapped into an 8 bit value.


So it's compression involves taking a 14 bit signal (or some other value depending on the flavor of ADPCM) and spacing the levels on a log scale. So if the signal is very quiet, the levels are close together, and the error is smaller. If the signal is larger, the error is larger. If the error was constant, you'd have regular PCM.
Go to the top of the page
+Quote Post
Neuron
post Jan 30 2013, 21:04
Post #25





Group: Members
Posts: 141
Joined: 14-December 12
Member No.: 105171



QUOTE (extrabigmehdi @ Jan 30 2013, 17:03) *
QUOTE (Neuron @ Jan 30 2013, 15:00) *
I got a "noise signal", peaking only 11.3 dB below the top.


Measuring RMS is more representative of loudness than peak.

QUOTE
Well, neither 4-bit ADPCM or 8-bit PCM are really "bad".


I guess , that higher bit depth is only useful, if you want to reach higher dynamic range.


Well, bit depth of 8-bit PCM or 4-bit ADPCM has quite obvious noise. It is not annoying, but it is also clearly not CD quality. Also, as I learned here, 4-bit ADPCM actually has a 96 dB dynamic range. (because it is mapped to 16 bit). The SNR and dynamic range are the same in undithered PCM, but not in dithered PCM or any flavour of ADPCM. If I understood correctly, this is why you can hear the signal below the noise level on dithered PCM, ADPCM and mp3, kind of like on cassette tapes. The "noise floor" of undithered PCM is more like the event horizon of a black hole - you cannot have a signal under the noise level, it is forever lost.

8-bit PCM, unlike ADPCM, has a lower dynamic range (48 dB), but it is not the same kind of dynamic range reduction as in clipped and overcompressed awful "loudness war" sound. Clipping destroys the most significant bits of the recording (it cuts the dynamic range "from the top", making waveforms have square wave shapes on their peaks), while normal bit rate reduction removes the least significant bits, decreasing dynamic range "from the bottom" (dithering is more complicated through). 8-bit PCM will not dynamically compress the sound at all, but it will distort fadeouts and quiet parts and this is why dithering is used - it reduces the SNR but increases the dynamic range.

This post has been edited by Neuron: Jan 30 2013, 21:16
Go to the top of the page
+Quote Post

2 Pages V   1 2 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 17th April 2014 - 02:51