## Topic: Representing frequency of n Hz needs sampling rate >2n Hz, not =2n (Read 13254 times)previous topic - next topic

0 Members and 1 Guest are viewing this topic.
• pdq
Representing frequency of n Hz needs sampling rate >2n Hz, not =2n
##### Reply #25 – 22 February, 2012, 01:52:35 PM
I recall a study in which members of an orchestra were asked to compare two tones very close in frequency (I think it was A440).

Many of the members were able to distinguish tones only 1 Hz apart, and one member was able to distinguish tones only 0.1 Hz apart.

I then ask myself, did he need to hear the tones for a full ten seconds each so that there was one full cycle difference between them?

• greynol
• Global Moderator
Representing frequency of n Hz needs sampling rate >2n Hz, not =2n
##### Reply #26 – 22 February, 2012, 01:54:21 PM
Regarding what happens at the edges, sinc pulses die out fairly rapidly, don't they; especially when realistic levels are taken into account?
13 February 2016: The world was blessed with the passing of a truly vile and wretched person.

• Woodinville
Representing frequency of n Hz needs sampling rate >2n Hz, not =2n
##### Reply #27 – 22 February, 2012, 02:25:29 PM
Even a 8192 samples long filter doesn't cause anything I could hear. Maybe because the passband has to be a lower to make the filter audible, e.g. 18 kHz instead of 21 kHz? Anyway the filter is quite steep. -6 dB at 21 kHz and -90 dB at 21.0157 kHz.

You want to make the filter as steep as possible, not with as much rejection as possible. If I had access to matlab right now I'd give you firpm paramaters, but I tried what I recall in octave via remez and it just died instead.
-----
J. D. (jj) Johnston

• Woodinville
Representing frequency of n Hz needs sampling rate >2n Hz, not =2n
##### Reply #28 – 22 February, 2012, 02:27:18 PM
I recall a study in which members of an orchestra were asked to compare two tones very close in frequency (I think it was A440).

Many of the members were able to distinguish tones only 1 Hz apart, and one member was able to distinguish tones only 0.1 Hz apart.

I then ask myself, did he need to hear the tones for a full ten seconds each so that there was one full cycle difference between them?

Different problem than you're thinking of for frequency determination, you have here a fixed reference, and a high SNR environment to determine match or not.
-----
J. D. (jj) Johnston

• xnor
• Developer
Representing frequency of n Hz needs sampling rate >2n Hz, not =2n
##### Reply #29 – 22 February, 2012, 03:07:43 PM
You want to make the filter as steep as possible, not with as much rejection as possible. If I had access to matlab right now I'd give you firpm paramaters, but I tried what I recall in octave via remez and it just died instead.

It doesn't get much steeper than that with 8192 samples. I used a windowed sinc filter (Fc=21 kHz) and chose the best window function I could find to give about 90 dB rejection - not more - in my second try. Diffing the original file with the filtered one leaves some high frequency, low level ringing behind. Can't hear that either at normal levels.
"I hear it when I see it."

• bandpass
Representing frequency of n Hz needs sampling rate >2n Hz, not =2n
##### Reply #30 – 22 February, 2012, 04:57:10 PM
Regarding what happens at the edges, sinc pulses die out fairly rapidly, don't they; especially when realistic levels are taken into account?

Not really; it's because they they die out slowly that we need to window them to make reasonably-lengthed filters.

You want to make the filter as steep as possible, not with as much rejection as possible. If I had access to matlab right now I'd give you firpm paramaters, but I tried what I recall in octave via remez and it just died instead.

