Skip to main content

Topic: 3999hz Sine at 8khz SR (Read 16771 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • xnor
  • [*][*][*][*][*]
  • Developer
3999hz Sine at 8khz SR
Reply #25
Well, yeah if you already know the answer you'll understand "distortion" as "aliasing".

Regarding the output: using bandpass' commands but with 3999 Hz (instead of 3990 Hz) the tone will be attenuated by roughly 54 dB, the image by about 108 dB. (With very high quality you get higher attenuation.)
Using 3990 Hz you'll see negligible attenuation.
  • Last Edit: 31 August, 2013, 03:44:21 PM by xnor
"I hear it when I see it."

  • phofman
  • [*][*][*][*]
3999hz Sine at 8khz SR
Reply #26
The spectrograms generated by sox look and sound similar for dither and no-dither versions:

sox -V -r 8000 -n  -r 8000 -b16 -c1 test4k-dither.wav synth 5 sine 3999

[ Specified attachment is not available ]

sox -V -r 8000 -n -D -r 8000 -b16 -c1 test4k-nodither.wav synth 5 sine 3999

[ Specified attachment is not available ]

  • bandpass
  • [*][*][*][*]
3999hz Sine at 8khz SR
Reply #27
Regarding the output: using bandpass' commands but with 3999 Hz (instead of 3990 Hz) the tone will be attenuated by roughly 54 dB, the image by about 108 dB. (With very high quality you get higher attenuation.)
Using 3990 Hz you'll see negligible attenuation.

With 3990, it's about 6dB atten (i.e a little more than for the 3dB point at 99.7%: 3988Hz.  I'd level-matched for the graph though). But different versions of SoX have slightly different roll-off curves, so don't expect consistency of level in the transition band.

For minimal distortion and roll-off with 3999Hz @8k (or even, according to its documentation, 3999.9999...), have a look at the "Brick resampler". I don't believe filters this steep have any practical use though. For audio, the tightest spec I've come across is 15kHz bandwidth with 32kHz sample rate, i.e. 0dB point at 93.75%.

  • C.R.Helmrich
  • [*][*][*][*][*]
  • Developer
3999hz Sine at 8khz SR
Reply #28
Thanks, ktf and xnor, now I get it. I was thinking only about resampling for file storage (i.e. 8 to 48-ish kHz), not about D/A conversion (which, as I failed to realize, ideally represents resampling to an infinitely large sampling rate). So yes, both any D/A converter as well as Audition's interpolative waveform display use time-limited interpolation filters for reasons mentioned earlier.

What I find curious is that I see the beating in Adobe Audition where I had assumed it could display what the waveform would look like with perfect reconstruction.  Clearly I don't understand how the program is going about connecting the dots.

That beating is just because its using linear or at most polynomial to generate the display. Its too slow to use high quality interpolation for display so almost nothing does.

I think - and recall reading this somewhere - that Audition is doing better than that, meaning it uses a time-windowed sinc filter. Here's what a Dirac (single-sample) impulse looks like in Audition 1.x:

[ Specified attachment is not available ]

Edit: zooming in vertically reveals that this smooth interpolation curve extends to the entire time-range visible in that screenshot.

Chris
  • Last Edit: 31 August, 2013, 04:39:33 PM by C.R.Helmrich
If I don't reply to your reply, it means I agree with you.

  • Banned
  • [*]
3999hz Sine at 8khz SR
Reply #29
Aliasing is nonlinear distortion so I don't see what's confusing about saying distortion is likely when resampling tones very close to Nyquist.

Aliasing is linear.

  • xnor
  • [*][*][*][*][*]
  • Developer
3999hz Sine at 8khz SR
Reply #30
Aliasing is linear.

No, it's not.

sin(2*pi*f*t) turns into sin(2*pi*f*t)+sin(2*pi*(f+2)*t) for the 3999 Hz example above.

