IPB

Welcome Guest ( Log In | Register )

Resampling - Rounding Errors and Bit Depth.
zerowalker
post May 19 2013, 22:26
Post #1





Group: Members
Posts: 239
Joined: 6-August 11
Member No.: 92828



Okay so i recently got knowledge about the use of Bit Depth for Resampling.
I noticed that when i resampled old SNES music (which is pretty much, midi sound) i heard noise appearing on occasions.
At first i thought it was there originally, but then i rechecked, and well it wasnīt.

I then asked around about it, and got knowledge about Rounding Errors.
When resampling is done, there will be errors, and at 16bit (which was what i was working at) the errors are noticeable as there isnīt much do work with.
But when working at 32bit Float, the errors are so small that they pretty much donīt exist i guess, at least itīs not audible from my understanding.

But now to the thing that crossed my mind.

If 32bit float is great when working with resampling and such, how is 64bit float?
Is it much better, or isn't there any improvement?
Go to the top of the page
+Quote Post
 
Start new topic
Replies
AndyH-ha
post May 20 2013, 01:53
Post #2





Group: Members
Posts: 2191
Joined: 31-August 05
Member No.: 24222



Quantization errors are differences between the floating point calculations of the target (a different sample rate, in your case) and the discrete possible values in any format, integer or floating point. Only so many possible values can be stored because there are only so many bits.

If this isn't clear, think of doing long division on some value like Pi. No matter to how many digits you carry out the answer, there are still more because you never get an exact answer. When the audio data calculations are done, most answers are not a value which fits withing 16 bit, or 32 bit, or whatever number of bits you use. The answers must be truncated at the limit of the possible precision determined by the data format. The difference between that possible answer (determined by the number of bits available) and the "actual" calculated value which would run to more bits, is the quantization error. It is experienced as noise and distortion in the audio.

There are also errors of the same kind when converting from floating point to 16 bit (from any greater number to any lesser number of bits). There is no way to avoid quantization errors, thus more noise and distortion are added when converting down to 16 bits.

The reason for working in floating point instead of 16 bits is there will, in general, be many calculations done on each audio sample to accomplish the goal (in this case, resampling). Each of those calculations adds another error. In floating point format, the errors are too small to matter, whereas when working in 16 bit, each error is much larger.

When converting to 16 bit from 32 bit as the last step, you acquire only one of those larger errors. This is essentially impossible to hear under any normal circumstances.

The normal procedure when reducing bit depth is to dither with noise shaping. This accomplishes two things. One, the dither eliminates the quantization distortion -- not the error itself, only the distortion caused by the error. Two, the noise shaping moves most of the added noise to the highest parts of the audio spectrum. Since human hearing is much less sensitive at these high frequencies, most of the additional noise is inaudible.

In reality, although it is essentially the universal practice to dither, the noise and distortion acquired by converting from 32 bit to 16 bit probably is never audible unless you want to listen to the silence between tracks -- at a very high volume level. All this is quite different at 8 bit, as you have experienced, The noise and distortion are almost always audible at 8 bit.
Go to the top of the page
+Quote Post
zerowalker
post May 20 2013, 02:09
Post #3





Group: Members
Posts: 239
Joined: 6-August 11
Member No.: 92828



QUOTE (AndyH-ha @ May 20 2013, 02:53) *
When converting to 16 bit from 32 bit as the last step, you acquire only one of those larger errors. This is essentially impossible to hear under any normal circumstances.

The normal procedure when reducing bit depth is to dither with noise shaping. This accomplishes two things. One, the dither eliminates the quantization distortion -- not the error itself, only the distortion caused by the error. Two, the noise shaping moves most of the added noise to the highest parts of the audio spectrum. Since human hearing is much less sensitive at these high frequencies, most of the additional noise is inaudible.

In reality, although it is essentially the universal practice to dither, the noise and distortion acquired by converting from 32 bit to 16 bit probably is never audible unless you want to listen to the silence between tracks -- at a very high volume level. All this is quite different at 8 bit, as you have experienced, The noise and distortion are almost always audible at 8 bit.


What do you mean that one 1 large error remain?

