IPB

Welcome Guest ( Log In | Register )

3 Pages V   1 2 3 >  
Reply to this topicStart new topic
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
AndyH-ha
post May 19 2013, 22:51
Post #2





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



Better for what? Quantization errors are obviously much smaller but 32 bit float errors are so far below audible that the difference is purely spiritual. If you have faith, you will be saved, but if you have not, you never will notice the slightest difference. Besides, when you convert back to 16 bit, it won't matter anyway.

If you think you hear noise from resampling at 16 bit, I think there is something strange going on. I don't play with midi, are you sure it was originally created at 16 bit? The quantization noise from converting from one sample rate to another sample rate, starting and ending with 16 bit, is down more than 90dBfs. It could not be heard at any normal listening level if there is other signal present (i.e. some music). However, if the midi was created at 8 bit, there would be quite a difference.
Go to the top of the page
+Quote Post
zerowalker
post May 19 2013, 22:55
Post #3





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



QUOTE (AndyH-ha @ May 19 2013, 23:51) *
Better for what? Quantization errors are obviously much smaller but 32 bit float errors are so far below audible that the difference is purely spiritual. If you have faith, you will be saved, but if you have not, you never will notice the slightest difference. Besides, when you convert back to 16 bit, it won't matter anyway.

If you think you hear noise from resampling at 16 bit, I think there is something strange going on. I don't play with midi, are you sure it was originally created at 16 bit? The quantization noise from converting from one sample rate to another sample rate, starting and ending with 16 bit, is down more than 90dBfs. It could not be heard at any normal listening level if there is other signal present (i.e. some music). However, if the midi was created at 8 bit, there would be quite a difference.



What happens when errors are in 32 bit and converted to 16 bit?
Are the noise removed as itīs below 16 bit or what?

I think itīs 8 bit originally, but itīs played at 16bit cause else it would be noisy.
So i guess thatīs what makes the noise, cause itīs very audible.

Go to the top of the page
+Quote Post
jensend
post May 19 2013, 23:24
Post #4





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



Edit: I wrote the below before seeing Andy-ha's comment and your reply. Your reply shows that you are quite confused. This seems to be a pattern in many of your posts. You need to try to get a grasp of the basics of digital audio. The sources I list can help. Hint: if a recording is 8-bit, "playing it back at 16-bit" will improve nothing. You can't make up information out of nowhere.

--
Well, you've been around here long enough that I would have expected you to have taken the opportunity to educate yourself about these topics rather than needing to ask this kind of question. Try using the HA wiki or Wikipedia or watching the Xiph.org videos.

The short answer: even at 16 bit integer if you're hearing the noise there's something wrong with your setup. Maybe you have a bad resampler or are using poor options.

Yes, increased bit depth allows for lower noise energy. But even with 16-bit truncation the quantization noise will rarely be a problem. For perspective, the NES had 7-bit PCM (usu. stored as DPCM), so the noise floor of 16-bit PCM is basically 54dB lower. That's a lot.

Dither doesn't reduce the noise energy, but it allows you make sure the noise is spread across the spectrum rather than concentrated in harmonic distortions. This is an absolute necessity if you're quantizing to 12 bits or less; at 16 bits you can take it or leave it; there's no reason to bother at higher bit depths.

20 bits of precision is basically as much as you can get out of any real-world ADCs or DACs due to thermal noise. 24-bit is useful helps people have plenty of headroom in recording and processing/mastering.

The reason to use floats is not really precision but convenience and simplicity. Using 32-bit float only gives you one extra bit of significand precision over 24-bit integer; the exponent does give quiet samples more precision than they have in fixed-point, but again you aren't getting enough precision from ADCs and DACs to make that matter. 32-bit float is already kinda overkill for audio; there's no point even considering 64-bit.

This post has been edited by jensend: May 19 2013, 23:30
Go to the top of the page
+Quote Post
zerowalker
post May 20 2013, 00:51
Post #5





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



Probably, i have tried reading, but i guess i should look into it more than just ask away.

