Hydrogenaudio Forums

Hydrogenaudio Forum => Uploads => Topic started by: hornpipe2 on 2013-08-30 21:04:16

Title: 3999hz Sine at 8khz SR
Post by: hornpipe2 on 2013-08-30 21:04:16
Here is a 5 second tone produced by:

* Start Audacity
* Set Project Rate to 8000hz
* Generate -> Tone
- 3999hz
- 1.0 peak amplitude
- 5 sec duration
* Export as 16-bit 8khz WAV.

Shannon-Nyquist says: my 8khz wave file should perfectly capture my 3.999khz sine wave, because 3.999khz < (8khz / 2).

Now my question: Why, oh why, does Audacity, foobar2000, WMP et al play this back with beats?  There is a .5sec periodic amplitude osc going on.

What setup do I need to hear this played back as a pure 3.999khz tone?
Title: 3999hz Sine at 8khz SR
Post by: saratoga on 2013-08-30 21:08:49
Now my question: Why, oh why, does Audacity, foobar2000, WMP et al play this back with beats?  There is a .5sec periodic amplitude osc going on.


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.
Title: 3999hz Sine at 8khz SR
Post by: hornpipe2 on 2013-08-30 21:53:47
Ok... REALLY not understanding.

If the second video on xiph.org has taught me anything, it's that this is not the waveform:
[attachment=7608:a.png]

but that THIS is the waveform:
[attachment=7609:b.png]

It's repeated over and over: a signal under the Nyquist frequency should be perfectly reproduced.

So I suppose this is being resampled from 8khz to 48khz for playback (or 44.1 or whatever my laptop is running).  Where does this conversion happen?
Player -> Windows Mixer -> Sound Card Driver -> Sound Card Hardware -> Headphones

Is it really just linear interpolating to come up with the 48khz sample, and if so, what happened to all the fancypants reconstruction that a DAC is supposed to do?
Title: 3999hz Sine at 8khz SR
Post by: greynol on 2013-08-30 22:11:56
Why not try a signal at -3dB?

Also, I hope you realize that Audacity draws straight lines between sample points, which is not how a DAC behaves.

fancypants?
Title: 3999hz Sine at 8khz SR
Post by: hornpipe2 on 2013-08-30 22:12:11
saratoga I don't think that's it.

Here is a 3950hz wave at 8khz sample rate, giving > 1% transition band so the resampler would hypothetically "have something to work with".

[attachment=7612:c.png]
It sounds just as bad as it looks.

EDIT: Greynol, just tried it, with amplitude 0.5 (-6 dB) instead of 1.0.  It sounds the same, but quieter.  So that's not it either : (
Title: 3999hz Sine at 8khz SR
Post by: Silversight on 2013-08-30 22:15:43
I don't know about the math here, but I can at least say these amplitude swings are not produced in the playback chain. They are already in the file. In fact, the frequency of these swings increases as the generated tone frequency decreases. As for the reason for this, I'm not into the science well enough to say.

edit: Ah, too slow...
Title: 3999hz Sine at 8khz SR
Post by: hornpipe2 on 2013-08-30 22:23:33
Yes Greynol, re: Audacity lines, I watched this earlier, which I assume most people have seen already.
https://www.xiph.org/video/vid2.shtml (https://www.xiph.org/video/vid2.shtml)

The chapter "stairsteps" showed me the error of my previous assumptions about how digital audio works, which is what drove me to try this myself.  I set up a simple test by generating an audible wave near the Nyquist frequency so it would "look" terrible in the editor.  Then I played it back so I could hear what's really going on and check that it really did reconstruct the wave properly.

I was quite surprised to hear the interference after every online article was telling me that's not how it really works.  I assume something is wrong with my setup, not with Nyquist... : )
Title: 3999hz Sine at 8khz SR
Post by: saratoga on 2013-08-30 23:59:38
I doubt that article claims that you can perfectly resample a signal without regard for your filters transition band.  The issue here is that practical systems are designed to work with some oversampling.  The better your software the less you will need. 

If you insist on 1% I suggest doing some research and pick the right software. That will be a very slow resampler.
Title: 3999hz Sine at 8khz SR
Post by: xnor on 2013-08-31 01:40:07
I have no idea what you guys are talking about.