Still, I'd just call it by what it is: aliasing.
  • Last Edit: 31 August, 2013, 05:22:19 PM by xnor
"I hear it when I see it."

  • greynol
  • [*][*][*][*][*]
  • Global Moderator
3999hz Sine at 8khz SR
Reply #31
I think - and recall reading this somewhere - that Audition is doing better than that, meaning it uses a time-windowed sinc filter.

I think there may have been some confusion between Audition and Audacity. Audacity just connects the dots with straight lines. Audition does far better.

I'm going to walk back what I said earlier. When I looked at the waveform in Audition, I had created the tone in Audition. The visual beating may be due to this and not some problem with the way the program renders the waveform. For all I know a waveform created or resampled with sox or some other capable software will display perfectly in Audition and maybe Audacity too, despite its gross rendering.
  • Last Edit: 31 August, 2013, 10:32:18 PM by greynol
13 February 2016: The world was blessed with the passing of a truly vile and wretched person.

Your eyes cannot hear.

  • xnor
  • [*][*][*][*][*]
  • Developer
3999hz Sine at 8khz SR
Reply #32
I think there may have been some confusion between Audition and Audacity. Audacity just connects the dots with straight lines. Audition does far better.

I'm going to walk back what I said earlier. When I looked at the waveform in Audition, I had created the tone in Audition. The visual beating may be due to this and not some problem with the way the program renders the waveform. For all I know a waveform created or resampled with sox or some other capable software will display perfectly in Audition and maybe Audacity too, despite its gross rendering.

Audition, like Chris wrote, uses windowed sinc filters. As I explained, these have to be trimmed for speed instead of performance.
If Chris had zoomed in in his screenshot we could see that the filter stops abruptly after about 20 taps on each side of the impulse - that's rather short.

As for visual beating: smooth visualization is identical to resampling to a (much) higher sampling rate.
#14

What you see is the result of aliasing. What you hear is the result of aliasing. I don't know how to put it any clearer.
  • Last Edit: 31 August, 2013, 10:40:29 PM by xnor
"I hear it when I see it."

3999hz Sine at 8khz SR
Reply #33
Audition's interpolation depends on your zoom ratio. When you are zoomed out, a digital waveform is displayed. When you are zoomed in, a bandlimited interpolation is used, where the order is up to 40 and depends on your zoom ratio. It means that the transition band (–1 dB to –60 dB) occupies approx. 10% of the sampling rate. So, if your sampling rate is 8 kHz, do not expect beat-free drawing of anything above ~3700 Hz.

A typical transition band of DACs is 5% of the sampling rate, so they do better than Audition's waveform drawing engine.

With software SRCs, like SoX or iZotope SRC, you can narrow the transition band as much as you like.

  • greynol
  • [*][*][*][*][*]
  • Global Moderator
3999hz Sine at 8khz SR
Reply #34
Thanks everyone.  Sorry for not getting it the first time around.
13 February 2016: The world was blessed with the passing of a truly vile and wretched person.

Your eyes cannot hear.

  • stv014
  • [*]
3999hz Sine at 8khz SR
Reply #35
I think - and recall reading this somewhere - that Audition is doing better than that, meaning it uses a time-windowed sinc filter. Here's what a Dirac (single-sample) impulse looks like in Audition 1.x:


Actually, it is already displayed with a ~40 tap sinc filter in Cool Edit 96 (released in 1996), which is what eventually became Adobe Audition.
  • Last Edit: 01 September, 2013, 04:16:36 AM by stv014

  • stv014
  • [*]
3999hz Sine at 8khz SR
Reply #36
Using the resampler from here with the "-r 44100 -fl -10000000 -f 4" parameters, a 60 seconds long sample of 3999 Hz sine wave (8000 Hz sample rate, 2 channels, 32-bit PCM format) is converted in about 0.4 s on a Core i3 2120 CPU, and the spectrum looks like this: image.