Yeah read about it a little while ago, Noise Shaping seems to be something like "debanding".

But it seems like there is no real disadvantage of converting to float when resampling (some resampler seems to do this automaticly) as it getīs bigger space to work with, and generate better results (less noise, but it matters of course).

And to the 8 bit as 16 bit.
Itīs hard to explain as i donīt know myself, i have uploaded an example.

http://www.sendspace.com/file/eq568b

Try to resample it without ever changing the bit depth. It will introduce noise.
Go to the top of the page
+Quote Post
bennetng
post May 20 2013, 05:55
Post #4





Group: Members
Posts: 215
Joined: 22-December 05
Member No.: 26587



QUOTE (zerowalker @ May 20 2013, 09:09) *
http://www.sendspace.com/file/eq568b

Try to resample it without ever changing the bit depth. It will introduce noise.

The volume of your file is too low. Fixed-point audio will clip above 0dB and lose quality at low volume. Normalize to about -3dBFS before resampling can improve sound quality.
Go to the top of the page
+Quote Post
zerowalker
post May 20 2013, 07:52
Post #5





Group: Members
Posts: 239
Joined: 6-August 11
Member No.: 92828



QUOTE (bennetng @ May 20 2013, 06:55) *
QUOTE (zerowalker @ May 20 2013, 09:09) *
http://www.sendspace.com/file/eq568b

Try to resample it without ever changing the bit depth. It will introduce noise.

The volume of your file is too low. Fixed-point audio will clip above 0dB and lose quality at low volume. Normalize to about -3dBFS before resampling can improve sound quality.



It doesnīt matter. If i normalize it to that, it will sound fine, but after resampling, there will be noise.
But as said, itīs only in these cases, not any problem really, just thought it was more common than it was.

And to saratoga and AndyH.

Well thatīs good to hear, then there isnīt any reason to not work in 32bit float for resampling, other than saving resources or RAM maybe, which isnīt any problem today.

QUOTE
The conversion-to-16-bit error is larger than the errors while working in floating point, but there is only one such error for each audio sample. Dither the conversion and eliminate the distortion.


So if i resample in float, then convert to 16 bit, there will be a big error, but if dithered (which seems to be done by all resampler?) that big error will go away, or atleast it will be remove from being audible. Is that correct?

Thanks:)
Go to the top of the page
+Quote Post
bennetng
post May 20 2013, 08:07
Post #6





Group: Members
Posts: 215
Joined: 22-December 05
Member No.: 26587



QUOTE (zerowalker @ May 20 2013, 14:52) *
QUOTE (bennetng @ May 20 2013, 06:55) *
QUOTE (zerowalker @ May 20 2013, 09:09) *
http://www.sendspace.com/file/eq568b

Try to resample it without ever changing the bit depth. It will introduce noise.

The volume of your file is too low. Fixed-point audio will clip above 0dB and lose quality at low volume. Normalize to about -3dBFS before resampling can improve sound quality.



It doesnīt matter. If i normalize it to that, it will sound fine, but after resampling, there will be noise.
But as said, itīs only in these cases, not any problem really, just thought it was more common than it was.


Which OS, resampler and soundcard are you using?

This post has been edited by bennetng: May 20 2013, 08:09
Go to the top of the page
+Quote Post
zerowalker
post May 20 2013, 08:17
Post #7





Group: Members
Posts: 239
Joined: 6-August 11
Member No.: 92828



Windows 8, donīt know the resampler itself, but itīs in Avisynth, ResampleAudio(), it works in the bit depth you give it. Sound card it, Creative ZXR Sound Blaster.

This post has been edited by db1989: May 20 2013, 12:27
Reason for edit: deleting pointless full quote
Go to the top of the page
+Quote Post
bennetng
post May 20 2013, 10:19
Post #8





Group: Members
Posts: 215
Joined: 22-December 05
Member No.: 26587



QUOTE (zerowalker @ May 20 2013, 15:17) *
Windows 8, donīt know the resampler itself, but itīs in Avisynth, ResampleAudio(), it works in the bit depth you give it. Sound card it, Creative ZXR Sound Blaster.

http://www.hydrogenaudio.org/forums/index....ost&id=7530
Please download the files and play them directly, using normal volume as if you are listening to a normal song.