When I generate a clean 3999 Hz tone sampled at 8000 Hz quantized to 16 bits with dither and play it back in foobar2000 using the SoX resampler plugin (95% passband, min phase, best quality, no aliasing) I can hear nothing.
When I use the same DSP to convert to 44.1 kHz, 32 bit and amplify the output all I hear is the dither of the initial 16 bit file.

No fast resampler will output the 3999 Hz sine tone. The low pass filter needs some room to work: 3999/8000*2 = 99.975%. The SoX plugin allows up to 99.0%. As such the sine will be attenuated massively.

But it's not impossible to reconstruct the 3999 Hz sine. You just need a very steep filter.
Title: 3999hz Sine at 8khz SR
Post by: hornpipe2 on 2013-08-31 04:33:29
I think this is all making sense to me now.  I generated a sweep from 3000hz to 4000hz over 10 seconds, then converted (by changing the Project Rate) to 44.1khz.  Audacity now plays back the sweep, but beginning from ~3700hz on up to 4000 the volume starts to drop off.  If I leave it set at 8khz Project Rate (which I think passes the buck on resampling from Audacity to Windows): it begins to generate a "beat" secondary tone at the same point, becoming more detuned and pronounced until it hits 4000, at which point it sounds like my wave is ramping in and out full volume every .5 seconds.

I'm about to throw out a bunch of mumbo jumbo to explain my current understanding.  Please correct me if I am wrong.

--

Nyquist theory states: you can get back your sinewave as long as it is at less than half the sample rate.
This is in the ideal sense, however.

Let's look again at my 3999hz waveform.  Sampled at 8khz, there is one and only function which could replicate the sample points we see: a 3999hz wave.  But this sample could ALSO be from a 4khz wave, ramping up and down in volume twice a second.  This would be an "alias" wave, yes?  There are an infinite number of waves that can hit these exact points, but they all lie outside the sample band of 0-3.99999999repeating khz, while there is only one True Solution within the band.

If you're going to recover the original waveform and not the aliases, you need a filter which stops dead at 4khz, so that when you pull the analog back out you then chop off everything but the band-limited frequency.

In practice, we don't have these luxuries.  Infinite filters would require infinite processing time or buffering or precision or whatever.

I think this does explain the artifacts I'm hearing:

Windows 7's sample rate conversion is (EDIT) BUGGED: it is doing linear interpolation, so I'm really hearing a beating triangle.  Sheesh.  Read more here: http://social.msdn.microsoft.com/Forums/wi...ion-slightly-ot (http://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/725546ce-57bf-40d0-b7aa-47e51de9c3ae/artifacts-on-windows-7-due-to-sample-rate-conversion-slightly-ot), or here for a patch: http://support.microsoft.com/kb/2653312 (http://support.microsoft.com/kb/2653312)

Audacity's SR conversion has an AA filter.  It isn't a perfect filter (meaning: pass everything up to 4khz, drop everything 4khz and above), but rather it kicks in gradually beginning from say 95% of Nyquist.  It hits -inf dB at 4khz.  The sweep demonstrates pretty clearly when I'm heading into the transition band.  If I really wanted to get my data back, I could configure the SRC filter to be much steeper and set the transition band to begin at 99.9999% instead.

--

Is there a common transition band specified by Red Book CD Audio or other standards to which DAC devices must / should adhere?
Title: 3999hz Sine at 8khz SR
Post by: ktf on 2013-08-31 09:01:12
There's a simpler explanation: Nyquist-Shannon states your sample has to infinitely long to get a perfect reconstruction too, and you need an infinitely long reconstruction filter.

As the stuff we want to resample generally isn't infinitely long and reconstruction aren't infinitely long (otherwise, you'll get a infinitely long filter delay, so never hear anything) you'll need to keep a little distance from the limit case of frequencies very close to 0.5Fs. Even SoX, regarded as a high-quality tool for this kind of manipulations, states in it's manual "note that band-width values greater than 99% are not recommended for normal use as they can cause excessive transient echo". SoX' default is 95%.
Title: 3999hz Sine at 8khz SR
Post by: bandpass on 2013-08-31 10:05:41
Is there a common transition band specified by Red Book CD Audio or other standards to which DAC devices must / should adhere?



Even SoX, regarded as a high-quality tool for this kind of manipulations, states in it's manual "note that band-width values greater than 99% are not recommended for normal use as they can cause excessive transient echo". SoX' default is 95%.

For better or for worse, SoX works to the 3dB point; so by default, you're 3dB down at 95%.  With SoX, the corresponding 0dB point is at 91.x% (can't remember the value of x off the top of my head). The upper limit of the audible band is 20kHz, which divided by the Redbook nyquist is 90.7%.  So the SoX default is a good fit for Redbook (of course, it was designed with this in mind).