And this isnīt just 8-bit to 16bit.
Itīs coming from emulation, so i am not sure how that works, but i guess the produced audio is coming from 8 bit, but itīplayed at 16bit, before even storing it as 8bit.
Something like that i guess, which only makes difference when resampling, as the information working with is "8-Bit".
Itīs unique situation i guess.

I will look up more about how converting up and down in Bit Depth changes stuff etc, thanks for the help:)

This post has been edited by db1989: May 20 2013, 12:25
Reason for edit: deleting pointless full quote
Go to the top of the page
+Quote Post
saratoga
post May 20 2013, 01:49
Post #6





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



If its 8 bit then playing it at 16 bit is no different than playing at 8 bit.
Go to the top of the page
+Quote Post
AndyH-ha
post May 20 2013, 01:53
Post #7





Group: Members
Posts: 2192
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 #8





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
saratoga
post May 20 2013, 03:18
Post #9





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



I doubt you can even find a 16 bit resampler. Anything on PC will almost run at 32 bit or greater. Its actually much harder to make a 16 bit resampler than a floating point one, hence they were mostly just used on old 16 bit DSPs.
Go to the top of the page
+Quote Post
bennetng
post May 20 2013, 05:55
Post #10





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
AndyH-ha
post May 20 2013, 07:05
Post #11





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



QUOTE
What do you mean that one 1 large error remain?
Quantization errors in 16 bit integer are much larger than quantization in floating point. Work in floating point and each error is "small". The same work, done in 16 bit integer, produces the same number of errors, each larger than those of floating point by more that two orders of magnitude.

So, work in floating point, then convert back to 16 bit integer. 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.

Still, the point that has been made several times. if you have genuine 16 bit data, and all you do is change the sample rate once, the error noise is not going to be audible under normal circumstances.
Go to the top of the page
+Quote Post
zerowalker
post May 20 2013, 07:52
Post #12





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 #13





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 #14





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
AndyH-ha
post May 20 2013, 10:10
Post #15





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



Quantization errors never "go away". They are impossible to avoid.
Dithering eliminates the distortion caused by the errors but not the errors.
Dither is noise. Dithering adds still more noise to fix the distortion.
Noise shaping moves the noise to less audible frequencies.
Therefore, you end up with more noise, no distortion, and cleaner sound.
Applying dither may be automatic in some programs but not in any I use.
One must choose to dither, choose the kind of dither, choose to use noise shaping and choose what kind of noise shaping.
Go to the top of the page
+Quote Post
bennetng
post May 20 2013, 10:19
Post #16





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 #17





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
zerowalker
post May 20 2013, 19:41
Post #18





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



QUOTE (AndyH-ha @ May 20 2013, 11:10) *
Quantization errors never "go away". They are impossible to avoid.
Dithering eliminates the distortion caused by the errors but not the errors.
Dither is noise. Dithering adds still more noise to fix the distortion.
Noise shaping moves the noise to less audible frequencies.
Therefore, you end up with more noise, no distortion, and cleaner sound.
Applying dither may be automatic in some programs but not in any I use.
One must choose to dither, choose the kind of dither, choose to use noise shaping and choose what kind of noise shaping.



Yeah i understand that.

Itīs pretty much like video dithering, it tried to replicate higher bit by adding noise that makes an illusion that itīs better than itīs acctually is.

I will have to look up about the dithering and noise shaping in the resampler i am using (and bit converter).

Is there any special shape that is good?
Go to the top of the page
+Quote Post
AndyH-ha
post May 20 2013, 21:23
Post #19





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



Some companies have made a big advertising thing about how their dithering-noise shaping is better than others but I think the reality is pretty much the same as with audiophile interconnects. Frequently, programs that provide different options will suggest various ones for differing kinds of audio material.

It is possible to make choices that will add audible noise to your music although that will depend partly on the music. Loud compressed stuff probably won't leave any room for the most blatant dither noise. Simple acoustical material with extended low level sections might show up some noise from some kinds of dither-noise shaping.