Although in practice it does not make much sense to use such a steep filter, and when upsampling from 8000 Hz, it even produces audible ringing at 4 kHz.
  • Last Edit: 01 September, 2013, 04:41:56 AM by stv014

3999hz Sine at 8khz SR
Reply #37
What setup do I need to hear this played back as a pure 3.999khz tone?


You won't. I've been making this argument for 15 years. Nyquist was right that you will record the frequency but he didn't say anything about the amplitude. You will get interference patterns like this close to f/2. This is one reason why the 16/44 standard wasn't well conceived - it's a borderline standard. 18bit/100kHz would have been ideal. Oh well, we have 24/96 now so problem solved.

  • saratoga
  • [*][*][*][*][*]
3999hz Sine at 8khz SR
Reply #38
This is one reason why the 16/44 standard wasn't well conceived - it's a borderline standard. 18bit/100kHz would have been ideal. Oh well, we have 24/96 now so problem solved.


Thats ridiculous.  A typical modern system is good to about .96 of Nyquist.  That will get you easily to 21 kHz, which is more than adequate.  Going higher serves no purpose.

Edit:  You should probably read this thread, several people already explained why your reasoning here is wrong.
  • Last Edit: 02 January, 2015, 09:50:49 PM by saratoga

  • xnor
  • [*][*][*][*][*]
  • Developer
3999hz Sine at 8khz SR
Reply #39
Nyquist was right that you will record the frequency but he didn't say anything about the amplitude. You will get interference patterns like this close to f/2.


After 15 years, don't you think its about time that you finally educated yourself on the sampling theorem and stop spreading nonsense? 
"I hear it when I see it."

  • splice
  • [*][*][*]
3999hz Sine at 8khz SR
Reply #40
Nyquist was right that you will record the frequency but he didn't say anything about the amplitude. You will get interference patterns like this close to f/2.


After 15 years, don't you think its about time that you finally educated yourself on the sampling theorem and stop spreading nonsense? 


I'm doing this very thing right now for someone over on the Head-Fi forum in the Sound Science section.
Regards,
   Don Hills

3999hz Sine at 8khz SR
Reply #41
Aliasing is nonlinear distortion so I don't see what's confusing about saying distortion is likely when resampling tones very close to Nyquist.

I'm sorry if I'm annoying but this:
Because its being resampled to 48k, and there is generally massive distortion of anything with 1% of the Nyquist limit with even very high quality resamplers.  Theres a reason 44.1khz audio is 4.1khz above the highest frequency humans are expected to hear.

doesn't sound like you're talking about aliasing.


I see some conflation possibly leading some to confusion.

When the problem is stated as "Within 1% of Nyquist" there are actually two very different conditions. One is 1% above Nyquist, and the other is 1% below Nyquist. 1% below Nyquist cannot generate any aliasing, and 1% above Nyquist is supposed to produce a practically null output with any well-designed digital gear or software. 

Since signals 1% above Nyquist are not legitimate signals there seems to be no need for much discussion of them.  The real world comes to our assistance here, as the intensity of the musical audio spectrum is generally decreasing with increasing frequency and by 15 KHz it is generally very small.

Because the low pass filters commonly used in audio today have pretty steep cut-offs things get interesting if you test with tone bursts at a fairly high repetition rate with carrier frequencies just below Nyquist. This becomes a problem related to Amplitude Modulation. The upper sideband gets chopped off or vastly attenuated and the transient response gets strange. Again the real world comes to our assistance for the reason stated in the previous paragraph.

Resampling software is subject to more variation in performance, and one area of performance is the width of the transition band. Like so  many other things it can be optimized and optimal may not be the narrowest transition band that we can produce. Hardware tends to represent a larger investment, is more inflexible and tends to be more conservatively designed.  I've looked at the transition band for some real world DACs and 3-5 KHz are not unusual.

I don't know of any exhaustive subjective studies that might lead to optimal choices of transition band width.