Title: 3999hz Sine at 8khz SR
Post by: C.R.Helmrich on 2013-08-31 11:01:56
When I generate a clean 3999 Hz tone sampled at 8000 Hz quantized to 16 bits with dither and play it back in foobar2000 using the SoX resampler plugin (95% passband, min phase, best quality, no aliasing) I can hear nothing.

For better or for worse, SoX works to the 3dB point; so by default, you're 3dB down at 95%.  With SoX, the corresponding 0dB point is at 91.x% ...

Exactly, meaning that the SoX resampler will fully attenuate the entire mirror image above Nyquist (here 4 kHz). Most resamplers I know put their 3-dB point right on the Nyquist frequency, so you get some aliasing into your target base-band. Probably best to do it like SoX, i.e. fully attenuate near Nyquist: no tone at all, but no beating tone either.

Edit: Indeed, the beating is also present if you create a 23999- or 22049-Hz tone at 48 or 44.1 kHz sample rate, respectively, so it has nothing to do with upsampling. And the frequency of the tone is correct in both cases, I checked with Audition. So what's the explanation? Intermodulation distortion between tone and sampling frequency?

Chris
Title: 3999hz Sine at 8khz SR
Post by: xnor on 2013-08-31 14:24:26
A very pragmatic explanation:

When you sample a sine with just above 2 samples per cycle (2.0005 in the case of 3999 Hz sampled with 8 kHz) then the sample values will slowly "drift".
You start out at zero, the following samples will be close to zero, after some time you reach the maximum amplitude of the sine waves, then you're approaching zero again, and the cycle begins anew.
In the example above this cycle is 0.5s.

Now obviously if you have a short filter it will follow this cycle. Only if the filter is long enough (steep enough) it will include samples from the previous/next cycle even when you're in the middle of such a close-to-zero valley.
Another option is a short filter that reaches its stopband at 4 kHz (attenuates a lot including the 3999 Hz tone).

Low quality resampling won't do either. It will usually use a really short filter and one that doesn't attenuate properly as well.


A more correct explanation:
There will be an aliased sine at 4001 Hz at a not much lower level than the 3999 Hz one. Try generating and mixing a 3999 and 4001 Hz tone in a 44.1 kHz file.
Destructive interference will cause the valleys and effectively the beating.
Title: 3999hz Sine at 8khz SR
Post by: ktf on 2013-08-31 15:54:02
Edit: Indeed, the beating is also present if you create a 23999- or 22049-Hz tone at 48 or 44.1 kHz sample rate, respectively, so it has nothing to do with upsampling. And the frequency of the tone is correct in both cases, I checked with Audition. So what's the explanation? Intermodulation distortion between tone and sampling frequency?

Most DACs do upsample, and if they don't they'll need a reconstruction filter. In both cases, the filtering can't be IIR because of the delay, a DAC should have as little delay as possible. So in both cases, the filter can't be 'steep' enough to prevent aliasing.

edit: I've been confusing non-causal filters with IIR filters. Anyway, think of it like this: If you have a sample-and-hold DAC with a nth-order lowpass filter behind that, you get the same problems: the filter isn't steep enough, it will either alias or attentuate the sine. Some sort of filter is necessary with both sampling as well as reconstructing.
Title: 3999hz Sine at 8khz SR
Post by: xnor on 2013-08-31 16:27:28
Edit: Indeed, the beating is also present if you create a 23999- or 22049-Hz tone at 48 or 44.1 kHz sample rate, respectively, so it has nothing to do with upsampling. And the frequency of the tone is correct in both cases, I checked with Audition. So what's the explanation? Intermodulation distortion between tone and sampling frequency?


Well the 4001 Hz sine is added due to a not very great reconstruction filter.