You can use sox to create some sharp FIRs (if you're happy to use a slightly longer filter than remez/firpm would give); e.g.

Code: [Select]
`sox castanets-2_2496.wav output.wav sinc -a 90 -n 32767 -21k`

For 90dB attenuation low-pass, 32767 taps, 6dB corner @ 21kHz; which gives a TBW of 16.6Hz.

• Porcus
Representing frequency of n Hz needs sampling rate >2n Hz, not =2n
##### Reply #31 – 22 February, 2012, 06:04:26 PM
A simple impulse will set them in motion, just like any other mechanical device.

That is not to say that this 'motion' can be used to detect a frequency.

• Woodinville
Representing frequency of n Hz needs sampling rate >2n Hz, not =2n
##### Reply #32 – 22 February, 2012, 11:00:04 PM
For 90dB attenuation low-pass, 32767 taps, 6dB corner @ 21kHz; which gives a TBW of 16.6Hz.

What I'm thinking of and trying to build is a remez-designed filter with a cutoff frequency of 20kHz and a -90dB point of about 20050 (not 22050!) Hz. I managed do that after some fiddling in Matlab. No such luck in octave.

I'm not saying that it's a good idea to use such a filter, to be sure.

It's also possible to make a "bad" filter by having too much passband ripple, but that's kind of cheating.
-----
J. D. (jj) Johnston

• icstm
Representing frequency of n Hz needs sampling rate >2n Hz, not =2n
##### Reply #33 – 23 February, 2012, 05:16:49 AM
You want to make the filter as steep as possible, not with as much rejection as possible. If I had access to matlab right now I'd give you firpm paramaters, but I tried what I recall in octave via remez and it just died instead.
That brings back memories, problem is I cannot remember any of it now. I would probably have to review my own code (I became quite good to commenting my code to read like pseudo code, which should hopefully help me now). Now all I need to do is dig out my old 10-yr old PC that should still have a copy of MatLab...

• bandpass
Representing frequency of n Hz needs sampling rate >2n Hz, not =2n
##### Reply #34 – 10 April, 2015, 11:07:23 AM
Well, something fun to try. Build the sharpest 20kHz passband filter you can with whatever FIR design program you have available.

Not one that goes 20kHz passband, 22kHz stop band, but as sharp as your software will design.

Then filter castinetts with it and see what happens. Use ABX, of course. Just give it a try.
...
What I'm thinking of and trying to build is a remez-designed filter with a cutoff frequency of 20kHz and a -90dB point of about 20050 (not 22050!) Hz.

I've been trying this with a remez design of Fp=20000, Fs=20001, and dp=ds=–90dB, which gives a filter around 5 seconds long.

Nothing bad happens AFAICT—I can't ABX it with castanets.

Dunn's pre/post echos can be heard by cranking up the volume, but they are a further 6dB below the nominal rejection level, so nothing untoward.

Samples & filter coefficients (@ 44100, 48k, & 96k) are here if anyone wants to play.

• Wombat
Representing frequency of n Hz needs sampling rate >2n Hz, not =2n
##### Reply #35 – 10 April, 2015, 11:50:03 AM
Nothing bad happens AFAICT—I can't ABX it with castanets.

Nice pics for illustrating the frequencies of ringing, better as this impulse crap we see elsewhere.
Since the strong ringing happens at 20kHz it should be not touched by the filter of the DAC playing it back.
If this isn't abxble what is?
With 24bit music you can listen to silence much louder!

• krabapple
Representing frequency of n Hz needs sampling rate >2n Hz, not =2n
##### Reply #36 – 10 April, 2015, 01:50:11 PM
Nothing bad happens AFAICT—I can't ABX it with castanets.

Nice pics for illustrating the frequencies of ringing, better as this impulse crap we see elsewhere.
Since the strong ringing happens at 20kHz it should be not touched by the filter of the DAC playing it back.
If this isn't abxble what is?

Well we don't absolutely know that 'this isn't abxable'.

False negatives, and all that  ;>

• greynol
• Global Moderator
Representing frequency of n Hz needs sampling rate >2n Hz, not =2n
##### Reply #37 – 10 April, 2015, 02:11:15 PM
We could pull a ten year old off the street.
13 February 2016: The world was blessed with the passing of a truly vile and wretched person.

• Wombat
Representing frequency of n Hz needs sampling rate >2n Hz, not =2n
##### Reply #38 – 10 April, 2015, 02:50:01 PM
I don't want to hijack this thread to much but this talk about ringing everywhere makes me wonder.
You can't argue much about it. To many audiophiles and people insist on this is what matters most with HiBitrate music.
Archimago lately did some about how software is handling dsd conversion.
dsd encoders
Unfortunately on his blog everyone can add his own view. You see jk_audio rates the dsd conversation to 24/96 on the amount of ringing as it was the most well understood thing in audio.
For a 96kHz samplerate this means no matter how the funny impulse picture looks like it only is slight noise at the filters edge.
To me this means if some low noise at frequencies way above our hearing damage sound it may be better to record nothing at all above 20kHz.
I feel a bit lost arguying about these things and slightly seem to get paranoid about 'RINGING' because i find nothing that convinces me at all.
With 24bit music you can listen to silence much louder!

• ExUser
Representing frequency of n Hz needs sampling rate >2n Hz, not =2n
##### Reply #39 – 10 April, 2015, 04:06:56 PM
"Ringing" is an arbitrary term we've assigned to a visually-perceived phenomenon. I believe that claims of ringing's audibility are strongly overstated. Perhaps some of the more savvy folks will clue me in here.

What "audiophiles and people" claim is irrelevant to what is actually true. My experience is that when "audiophiles" talk about a phenomenon that is visually-apparent but I struggle to even perceive audibly, the audiophiles are most likely out to lunch.

• greynol
• Global Moderator
Representing frequency of n Hz needs sampling rate >2n Hz, not =2n
##### Reply #40 – 10 April, 2015, 04:12:45 PM
Audibility depends on the frequency (wrt human thresholds) and the signal being filtered.  In the case of Meridian et. al, I'm not buying it.

One can argue that terms are arbitrarily chosen for all kinds of phenomena.  In the case of filters, I believe it is aptly chosen.
13 February 2016: The world was blessed with the passing of a truly vile and wretched person.

Representing frequency of n Hz needs sampling rate >2n Hz, not =2n
##### Reply #41 – 11 April, 2015, 08:42:23 AM
Put another way it is impossible to know with any certainty the amplitude of a pure tone with only two regularly spaced points per cycle.

Another way to look at it is that as the sampled frequency closely approaches the Nyquist frequency, the tone burst fidelity decreases considerably.

Here are some examples of the same downsampling from 2496 to 1644, but with vastly different width transition bands

• xnor
• Developer
Representing frequency of n Hz needs sampling rate >2n Hz, not =2n
##### Reply #42 – 11 April, 2015, 01:39:26 PM
There is actually very simple way to explain why this is:

Imagine a single sine wave cycle: it starts out at 0, rises to +1 (at 90°), drops to 0 again (180°), drops further to -1 (270°), rises to 0 again (360°).

If you take just 2 samples starting at 90° we get (+1, -1) and everything is fine, right? Well, what if we start a 0° or 180° ... we get (0, 0) which is digital silence, and not a tone.
"I hear it when I see it."

• krabapple
Representing frequency of n Hz needs sampling rate >2n Hz, not =2n
##### Reply #43 – 11 April, 2015, 09:18:23 PM
I don't want to hijack this thread to much but this talk about ringing everywhere makes me wonder.
You can't argue much about it. To many audiophiles and people insist on this is what matters most with HiBitrate music.
Archimago lately did some about how software is handling dsd conversion.
dsd encoders
Unfortunately on his blog everyone can add his own view. You see jk_audio rates the dsd conversation to 24/96 on the amount of ringing as it was the most well understood thing in audio.

you mean  jr_audio.

freudian slip there? ;>

All I'll say about that thread is, Archimago is being very polite.  I see Oohashi et al. and the 'hypersonic effect' have made their predictable entrance

• greynol
• Global Moderator
Representing frequency of n Hz needs sampling rate >2n Hz, not =2n
##### Reply #44 – 11 April, 2015, 10:30:50 PM
If you take just 2 samples starting at 90° we get (+1, -1)

What if I had sampled that sine wave at 30 and 210 and gave you the data.  How do you know how loud it was initially?
13 February 2016: The world was blessed with the passing of a truly vile and wretched person.

• Woodinville
Representing frequency of n Hz needs sampling rate >2n Hz, not =2n
##### Reply #45 – 12 April, 2015, 01:00:54 AM
Waaaiiittt.

When dealing with anything close to FS/2, you have to consider, carefully, what the bandwidth of the signal you're putting in actually is.

If it's one cycle of a sine wave, like you all keep talking about, that has an enormous bandwidth, not just a line at the frequency of the sine wave that was windowed.

It's all about the input bandwidth. If it's over fs/2 weird stuff happens. No more, no less.

Because of the requirement for filtering, the closer you get to fs/2, the more delay you must have in a filter. At fs/2 the delay goes to infinity.

It's that simple. Really.
-----
J. D. (jj) Johnston

• splice
Representing frequency of n Hz needs sampling rate >2n Hz, not =2n
##### Reply #46 – 12 April, 2015, 03:45:40 AM
We could pull a ten year old off the street.

I see what you did there. Or just another Freudian slip?
Regards,
Don Hills

Representing frequency of n Hz needs sampling rate >2n Hz, not =2n
##### Reply #47 – 12 April, 2015, 08:17:38 AM
If you take just 2 samples starting at 90° we get (+1, -1)

What if I had sampled that sine wave at 30 and 210 and gave you the data.  How do you know how loud it was initially?

As we all know that's the point. Given only two values for samples along a wave, and an infinite number of different wave frequencies, phase shifts, and amplitudes can fit them.

Given 3 points, or even just slightly more than 2 points, and those values define exactly one combination of frequency, phase, and amplitude.

The only wave form that can be accurately reproduced just below a brick wall filter's corner frequency is a pure sine wave.

Apply any signal you want to a good digital channel, but only modulated sine waves will be passed above half Nyquist.

As those sine waves frequencies approach Nyquist, smaller and smaller proportions of any modulation of the sine wave will be accurately reproduced.

• xnor
• Developer
Representing frequency of n Hz needs sampling rate >2n Hz, not =2n
##### Reply #48 – 12 April, 2015, 08:18:21 AM
What if I had sampled that sine wave at 30 and 210 and gave you the data.  How do you know how loud it was initially?

Exactly, you get this ambiguity with any amount of phase shift. Starting at 0° resulting in silence was the extreme example of that.

But you can use an alternating sequence of +1, -1. You could for example turn it into a FIR filter, a high pass, by attenuating it such that your gain is 0 dB at Fs/2. Here's a thought experiment: what happens if we approach an infinitely long sequence ...

If it's one cycle of a sine wave, like you all keep talking about, that has an enormous bandwidth, not just a line at the frequency of the sine wave that was windowed.

Yes, of course, but only if the amplitude was zero outside that range of the single cycle.

In the image I posted the sine continues with a dashed line in both directions, so interpret that 'single cycle' as just looking at a section of a pure tone of infinite duration.
"I hear it when I see it."

• [JAZ]
Representing frequency of n Hz needs sampling rate >2n Hz, not =2n
##### Reply #49 – 12 April, 2015, 10:05:29 AM
Yes, of course, but only if the amplitude was zero outside that range of the single cycle.

In the image I posted the sine continues with a dashed line in both directions, so interpret that 'single cycle' as just looking at a section of a pure tone of infinite duration.

This concrete discussion needs not take any longer. The theorem only guarantees signals >2Fs, not >=2Fs. Basically, if the sampled frequency is smaller than the sampling frequency, after some amount of time, all the possible points have been sampled.
If it is exactly 2F, this cannot happen, and only when knowing the phase (and this one not being 0 or 180degree), it might get reconstructed. (which is a special case that resamplers do not contemplate) . Actually, no, it cannot either, you need another assumption which is knowing the signal,and if you know the signal, you've "sampled" it in some other way. (Although, in fact, it can only be a sine, because any other signal would have been theoretically filtered away due to the Sampling frequency cutoff)