HydrogenAudio

Hydrogenaudio Forum => General Audio => Topic started by: zerowalker on 2013-05-19 22:26:16

Title: Resampling - Rounding Errors and Bit Depth.
Post by: zerowalker on 2013-05-19 22:26:16
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?
Title: Resampling - Rounding Errors and Bit Depth.
Post by: AndyH-ha on 2013-05-19 22:51:32
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.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: zerowalker on 2013-05-19 22:55:26
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.

Title: Resampling - Rounding Errors and Bit Depth.
Post by: jensend on 2013-05-19 23:24:27
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 (http://video.xiph.org/vid2.shtml).

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.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: zerowalker on 2013-05-20 00:51:36
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:)
Title: Resampling - Rounding Errors and Bit Depth.
Post by: saratoga on 2013-05-20 01:49:34
If its 8 bit then playing it at 16 bit is no different than playing at 8 bit.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: AndyH-ha on 2013-05-20 01:53:04
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.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: zerowalker on 2013-05-20 02:09:15
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 (http://www.sendspace.com/file/eq568b)

Try to resample it without ever changing the bit depth. It will introduce noise.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: saratoga on 2013-05-20 03:18:55
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.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: bennetng on 2013-05-20 05:55:52
http://www.sendspace.com/file/eq568b (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.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: AndyH-ha on 2013-05-20 07:05:16
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.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: zerowalker on 2013-05-20 07:52:38
http://www.sendspace.com/file/eq568b (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:)
Title: Resampling - Rounding Errors and Bit Depth.
Post by: bennetng on 2013-05-20 08:07:30
http://www.sendspace.com/file/eq568b (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?
Title: Resampling - Rounding Errors and Bit Depth.
Post by: zerowalker on 2013-05-20 08:17:44
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.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: AndyH-ha on 2013-05-20 10:10:06
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.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: bennetng on 2013-05-20 10:19:53
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 (http://www.hydrogenaudio.org/forums/index.php?act=attach&type=post&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.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: zerowalker on 2013-05-20 19:38:35
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.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: zerowalker on 2013-05-20 19:41:36
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?
Title: Resampling - Rounding Errors and Bit Depth.
Post by: AndyH-ha on 2013-05-20 21:23:59
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.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: jensend on 2013-05-21 00:09:46
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 (http://forum.doom9.org/showthread.php?t=165321). 64 taps is not a lot esp with linear interpolation.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: zerowalker on 2013-05-21 01:18:19
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:)
Title: Resampling - Rounding Errors and Bit Depth.
Post by: bennetng on 2013-05-21 01:57:11
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.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: zerowalker on 2013-05-21 02:01:47
I only hear it after, so 2.

I did upload it here: http://www.sendspace.com/file/eq568b (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?
Title: Resampling - Rounding Errors and Bit Depth.
Post by: bennetng on 2013-05-21 02:15:39
I did upload it here: http://www.sendspace.com/file/eq568b (http://www.sendspace.com/file/eq568b)

I mean the resampled 13579.wav, not this one.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: zerowalker on 2013-05-21 02:24:33
I did upload it here: http://www.sendspace.com/file/eq568b (http://www.sendspace.com/file/eq568b)

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


Oh, here: http://www.sendspace.com/file/iqpnf4 (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.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: bennetng on 2013-05-21 02:38:19
Some resampler comparisons:
http://src.infinitewave.ca/ (http://src.infinitewave.ca/)

How to read the graphs:
http://src.infinitewave.ca/help.html (http://src.infinitewave.ca/help.html)

The click sound at the end of the resampled 13579.wav is not a sign of bad resampling. In fact the quality of the file you uploaded is good.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: zerowalker on 2013-05-21 02:58:45
Can i make one such graph to try the resampler i use?

I didn´t say anything about the click sound, don´t you hear the noise?
It seems that the nosie it present in the original one as well, just quite lower.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: bennetng on 2013-05-21 03:29:44
http://src.infinitewave.ca/faq.html (http://src.infinitewave.ca/faq.html)
Quote
Absolutely; you can convert the test files as described above and analyze them with any suitable spectrum analyzer, such as Adobe Audition or iZotope RX.


You can if have such software. Audacity (free) can display similar graphs as well.
for 54321.wav I can also hear the noise before and after resampling if I turn the volume up, but for 13579.wav I can't turn up the volume to listen because my ears will hurt. If you can hear noise then the reason should not be the resampler itself, but similar to this:

http://www.hydrogenaudio.org/forums/index....howtopic=100657 (http://www.hydrogenaudio.org/forums/index.php?showtopic=100657)



Title: Resampling - Rounding Errors and Bit Depth.
Post by: jensend on 2013-05-21 06:27:20
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?
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.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: jensend on 2013-05-21 07:04:56
BTW I'm sorry if my earlier response sounded harsh towards AndyH. Pinpointing someone's problem and explaining stuff is hard; I'm certainly not doing a perfect job either of figuring out where zerowalker is at and adapting to his level of understanding. It's just that getting deeper and deeper into the subtler points about quantization and dither and proposing detailed tests wasn't going to help if basic perspective about the small impact of 16bit quantization was lacking.

We all tried to communicate that perspective- indeed, AndyH more than anyone- but somehow it was getting buried in all those details.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: zerowalker on 2013-05-21 07:37:47
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.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: probedb on 2013-05-21 08:10:22
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.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: zerowalker on 2013-05-21 08:22:18
Increase your volume, listen at 4 sec towards the end.
You should be able to hear it.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: phofman on 2013-05-21 08:50:10
Can i make one such graph to try the resampler i use?


http://sox.sourceforge.net/ (http://sox.sourceforge.net/)

The following command will generate 96kHz (-r 96000) stereo (-c 2) 24bit (-b 24) 8 seconds long sine sweep starting at 1Hz, ending at 48kHz, volume -6dBFS into file sweep.wav:

Code: [Select]
sox -V -r 96000 -c 2 -b 24 -n sweep.wav synth 8 sine 1:48000 vol -6dB



Generating spectrum of the file, Kaiser window, dynamic range -180dB, image stored into spectrum.png:

Code: [Select]
sox sweep.wav -n spectrogram -w Kaiser -z 180 -o spectrum.png


(http://personal.educity.cz/dustin/spectrum.png)
Title: Resampling - Rounding Errors and Bit Depth.
Post by: bennetng on 2013-05-21 10:23:58
Source and result files in src.infinitewave.ca are at least in 24-bit so 16-bit files in this thread cannot have such a clean background anyway. How about downloading the files in
http://src.infinitewave.ca/faq.html (http://src.infinitewave.ca/faq.html)
and send the avisynth results to the webmaster?
Title: Resampling - Rounding Errors and Bit Depth.
Post by: lvqcl on 2013-05-21 10:52:31
Spectrogram for the file uploaded in post #25 (sox 13579.wav --null spectrogram -w Kaiser):

(http://i.imgur.com/10aZ5ZG.png)
Title: Resampling - Rounding Errors and Bit Depth.
Post by: probedb on 2013-05-21 11:36:58
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.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: bennetng on 2013-05-21 15:53:50
http://www.hydrogenaudio.org/forums/index....howtopic=100951 (http://www.hydrogenaudio.org/forums/index.php?showtopic=100951)

Noise spectrum of avisynth's resampler (uploaded in post #25 by zerowalker) vs Adobe Auditon 1.5's resampler (convert to 32-bit float before resampling, then convert to 16-bit without dithering)
Red: Audition
Green: avisynth
Title: Resampling - Rounding Errors and Bit Depth.
Post by: zerowalker on 2013-05-21 21:13:46
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.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: zerowalker on 2013-05-21 21:22:09
What samples should i resample at 24 bit?
And should i convert it to float before, or let it be?

And from looking at the Versus against Adobe Audition 1.5, isn´t it a bit better, or am i wrong?
And it doesn´t seem to be dithered by Avisynth resampler anyway, as it wouldn´t have those peaks if i understood the Instruction video linked earlier.


And just to confirm the SRC graphs, The less noise (Blue and colored lines) the better, is that correct?
Cause if so, the Adobe Audition CS6 seems to be one of the best, and Zinotope.


Will make when i can, but the site http://sox.sourceforge.net/ (http://sox.sourceforge.net/) is currently blocked.

Title: Resampling - Rounding Errors and Bit Depth.
Post by: lvqcl on 2013-05-21 21:25:38
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.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: saratoga on 2013-05-21 21:38:30
What samples should i resample at 24 bit?
And should i convert it to float before, or let it be?


I wouldn't convert anything at all. 

Instead I would figure out whats wrong with your processing thats causing you to corrupt your audio and then fix that problem. 

Title: Resampling - Rounding Errors and Bit Depth.
Post by: phofman on 2013-05-21 22:01:14
Will make when i can, but the site http://sox.sourceforge.net/ (http://sox.sourceforge.net/) is currently blocked.

 
  The sox homepage is blocked, fortunately the download repository works OK. Binaries available at http://sourceforge.net/projects/sox/files/sox/14.4.1/ (http://sourceforge.net/projects/sox/files/sox/14.4.1/)
Title: Resampling - Rounding Errors and Bit Depth.
Post by: bennetng on 2013-05-22 00:24:49
And from looking at the Versus against Adobe Audition 1.5, isn´t it a bit better, or am i wrong?
And it doesn´t seem to be dithered by Avisynth resampler anyway, as it wouldn´t have those peaks if i understood the Instruction video linked earlier.

You are not wrong, when I listened to the 13579.wav you uploaded at high volume (which I feel pain), I can also hear noise at the end. From technical point of view (graphs and statistics) the resampler in SoX is even better then Audition 1.5.

Benefits of dithering depend on the singal to noise ratio of the original signal. If the original signal has enough noise and the signal (the rising tone of 13579.wav in this discussion) is strong enough, there is no need to add extra noise (dither) during processing, therefore I disabled dithering in Audition to show that there is no visible truncation artifacts even when dithering is disabled.

I don't know if avisynth can disable dithering, or use less noise, or use different kinds of noise shaping or not, but it is unfair to say a resampler is a bad one because of higher dithering level. A (relatively) bad resampler can show more than 1 bright line in the graph, like Ableton Live 8.2 shows up in the default page of
http://src.infinitewave.ca/ (http://src.infinitewave.ca/)
while a (relatively) good one is like Audacity 2.0.3. An extremely bad one is like Secret Rabbit Code 0.1.2 (ZOH) with bright lines all over the graph.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: zerowalker on 2013-05-22 01:14:02
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.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: Brazil2 on 2013-05-22 09:14:07

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

The background dither noise which is visible in the original 13579.wav is about -100 dB:
(http://i.imgur.com/RVGJVQi.png)

So you can NOT hear it in the requested normal listening conditions.
Please download the files and play them directly, using normal volume as if you are listening to a normal song.


If you do hear noise then it doesn't come from the file but there must be something going wrong in your playing chain, as already suggested here:
http://www.hydrogenaudio.org/forums/index....st&p=834855 (http://www.hydrogenaudio.org/forums/index.php?showtopic=100920&view=findpost&p=834855)
Title: Resampling - Rounding Errors and Bit Depth.
Post by: zerowalker on 2013-05-22 10:11:11
Okay i compared Avisynths Resampler at both Float to 16bit from 92khz to 44.1khz and at 16bit entiarly against Adobe Auditions, not sure if it works in float or not, but fed it the float and converted it to 16bit and 44.1khz, and the 16bit file and just resampled (i did NOT have dither on. with it, the spectrum was a lot "noisier").

And Avisynth was pretty clear, but it did have a few lines that bent around (not sure what they are called), while Audition just had noise at the part where the audio is and just black afterwards.


And also did a test with the 16 bit at 8 bit file, and it was much nosier at 16bit vs Float to 16bit with Avisynth Resampler.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: Nick.C on 2013-05-22 10:12:11
Try this (http://dl.project-voodoo.org/killer-samples/udial.flac) sample - if you hear anything except dial tones then your playback chain is compromised.

[edit]

Health Warning: play at normal volume as ultrasonics can damage tweeters!

Apologies for omitting this.

[/edit]

Title: Resampling - Rounding Errors and Bit Depth.
Post by: Dynamic on 2013-05-22 10:35:36
Try this (http://dl.project-voodoo.org/killer-samples/udial.flac) sample - if you hear anything except dial tones then your playback chain is compromised.


When posting links to udial, I always preface them with the warning that turning it up too loud can fry or blow fuses in tweeters (as reported some years ago on these foums) thanks to the high amplitude, but inaudible ultrasound, so maintain a normal playback volume and don't apply ReplayGain or R128 Equalizer to the sound.

In fact, I used to have a copy stored in a password protected ZIP file named "udial WARNING may fry tweeters if turned up, password is 'warned'.zip"
Title: Resampling - Rounding Errors and Bit Depth.
Post by: bennetng on 2013-05-22 10:44:41
Just think that udial is more useful to detect clipping rather than the quality of the resampler itself.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: zerowalker on 2013-05-22 11:00:55
Try this (http://dl.project-voodoo.org/killer-samples/udial.flac) sample - if you hear anything except dial tones then your playback chain is compromised.


I hear noise when the loud beep goes till the end.

Like

Beep beep beep ..... BEEP(noise around), until the beeping goes away near 2 sec, then all goes quiet.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: bennetng on 2013-05-22 11:16:59
I hear noise when the loud beep goes till the end.

Like

Beep beep beep ..... BEEP(noise around), until the beeping goes away near 2 sec, then all goes quiet.


There are some pauses between the four long beeps. Is the noise continuous or only audible when beep sound is present?
Is the noise constantly changing or just random noise like what you heard in 13579.wav?
Title: Resampling - Rounding Errors and Bit Depth.
Post by: probedb on 2013-05-22 11:18:09
Try this (http://dl.project-voodoo.org/killer-samples/udial.flac) sample - if you hear anything except dial tones then your playback chain is compromised.


This is also all fine for me.

zerowalker, what have you tried swapping out in your audio setup? I've had dodgy speakers/headphones create distortion and buzzing but only on certain things.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: phofman on 2013-05-22 12:37:27
Well i do hear it;S
But it´s pretty hard, it´s like it´s at the back of my head.


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
Title: Resampling - Rounding Errors and Bit Depth.
Post by: Ferongr on 2013-05-22 12:49:21
Try this (http://dl.project-voodoo.org/killer-samples/udial.flac) sample - if you hear anything except dial tones then your playback chain is compromised.


I think I can hear the high-frequency content. It's a barely audible high-frequency continuous tone starting at the 70 ms mark that creates some kind of odd pressure on the inside of my ears. I'm not sure how to interpret the results. Is it the actual ~20kHz tone that I'm hearing or distortion?
Title: Resampling - Rounding Errors and Bit Depth.
Post by: zerowalker on 2013-05-23 03:28:36
I hear noise when the loud beep goes till the end.

Like

Beep beep beep ..... BEEP(noise around), until the beeping goes away near 2 sec, then all goes quiet.


There are some pauses between the four long beeps. Is the noise continuous or only audible when beep sound is present?
Is the noise constantly changing or just random noise like what you heard in 13579.wav?



When the high beeps starts it´s a contant noise until the last beep ends.
And this noise is very audible, i can hear it clearly on low volumes as well.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: bennetng on 2013-05-23 04:07:58
When the high beeps starts it´s a contant noise until the last beep ends.
And this noise is very audible, i can hear it clearly on low volumes as well.


Use foobar2000, go to file>preferences>playback. In the ReplayGain section please set
Source mode: none
Processing: apply gain
Then decrease the volume of "Without RG info"
This should remove the noise. If yes, please report how many dB you need to decrease in order to remove the noise.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: zerowalker on 2013-05-23 04:38:19
When the high beeps starts it´s a contant noise until the last beep ends.
And this noise is very audible, i can hear it clearly on low volumes as well.


Use foobar2000, go to file>preferences>playback. In the ReplayGain section please set
Source mode: none
Processing: apply gain
Then decrease the volume of "Without RG info"
This should remove the noise. If yes, please report how many dB you need to decrease in order to remove the noise.


Then noise is always there, but sure if i lower the volume it won´t hear it.
But from those settings, i can hear it even at the lower -20db, but it´s very hard to hear it. But the beeping itself is also very low.

It makes no sense for me that you can´t hear it;S
Is it at those frequencies that young people can hear, and older people can´t?
Cause that would explain why i can hear it and you can´t (If my ears allow that frequencies, which i haven´t really tried).
Title: Resampling - Rounding Errors and Bit Depth.
Post by: bennetng on 2013-05-23 06:00:37
Then it seems that you can pass Ethan Winer's test. Please go to his homepage and do the test following his instructions:
http://www.ethanwiner.com/dither.html (http://www.ethanwiner.com/dither.html)

The test is only about dither, not related to the ability to hear some specific frequencies. Ethan Winer is a member of hydrogenaudio as well.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: zerowalker on 2013-05-23 06:16:03
Then it seems that you can pass Ethan Winer's test. Please go to his homepage and do the test following his instructions:
http://www.ethanwiner.com/dither.html (http://www.ethanwiner.com/dither.html)

The test is only about dither, not related to the ability to hear some specific frequencies. Ethan Winer is a member of hydrogenaudio as well.


I can´t hear any difference between those test files, no noise or anything.
I didn´t hear noise on either at all compared to the dial tone and swipe test.

It seems i appears at very high frequencies, i don´t know if it comes from dithering, resampling, or just appears from high tones though.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: probedb on 2013-05-23 08:04:20
It makes no sense for me that you can´t hear it;S
Is it at those frequencies that young people can hear, and older people can´t?
Cause that would explain why i can hear it and you can´t (If my ears allow that frequencies, which i haven´t really tried).


Like I asked earlier, have you made sure the rest of your audio setup is ok?
Title: Resampling - Rounding Errors and Bit Depth.
Post by: zerowalker on 2013-05-23 08:12:56
It makes no sense for me that you can´t hear it;S
Is it at those frequencies that young people can hear, and older people can´t?
Cause that would explain why i can hear it and you can´t (If my ears allow that frequencies, which i haven´t really tried).


Like I asked earlier, have you made sure the rest of your audio setup is ok?


It should be ok. I don´t see anything wrong which should cause problems.
And it should if so, be obvious in other sounds as well, but it´s only in these "test" sound.

Is there a way to produce noise?
If so, i can gladly try to reproduce the noise i hear to see if you can hear it.


EDIT:

http://www.sendspace.com/file/gv4w78 (http://www.sendspace.com/file/gv4w78)

Listen to this test.
For me, there is No Noise at all.

But if i change it to 16bit in Audition i get noise.
I get more noise with Dithering on then off.
And i mean Audible noise.

This does however not demostrate the noise i hear in earlier samples, but i need to know if you can hear it.
Title: Resampling - Rounding Errors and Bit Depth.
Post by: bennetng on 2013-05-23 10:47:28
I think zerowalker's system should be fine. 13579.wav is in -12dBFS and test signal.wav is in -18dBFS, that means 13-14 bits resolution in 16-bit. Also note that 13579.wav needs a resampler to playback directly as well, when the file ends there will be a fade out which can reveal the noise more easily.

zerowalker also listened to udial at -20dB replaygain preamp in foobar, that should eliminate any possible clipping and his test results in 13579.wav and 54321.wav also indicated that there is no audible aliasing.

At least zerowalker cannot pass Ethan's test. That's the most important point because no one knows the answer, except Ethan himself. In the past I also created similar tests in other forums as well:
http://www.hydrogenaudio.org/forums/index....st&p=440943 (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=49288&view=findpost&p=440943)