But yeah, in the end it's just a linear addition of two sine waves. The pulsing has to be there by definition. There's no distortion, nothing non-linear.
plot sin(2*pi*f*t)+sin(2*pi*(f+1)*t) where f = 100 from t=0 to 1 (http://www.wolframalpha.com/input/?i=plot+sin%282*pi*f*t%29%2Bsin%282*pi*%28f%2B1%29*t%29+where+f+%3D+100+from+t%3D0+to+1)
Title: 3999hz Sine at 8khz SR
Post by: saratoga on 2013-08-31 17:56:36
Its nonlinear because you put in one tone and got two out. The superposition is linear though.

Since modern audio DACs upsample to a few MHz for playback, its hard to say what will happen to something very close to Nyquist. For scientific applications its common to have non oversampled DACs without a reconstruction filter. In this case you can in fact generate tones extremely close to Nyquist, but they will have out of band harmonics due to the lack of a filter.
Title: 3999hz Sine at 8khz SR
Post by: xnor on 2013-08-31 18:38:32
Sure but once you have the two tones (which you get directly as a result of upsampling, before interpolation, i.e. low pass filtering) the resulting waveform is the linear addition of those tones.

I find statements like "massive distortion within 1% of nyquist" questionable and potentially highly confusing to those not into signal processing.

With distortion I assume you mean non-linear distortion. (If you included linear distortion it'd get even more confusing.)
So I see two cases:
a) If the reconstruction filter reaches its stopband at or before Nyquist there won't be any added (aliased) tones. If additionally the filter is linear phase (which it usually is) there won't be any non-linear distortion.

b) If the filter reaches its stopband somewhere above Nyquist you'll see aliased tones. Again, a linear phase filter will not cause non-linear distortion. The pulsing is not the result of the filter distorting the signal, but not suppressing aliased tones of the upsampled signal.

This is common in most A/D/A converters since these usually use short, "fast" filters that allow such aliasing. It's just not an audible problem since the stuff is usually above 20 kHz. Here it is clearly in the audible range, so plainly audible.
Title: 3999hz Sine at 8khz SR
Post by: greynol on 2013-08-31 18:51:14
...so long as the rest of the process up to the sound waves reaching the listener's ear is linear, or are you suggesting that a 23kHz tone and a 25kHz tone with a 48kHz sample rate cannot create a 2kHz tone?

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.
Title: 3999hz Sine at 8khz SR
Post by: xnor on 2013-08-31 19:18:31
...so long as the rest of the process up to the sound waves reaching the listener's ear is linear, or are you suggesting that a 23kHz tone and a 25kHz tone with a 48kHz sample rate cannot create a 2kHz tone?

I'm talking about the resampling process. Sure, downstream electronics or transducers or even our ear can and will add intermodulation, harmonic .. distortion.

(Remember: even when the 8 kHz signal is resampled to <insert high sample rate here> it will show the beating due to aliasing and also sound that way primarily due to aliasing, not intermodulation.)

Quote
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.

The filters used for display are short ones for obvious reasons. Short means slow roll-off but it cannot start rolling off at 10 kHz (for a 44.1 kHz sample rate) because then high frequencies below Nyquist would be attenuated... so I guess it cannot suppress aliasing. In the 44.1 kHz case the stopband may not be reached before, let's say, 24 kHz. In that case you'd see visual beating starting slowly with tones above 20 kHz - getting worse with higher frequency, of course, since the aliasing will get stronger and stronger.

(Audition does still a lot better than other audio editors that "connect the dots".)
Title: 3999hz Sine at 8khz SR
Post by: bandpass on 2013-08-31 19:21:14
Here are some pics which may help.

Generate a tone at close to nyquist:

Code: [Select]
sox -r 8000 -n 1.wav synth 8 sine 3990 gain -1