54321.wav: You should hear nothing. If you can hear anything then your playback environment is not optimized.

13579.wav: You should ONLY hear a single tone rising up. If you hear any other thing, such as something going up and down constantly then your playback environment is not optimized.

If you passed the tests above, use the resampler to convert the files to 44.1 and 48k and listen to them to see if they still pass the test or not. If not, then the resampler is a low quality one.

This post has been edited by bennetng: May 20 2013, 10:27
Go to the top of the page
+Quote Post
zerowalker
post May 20 2013, 19:38
Post #9





Group: Members
Posts: 239
Joined: 6-August 11
Member No.: 92828



I donīt know how high volume i should have on 54321. Cause "normal" volume for me changes, as many stuff i listen to have different dynamics.
But i donīt hear anything if i have low volume on the player, but if i increase it, i hear noise.

13579 sound like you are saying, a tone going upp, and i hear this "noise" like when itīs increasing, but it think itīs supposed to sound like that, cause itīs not normal noise, itīs like when someone throw a grenade in a movie, and you get that tinnitus sound.

This post has been edited by db1989: May 21 2013, 11:52
Reason for edit: deleting pointless full quote of previous post
Go to the top of the page
+Quote Post
bennetng
post May 21 2013, 01:57
Post #10





Group: Members
Posts: 215
Joined: 22-December 05
Member No.: 26587



QUOTE (zerowalker @ May 21 2013, 02:38) *
13579 sound like you are saying, a tone going upp, and i hear this "noise" like when itīs increasing, but it think itīs supposed to sound like that, cause itīs not normal noise, itīs like when someone throw a grenade in a movie, and you get that tinnitus sound.

Then it is possible that the resampler is not good enough (if not bad). Is the noise
[1] audible when playing the file directly, or
[2] only audible after resampling, or
[3] always audible?

If it is [2], please upload the file.

Floating point is useful in resampling and many other processings, but floating point alone won't make a good resampler. 32-bit float vs 64-bit float is like giving a person 10 litres of drinking water vs 100 litres per day, if there is no food that person won't survive anyway.
Go to the top of the page
+Quote Post
zerowalker
post May 21 2013, 02:01
Post #11





Group: Members
Posts: 239
Joined: 6-August 11
Member No.: 92828



I only hear it after, so 2.

I did upload it here: http://www.sendspace.com/file/eq568b

Oh ah see, i thought More bit for Resampler was making all the difference.
I guess itīs not the best resampler then, what is difference between bad and good resampling?
I know more about Noise and Dither now, but thatīs not done while resampling, but afterwards right?

This post has been edited by db1989: May 21 2013, 11:53
Reason for edit: deleting pointless full quote of previous post
Go to the top of the page
+Quote Post
jensend
post May 21 2013, 06:27
Post #12





Group: Members
Posts: 140
Joined: 21-May 05
Member No.: 22191



I don't hear any problem with your resampled audio, and the spectrogram looks fine. You could try uploading another sample, but I think the problem is in your playback chain and not your resampler. What software and hardware are you using for playback?
QUOTE (zerowalker @ May 20 2013, 19:01) *
Oh ah see, i thought More bit for Resampler was making all the difference.
I guess itīs not the best resampler then, what is difference between bad and good resampling?
Filter quality, not bit depth, is the main consideration. If you look at the src.infinitewave.ca graphs, they try to tell you how the filter compares to an ideal one- flat passband frequency response, silent stopband, infinitely steep transition, linear phase but no pre-echo, normalized sinc impulse response. Such an ideal filter is only possible with infinitely long signals and infinite bit depth; real-world filters have to make some tradeoffs, but the better resamplers from the past decade are close enough to the ideal that the differences oughtn't be audible.

A resampler with a filter that doesn't do a good job of stopping the stopband will have aliasing. When the passband isn't flat you will have other kinds of distortions.

QUOTE
I know more about Noise and Dither now, but thatīs not done while resampling, but afterwards right?
Assuming you mean quantization noise, yes, if a resampler works in higher precision internally it will do the bit depth conversion and dithering (if any) after it has resampled.
Go to the top of the page
+Quote Post
zerowalker
post May 21 2013, 07:37
Post #13





