Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Representing frequency of n Hz needs sampling rate >2n Hz, not =2n (Read 30356 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

Representing frequency of n Hz needs sampling rate >2n Hz, not =2n

Reply #25
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?

Representing frequency of n Hz needs sampling rate >2n Hz, not =2n

Reply #26
Regarding what happens at the edges, sinc pulses die out fairly rapidly, don't they; especially when realistic levels are taken into account?

Representing frequency of n Hz needs sampling rate >2n Hz, not =2n

Reply #27
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

Representing frequency of n Hz needs sampling rate >2n Hz, not =2n

Reply #28
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

Representing frequency of n Hz needs sampling rate >2n Hz, not =2n

Reply #29
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."

Representing frequency of n Hz needs sampling rate >2n Hz, not =2n

Reply #30
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.


 

Representing frequency of n Hz needs sampling rate >2n Hz, not =2n

Reply #32
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

Representing frequency of n Hz needs sampling rate >2n Hz, not =2n

Reply #33
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...

Representing frequency of n Hz needs sampling rate >2n Hz, not =2n

Reply #34
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.


Representing frequency of n Hz needs sampling rate >2n Hz, not =2n

Reply #35
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?
Is troll-adiposity coming from feederism?
With 24bit music you can listen to silence much louder!

Representing frequency of n Hz needs sampling rate >2n Hz, not =2n

Reply #36
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  ;>


Representing frequency of n Hz needs sampling rate >2n Hz, not =2n

Reply #38
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.
Is troll-adiposity coming from feederism?
With 24bit music you can listen to silence much louder!

Representing frequency of n Hz needs sampling rate >2n Hz, not =2n

Reply #39
"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.

Representing frequency of n Hz needs sampling rate >2n Hz, not =2n

Reply #40
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.

Representing frequency of n Hz needs sampling rate >2n Hz, not =2n

Reply #41
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

Link to pictures in the uploads forum

Representing frequency of n Hz needs sampling rate >2n Hz, not =2n

Reply #42
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."

Representing frequency of n Hz needs sampling rate >2n Hz, not =2n

Reply #43
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 

Representing frequency of n Hz needs sampling rate >2n Hz, not =2n

Reply #44
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?

Representing frequency of n Hz needs sampling rate >2n Hz, not =2n

Reply #45
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

Representing frequency of n Hz needs sampling rate >2n Hz, not =2n

Reply #46
We could pull a ten year old off the street.


I see what you did there. Or just another Freudian slip?
Regards,
   Don Hills
"People hear what they see." - Doris Day

Representing frequency of n Hz needs sampling rate >2n Hz, not =2n

Reply #47
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.

Representing frequency of n Hz needs sampling rate >2n Hz, not =2n

Reply #48
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."

Representing frequency of n Hz needs sampling rate >2n Hz, not =2n

Reply #49
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)