Which looks, at some points in time, like this (i.e. apparent beating):
(http://i44.tinypic.com/j5uru0.png)

Resample to 44100 (with max bandwidth allowed by command-line sox):

Code: [Select]
sox 1.wav 2.wav rate -b 99.7 44100


Also, generate the tone directly at 44100 sample rate:

Code: [Select]
sox -r 44100 -n 3.wav synth 8 sine 3990 gain -1


Make a two channel file from these last two files, and equalise the levels (to account for the resampling roll-off close to nyquist):
Code: [Select]
sox -M 2.wav 3.wav 4.wav gain -e


And load the result into audacity (or whatever) for analysis:
(http://i39.tinypic.com/246nss7.png)

There's no difference between the resampled and the directly generated tone. So no aliasing or beating, just a little roll-off.
Title: 3999hz Sine at 8khz SR
Post by: saratoga on 2013-08-31 19:33:28
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.
Title: 3999hz Sine at 8khz SR
Post by: saratoga on 2013-08-31 19:37:03
Aliasing is nonlinear distortion so I don't see what's confusing about saying distortion is likely when resampling tones very close to Nyquist.
Title: 3999hz Sine at 8khz SR
Post by: xnor on 2013-08-31 20:15:03
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.

SoX, for example, is a high quality resampler and does not cause "massive distortion" while processing audio in realtime (somewhere you said such a resampler is going to be very slow).

Also, I find the 4.1 kHz number confusing as well - to laypeople it will sound like humans can hear up to 40 kHz.
I understand what you meant, but I'd say:
44.1 kHz allows sampling a signal up to just below 22.05 kHz, which is 2.05 kHz above the generally accepted limit of human hearing.
Title: 3999hz Sine at 8khz SR
Post by: saratoga on 2013-08-31 20:20:01
What is the fft of Sox's output? I suspect that depending on your settings it either completely attenuates the tone or introduces considerable aliasing. Perhaps zeroing the output is not technically distortion but I think in the colloquial sense I was using its close enough.
Title: 3999hz Sine at 8khz SR
Post by: xnor on 2013-08-31 20:36:43
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.
Title: 3999hz Sine at 8khz SR
Post by: phofman on 2013-08-31 20:41:03
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

[attachment=7613:spectrum-dither.png]

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

[attachment=7614:spectrum-nodither.png]
Title: 3999hz Sine at 8khz SR
Post by: bandpass on 2013-08-31 21:24:32
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%.
Title: 3999hz Sine at 8khz SR
Post by: C.R.Helmrich on 2013-08-31 21:32:34
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:

[attachment=7615:dirac_audition.png]

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

Chris
Title: 3999hz Sine at 8khz SR
Post by: Banned on 2013-08-31 22:15:33
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 (https://en.wikipedia.org/wiki/Linearity).
Title: 3999hz Sine at 8khz SR
Post by: xnor on 2013-08-31 22:20:56
Aliasing is linear (https://en.wikipedia.org/wiki/Linearity).

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.
Title: 3999hz Sine at 8khz SR
Post by: greynol on 2013-09-01 03:00:33
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.
Title: 3999hz Sine at 8khz SR
Post by: xnor on 2013-09-01 03:38:01
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 (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=102468&view=findpost&p=843496), 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 (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=102468&view=findpost&p=843466)

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.
Title: 3999hz Sine at 8khz SR
Post by: Alexey Lukin on 2013-09-01 03:53:25
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.
Title: 3999hz Sine at 8khz SR
Post by: greynol on 2013-09-01 06:33:30
Thanks everyone.  Sorry for not getting it the first time around.
Title: 3999hz Sine at 8khz SR
Post by: stv014 on 2013-09-01 09:14:50
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.
Title: 3999hz Sine at 8khz SR
Post by: stv014 on 2013-09-01 09:34:40
Using the resampler from here (http://www.hydrogenaudio.org/forums/index.php?showtopic=100099&view=findpost&p=829489) 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 (http://i44.tinypic.com/1z5jlma.jpg).

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.
Title: 3999hz Sine at 8khz SR
Post by: graham_mitchell on 2015-01-03 02:36:59
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.
Title: 3999hz Sine at 8khz SR
Post by: saratoga on 2015-01-03 02:42:54
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.
Title: 3999hz Sine at 8khz SR
Post by: xnor on 2015-01-03 13:12:37
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? 
Title: 3999hz Sine at 8khz SR
Post by: splice on 2015-01-04 00:33:19
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.
Title: 3999hz Sine at 8khz SR
Post by: Arnold B. Krueger on 2015-01-04 14:20:21
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.


SimplePortal 1.0.0 RC1 © 2008-2018