Group: Members
Posts: 239
Joined: 6-August 11
Member No.: 92828



Really?
Donīt you hear any noise at all;S?

Cause i donīt hear noise on other clips and stuff, and i am pretty sure of it, i can most of the time hear noise. Distortion and Artifacts on the other hand, is not something i can clearly hear at high bitrates, though thatīs another thing.

I use Windows 8 with Creative ZxR Sound Blaster at 24Bit 48khz (not sure if i am supposed to use the higher 192khz though, i donīt know that the card resamples to internally).
And doesnīt matter player or Wasapi etc, the noise is there, but as said, very faint, itīs not like Tape noise, i would probably not be bothered even if an entire movie had this kind of noise.

This post has been edited by db1989: May 21 2013, 10:29
Reason for edit: deleting pointless full quote
Go to the top of the page
+Quote Post
probedb
post May 21 2013, 08:10
Post #14





Group: Members
Posts: 1121
Joined: 6-September 04
Member No.: 16817



I'm not sure what you mean by noise in that clip? It sounds fine to me.

My playback setup on Win7 is foobar2k (WASAPI) -> FiiO E7 -> Westone UM3X.

This post has been edited by db1989: May 21 2013, 10:29
Reason for edit: "
Go to the top of the page
+Quote Post
zerowalker
post May 21 2013, 08:22
Post #15





Group: Members
Posts: 239
Joined: 6-August 11
Member No.: 92828



Increase your volume, listen at 4 sec towards the end.
You should be able to hear it.

This post has been edited by db1989: May 21 2013, 10:30
Reason for edit: "
Go to the top of the page
+Quote Post
probedb
post May 21 2013, 11:36
Post #16





Group: Members
Posts: 1121
Joined: 6-September 04
Member No.: 16817



QUOTE (zerowalker @ May 21 2013, 08:22) *
Increase your volume, listen at 4 sec towards the end.
You should be able to hear it.


Do you mean the beeps? There's one at about 3.5s, I can also hear a guitar/bass note at 4s but no noise.
Go to the top of the page
+Quote Post
zerowalker
post May 21 2013, 21:13
Post #17





Group: Members
Posts: 239
Joined: 6-August 11
Member No.: 92828



QUOTE (probedb @ May 21 2013, 12:36) *
QUOTE (zerowalker @ May 21 2013, 08:22) *
Increase your volume, listen at 4 sec towards the end.
You should be able to hear it.


Do you mean the beeps? There's one at about 3.5s, I can also hear a guitar/bass note at 4s but no noise.


Oh, i think we are talking about 2 different samples here.

The 8bit at 16bit (which was incorrect, itīs truly 16bit) sample does NOT have noise.
but If i resample it with the resampler i use (which seems to be quite bad, especially on 16bit) there will be noise.

the: 13579.wav sample does have noise, and thatīs what i was talking about.
Both before and after resampling.

But itīs very faint, but itīs there, and is probably supposed to be there i guess.
Go to the top of the page
+Quote Post
lvqcl
post May 21 2013, 21:25
Post #18





Group: Developer
Posts: 3208
Joined: 2-December 07
Member No.: 49183



QUOTE (zerowalker @ May 22 2013, 00:13) *
Both before and after resampling.

But itīs very faint, but itīs there, and is probably supposed to be there i guess.

I see only dither in the original 13579.wav, and I don't think it's possible to hear it. I also doubt that the noise in resampled 13579.wav is possible to hear.

This post has been edited by lvqcl: May 21 2013, 22:22
Go to the top of the page
+Quote Post
zerowalker
post May 22 2013, 01:14
Post #19





Group: Members
Posts: 239
Joined: 6-August 11
Member No.: 92828



QUOTE (lvqcl @ May 21 2013, 22:25) *
QUOTE (zerowalker @ May 22 2013, 00:13) *
Both before and after resampling.

But itīs very faint, but itīs there, and is probably supposed to be there i guess.

I see only dither in the original 13579.wav, and I don't think it's possible to hear it. I also doubt that the noise in resampled 13579.wav is possible to hear.