I just experimented with the options I have and selected what worked without adding anything I could hear for itself. I've found 0.5 bits of shaped triangular dither sufficient for all of my normal work. I suspect the label on the noise shaping depends on the program supplying it.

Created 10 seconds or so of silence in floating point or 24 bit integer. Convert to 16 bit with various dither and noise shaping options. You should see that some options add much more noise than others. If you can hear anything at less than an extremely high volume level, it is too much dither and/or poor noise shaping.

Generate a pure mid frequency tone in floating point or 24 bit at around -12dBfs. Convert to 16 bit without dither. You may be able to hear the distortion. You should be able to easily detect it in a spectral view and/or frequency analysis. Try a sweep tone that fades into silence.

Next repeat with your choice of dither & noise shaping. If the distortion isn't gone, you did not add enough dither. If you can hear anything added to what you hear in the higher resolution original, without turning up the volume above what is comfortable for the louder parts of your tone, the noise shaping is inadequate.
Go to the top of the page
+Quote Post
jensend
post May 21 2013, 00:09
Post #20





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



QUOTE (zerowalker @ May 20 2013, 12:41) *
Itīs pretty much like video dithering, it tried to replicate higher bit by adding noise that makes an illusion that itīs better than itīs acctually is.
Great heavens, no. This is not an illusion. It's not "faking" being "better than it actually is." It's substituting other noise for the input-dependent noise you get for truncation to make it even less perceptible.

Did you watch the Xiph video I linked which explains this stuff? If not, why not? Are you unwilling to take such a basic step to educate yourself?

AndyH-ha, you are doing a great job of helping this fellow become even more confused than he already is.

There's no reason on earth you should have to be concerned the subtle differences between different shaped dithers here. DITHER IS NOT YOUR PROBLEM. NOR IS BIT DEPTH. The sample you uploaded sounds just fine at 16 bits after being resampled with any decent resampler, regardless of dither options.

If you're having trouble you need to figure out what's wrong with your toolchain. A couple questions to start off- what's your target sample rate? Are all the clips starting out as 16-bit 48kHz like the one you uploaded?

I haven't tested it, but perhaps the avisynth resampler isn't too good. Some details about it in this post. 64 taps is not a lot esp with linear interpolation.
Go to the top of the page
+Quote Post
zerowalker
post May 21 2013, 01:18
Post #21





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



By changing the noise and moving it so it doesnīt become audible , or a least less, thatīs what i meant with it being like video dithering.
Sound is not like video, so i am not making a side comparison there, sorry for making it sound like that.

And i tried to watch the video, but it never loaded, tried many times with 480p and 720p etc, even downloading it, nothing worked:(

And i am not really having an real problem.
I just wanted to know about it, from the start i just wanted to know if 64bit float is better than 32bit float, which it seems like it is, but in such a degree that it doesnīt even matter.

I am grateful to AndyH, he is helping me out alot, as well as others, if you donīt want to answer or think that i shouldnīt bother by even asking, then i will wonīt demand anything (and i donīt demand anything to start with though:) )


EDIT:

The video seems to work now, atleast the downloading works, not the flash player, so will watch it:)

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
bennetng
post May 21 2013, 01:57
Post #22





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 #23





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
bennetng
post May 21 2013, 02:15
Post #24





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



QUOTE (zerowalker @ May 21 2013, 09:01) *

I mean the resampled 13579.wav, not this one.
Go to the top of the page
+Quote Post
zerowalker
post May 21 2013, 02:24
Post #25





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



QUOTE (bennetng @ May 21 2013, 03:15) *
QUOTE (zerowalker @ May 21 2013, 09:01) *

I mean the resampled 13579.wav, not this one.


Oh, here: http://www.sendspace.com/file/iqpnf4

I hear noise as well on this one after resampling.
Not much, but you hear it pretty clearly at the end.
Go to the top of the page
+Quote Post

3 Pages V   1 2 3 >
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: 21st April 2014 - 08:59