Well i do hear it;S
But itīs pretty hard, itīs like itīs at the back of my head.
But i do hear it, right before the Beeping goes to itīs highest point from there to the end.

To hear it more easily, click at about the end of the beep and pause.
Listen carefuly how it sounds, and when you pause, you should here that noise is gone.
What i mean is, itīs not easy to hear at all, but if you compare the sound of the noise to complete silence, itīs easier to hear it.

If the noise was randomly in something, i probably wouldnīt notice it if i wasnīt listening for it.
Go to the top of the page
+Quote Post
phofman
post May 22 2013, 12:37
Post #20





Group: Members
Posts: 261
Joined: 14-February 12
Member No.: 97162



QUOTE (zerowalker @ May 22 2013, 02:14) *
Well i do hear it;S
But itīs pretty hard, itīs like itīs at the back of my head.


QUOTE (Brazil2 @ May 22 2013, 10:14) *
The background dither noise which is visible in the original 13579.wav is about -100 dB:

So you can NOT hear it in the requested normal listening conditions.



I do not want to be abnoxious, but I am afraid this test requires blind listening too smile.gif
Go to the top of the page
+Quote Post

Posts in this topic
- zerowalker   Resampling - Rounding Errors and Bit Depth.   May 19 2013, 22:26
- - AndyH-ha   Better for what? Quantization errors are obviously...   May 19 2013, 22:51
|- - zerowalker   QUOTE (AndyH-ha @ May 19 2013, 23:51...   May 19 2013, 22:55
- - jensend   Edit: I wrote the below before seeing Andy-ha...   May 19 2013, 23:24
|- - zerowalker   Probably, i have tried reading, but i guess i shou...   May 20 2013, 00:51
- - saratoga   If its 8 bit then playing it at 16 bit is no diffe...   May 20 2013, 01:49
- - AndyH-ha   Quantization errors are differences between the fl...   May 20 2013, 01:53
|- - zerowalker   QUOTE (AndyH-ha @ May 20 2013, 02:53...   May 20 2013, 02:09
|- - bennetng   QUOTE (zerowalker @ May 20 2013, 09:09) h...   May 20 2013, 05:55
|- - zerowalker   QUOTE (bennetng @ May 20 2013, 06:55) QUO...   May 20 2013, 07:52
|- - bennetng   QUOTE (zerowalker @ May 20 2013, 14:52) Q...   May 20 2013, 08:07
|- - zerowalker   Windows 8, donīt know the resampler itself, but it...   May 20 2013, 08:17
|- - bennetng   QUOTE (zerowalker @ May 20 2013, 15:17) W...   May 20 2013, 10:19
|- - zerowalker   I donīt know how high volume i should have on 5432...   May 20 2013, 19:38
|- - bennetng   QUOTE (zerowalker @ May 21 2013, 02:38) 1...   May 21 2013, 01:57
|- - zerowalker   I only hear it after, so 2. I did upload it here:...   May 21 2013, 02:01
|- - bennetng   QUOTE (zerowalker @ May 21 2013, 09:01) I...   May 21 2013, 02:15
||- - zerowalker   QUOTE (bennetng @ May 21 2013, 03:15) QUO...   May 21 2013, 02:24
||- - bennetng   Some resampler comparisons: http://src.infinitewav...   May 21 2013, 02:38
||- - zerowalker   Can i make one such graph to try the resampler i u...   May 21 2013, 02:58
||- - phofman   QUOTE (zerowalker @ May 21 2013, 03:58) C...   May 21 2013, 08:50
|- - jensend   I don't hear any problem with your resampled a...   May 21 2013, 06:27
|- - zerowalker   Really? Donīt you hear any noise at all;S? Cause ...   May 21 2013, 07:37
|- - probedb   I'm not sure what you mean by noise in that cl...   May 21 2013, 08:10
|- - zerowalker   Increase your volume, listen at 4 sec towards the ...   May 21 2013, 08:22
|- - probedb   QUOTE (zerowalker @ May 21 2013, 08:22) I...   May 21 2013, 11:36
|- - zerowalker   QUOTE (probedb @ May 21 2013, 12:36) QUOT...   May 21 2013, 21:13
|- - lvqcl   QUOTE (zerowalker @ May 22 2013, 00:13) B...   May 21 2013, 21:25
|- - zerowalker   QUOTE (lvqcl @ May 21 2013, 22:25) QUOTE ...   May 22 2013, 01:14
|- - Brazil2   QUOTE (zerowalker @ May 22 2013, 02:14) Q...   May 22 2013, 09:14
|- - phofman   QUOTE (zerowalker @ May 22 2013, 02:14) W...   May 22 2013, 12:37
- - saratoga   I doubt you can even find a 16 bit resampler. Anyt...   May 20 2013, 03:18
- - AndyH-ha   QUOTE What do you mean that one 1 large error rema...   May 20 2013, 07:05
- - AndyH-ha   Quantization errors never "go away". The...   May 20 2013, 10:10
|- - zerowalker   QUOTE (AndyH-ha @ May 20 2013, 11:10...   May 20 2013, 19:41
|- - jensend   QUOTE (zerowalker @ May 20 2013, 12:41) I...   May 21 2013, 00:09
|- - zerowalker   By changing the noise and moving it so it doesnīt ...   May 21 2013, 01:18
- - AndyH-ha   Some companies have made a big advertising thing a...   May 20 2013, 21:23
- - bennetng   http://src.infinitewave.ca/faq.html QUOTE Absolute...   May 21 2013, 03:29
- - jensend   BTW I'm sorry if my earlier response sounded h...   May 21 2013, 07:04
- - bennetng   Source and result files in src.infinitewave.ca are...   May 21 2013, 10:23
- - lvqcl   Spectrogram for the file uploaded in post #25 (sox...   May 21 2013, 10:52
- - bennetng   http://www.hydrogenaudio.org/forums/index....howto...   May 21 2013, 15:53
|- - zerowalker   What samples should i resample at 24 bit? And shou...   May 21 2013, 21:22
|- - saratoga   QUOTE (zerowalker @ May 21 2013, 16:22) W...   May 21 2013, 21:38
|- - phofman   QUOTE (zerowalker @ May 21 2013, 22:22) W...   May 21 2013, 22:01
|- - bennetng   QUOTE (zerowalker @ May 22 2013, 04:22) A...   May 22 2013, 00:24
|- - zerowalker   Okay i compared Avisynths Resampler at both Float ...   May 22 2013, 10:11
- - Nick.C   Try this sample - if you hear anything except dial...   May 22 2013, 10:12
|- - Dynamic   QUOTE (Nick.C @ May 22 2013, 09:12) Try t...   May 22 2013, 10:35
|- - zerowalker   QUOTE (Nick.C @ May 22 2013, 11:12) Try t...   May 22 2013, 11:00
||- - bennetng   QUOTE (zerowalker @ May 22 2013, 18:00) I...   May 22 2013, 11:16
||- - zerowalker   QUOTE (bennetng @ May 22 2013, 12:16) QUO...   May 23 2013, 03:28
||- - bennetng   QUOTE (zerowalker @ May 23 2013, 10:28) W...   May 23 2013, 04:07
||- - zerowalker   QUOTE (bennetng @ May 23 2013, 05:07) QUO...   May 23 2013, 04:38
||- - probedb   QUOTE (zerowalker @ May 23 2013, 04:38) I...   May 23 2013, 08:04
||- - zerowalker   QUOTE (probedb @ May 23 2013, 09:04) QUOT...   May 23 2013, 08:12
|- - probedb   QUOTE (Nick.C @ May 22 2013, 10:12) Try t...   May 22 2013, 11:18
|- - Ferongr   QUOTE (Nick.C @ May 22 2013, 11:12) Try t...   May 22 2013, 12:49
- - bennetng   Just think that udial is more useful to detect cli...   May 22 2013, 10:44
- - bennetng   Then it seems that you can pass Ethan Winer's ...   May 23 2013, 06:00
|- - zerowalker   QUOTE (bennetng @ May 23 2013, 07:00) The...   May 23 2013, 06:16
- - bennetng   I think zerowalker's system should be fine. 13...   May 23 2013, 10:47


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 - 10:54