You are here

Question relating to Nyquist frequency

Customising, building or repairing your own gear? Need help with acoustic treatment or soundproofing? Ask away…

Re: Question relating to Nyquist frequency

Postby dwebb » Sat Feb 02, 2019 10:20 pm

I think I understand - the idea is that if the sampling rate is more than twice the frequency you can reconstruct the wave - at least from a mathematical perspective.

On the practical level, a DAC can only output output fixed voltages at the chosen sample frequency. In this situation I would (I think) need need to have an output sample rate at significantly more than double the frequency of the wave to I was trying to output. I would guesstimate around 6+ samples per cycle would give something that would look close to the sine wave I was trying to reproduce.

If so, is there a rule of thumb (or something more scientific) that states the required output sample rate to recreate a close enough approximation of a desired sine wave frequency?
dwebb
Regular
Posts: 55
Joined: Wed Aug 26, 2009 12:00 am

Re: Question relating to Nyquist frequency

Postby Hugh Robjohns » Sat Feb 02, 2019 10:23 pm

Again, you are overlooking the critical role of the reconstruction filtering....

And somewhere around 2.2x the highest wanted frequency is usually enough.

H
User avatar
Hugh Robjohns
Moderator
Posts: 28332
Joined: Fri Jul 25, 2003 12:00 am
Location: Worcestershire, UK
Technical Editor, Sound On Sound

Re: Question relating to Nyquist frequency

Postby Sam Spoons » Sat Feb 02, 2019 10:35 pm

This might help https://www.soundonsound.com/techniques/digital-problems-practical-solutions but, in a nutshell, 44.1kHz sampling frequency is sufficient to render a perfect reproduction of a 20Hz - 20kHz audio signal.

edit :- and this https://www.soundonsound.com/sound-advice/q-should-i-use-high-sample-rates
User avatar
Sam Spoons
Jedi Poster
Posts: 13367
Joined: Thu Jan 23, 2003 1:00 am
Location: Manchester UK
Finally taking this recording lark seriously (and recording my Gypsy Jazz CD)........

Re: Question relating to Nyquist frequency

Postby Eddy Deegan » Sat Feb 02, 2019 10:37 pm

This might be relevant (and was also written by Hugh) - https://www.soundonsound.com/techniques ... -solutions

I understand some of the words in that article ;)

Edit: Sam beat me to it!
User avatar
Eddy Deegan
Moderator
Posts: 4725
Joined: Wed Sep 01, 2004 12:00 am
Location: Brighton & Hove, UK
Some of my works
The 2nd SOS Forum Album project
 

Re: Question relating to Nyquist frequency

Postby Sam Spoons » Sat Feb 02, 2019 10:40 pm

Great minds Mr D :thumbup:
User avatar
Sam Spoons
Jedi Poster
Posts: 13367
Joined: Thu Jan 23, 2003 1:00 am
Location: Manchester UK
Finally taking this recording lark seriously (and recording my Gypsy Jazz CD)........

Re: Question relating to Nyquist frequency

Postby ef37a » Wed Feb 06, 2019 10:22 am

Ah now! A sort of passing comment in my new ampliers book by D.Self (you might see a few of these extracts!) he states that the ringing seen on square waves in amplifier reviews are NOT as often stated, a shortcoming of the PA design but more, as Hugh has pointed out, inevitable when square waves are so used.

Not put that quite correctly but will find the exact wording.

Dave.
ef37a
Jedi Poster
Posts: 12020
Joined: Mon May 29, 2006 12:00 am
Location: northampton uk

Re: Question relating to Nyquist frequency

Postby Hugh Robjohns » Wed Feb 06, 2019 10:48 am

ef37a wrote:...the ringing seen on square waves in amplifier reviews are NOT as often stated, a shortcoming of the PA design but more, as Hugh has pointed out, inevitable when square waves are so used.

The Fourier analysis of a square wave states that it is comprised of an infinite series of odd harmonics of its fundamental frequency, each with a slightly lower amplitude than the previous one in a specific ratio:

Image

So... if you pass that perfect square wave through any kind of band-limited system, some of the highest harmonic elements will be removed and others strongly attenuated.

It is the removal of these harmonics that result in the square wave developing the apparent 'ringing' artefacts.

As an alternative viewpoint, consider the shape of the waveform as you build up a square wave from a series of harmonic sinewaves, starting with the fundamental, then the first, third, fifth, seventh harmonics and so on.... you'll see that with only a few harmonics present, the squarewave appears to have a lot of ripples (or ringing) on its flat sections, but as more and more harmonics are added the top and bottom of the squarewave become flatter and flatter (with less and less apparent ringing).

Image

Om other words, you need a system with an infinite bandwidth to represent a perfect square wave. Anything less will reproduce a squarewave with ripples (ringing), and the narrower the bandwidth the more pronounced those ripples will be.

And while true ringing after an impulse edge may indicate an unstable system, the presence of ripples on a square wave is more likely to indicate a band-limited system.

This article explains the maths and contains some instructive diagrams:

https://archive.cnx.org/contents/72f90f3a-f72c-4459-b439-1d27bf9d14d2@1/fourier-series-square-wave

H
User avatar
Hugh Robjohns
Moderator
Posts: 28332
Joined: Fri Jul 25, 2003 12:00 am
Location: Worcestershire, UK
Technical Editor, Sound On Sound

Re: Question relating to Nyquist frequency

Postby Peter Kriek » Sat Nov 09, 2019 7:51 am

Hey all,

What this means is that, yes, you can derive the frequency of a wave at more than twice the sampling rate. But NOT the shape of the wave. Everything (when using 44Khz) is a sine at 20Khz, it doesnt matter what it was originally. A pulse becomes a sine at 20Khz, a triangle also becomes a sine. In fact at 10Khz this effect is already really pronounced. So 44Khz and this whole way of sampling we're doing is flawed as hell!

So for more accurate reproduction the sample rate needs to go up and I'd think there needs to be a smarter instruction set that can deal with (almost) straight lines
and corners (to try and make true pulses and triangles).

To summarize, a wave has a frequency and a shape. At 44Khz, you can capture the frequency of a wave at 20Khz, but not the shape (everything becomes a sine). This means this 44Khz 16Bit format that we're using is substantially flawed. Its really far away from a 'perfect' reproduction.

p
Peter Kriek
Posts: 1
Joined: Sat Nov 09, 2019 7:28 am

Re: Question relating to Nyquist frequency

Postby Wonks » Sat Nov 09, 2019 11:47 pm

Peter Kriek wrote:Hey all,

What this means is that, yes, you can derive the frequency of a wave at more than twice the sampling rate. But NOT the shape of the wave. Everything (when using 44Khz) is a sine at 20Khz, it doesnt matter what it was originally. A pulse becomes a sine at 20Khz, a triangle also becomes a sine. In fact at 10Khz this effect is already really pronounced. So 44Khz and this whole way of sampling we're doing is flawed as hell!

So for more accurate reproduction the sample rate needs to go up and I'd think there needs to be a smarter instruction set that can deal with (almost) straight lines
and corners (to try and make true pulses and triangles).

To summarize, a wave has a frequency and a shape. At 44Khz, you can capture the frequency of a wave at 20Khz, but not the shape (everything becomes a sine). This means this 44Khz 16Bit format that we're using is substantially flawed. Its really far away from a 'perfect' reproduction.

p

It's fine for the reproduction of music. Don't forget the human ear is at best limited to a bit over 20kHz, and generally a lower frequency than that for any but the very young. So sampling at greater than 44kHz doesn't add anything to the frequencies we hear, as the physical limitations of the human ear will filter out any higher frequencies. Plus the audio reproduction systems we use - monitors and headphones - also have physical limits as to the frequencies they can reproduce, which is generally not a lot above 20kHz. OK, some ribbon tweeters used can rise as high as 40kHz, but in general, that will only add one or two more harmonics compared to a 20kHz tweeter, and in an infinite summing series, that's not a lot.

And a 20kHz triangle does not become a sine at 44kHz sampling. At 40kHz, yes, but not 44kHz. 40kHz is not the Nyquist frequency for 20kHz. Because the Nyquist sampling rate has to be greater than 2x the sampled note frequency, you aren't just sampling at peak and nadir (or always at the same two points on the waveform), but at different points along the waveform as time progresses, so a D/A converter can successfully reproduce the original waveform, given more than just a few samples.
User avatar
Wonks
Jedi Poster
Posts: 10889
Joined: Thu May 29, 2003 12:00 am
Location: Reading, UK
Correcting mistakes on the internet since 1853

Re: Question relating to Nyquist frequency

Postby Hugh Robjohns » Sun Nov 10, 2019 12:56 am

Peter Kriek wrote:... this whole way of sampling we're doing is flawed as hell!

Er... No! :lolno:

The only thing that's 'flawed as hell' is your understanding of the Nyquist sampling theory and its inherent requirement for use within a band-limited system.

By being band-limited, a signal close to half the sample rate can only be a sine wave -- by definition -- because only the fundamental is retained and it can no longer contain any harmonic components. Therefore the sampling system captures the entire band-limited signal -- both its frequency and shape -- perfectly accurately.

In suggesting that the 'shape' of a 20kHz (fundamental) signal -- be it triangular, square, pulse or whatever -- is important to the audible sound, you are implying that you can perceive harmonic content at 40kHz and far above.... And also that the microphones, analogue electronics and loudspeakers can all capture and reproduce those ultrasonic components accurately... Which is patently nonsense.
User avatar
Hugh Robjohns
Moderator
Posts: 28332
Joined: Fri Jul 25, 2003 12:00 am
Location: Worcestershire, UK
Technical Editor, Sound On Sound

Re: Question relating to Nyquist frequency

Postby Tim Gillett » Sun Nov 10, 2019 1:19 am

Peter Kriek wrote:
... this 44Khz 16Bit format that we're using is substantially flawed. Its really far away from a 'perfect' reproduction...

Yes, if you're a bat...
Tim Gillett
Frequent Poster (Level2)
Posts: 2212
Joined: Wed Jan 30, 2013 1:00 am
Location: Perth, Western Australia

Re: Question relating to Nyquist frequency

Postby Humble Bee » Sun Nov 10, 2019 10:40 pm

Or a dolphin...
User avatar
Humble Bee
Regular
Posts: 316
Joined: Mon Jan 08, 2007 1:00 am
Location: Sweden

Re: Question relating to Nyquist frequency

Postby Tim Gillett » Mon Nov 11, 2019 1:46 am

Nah, bats 200kHz, dolphins only 160 kHz.

Bats rule!
Tim Gillett
Frequent Poster (Level2)
Posts: 2212
Joined: Wed Jan 30, 2013 1:00 am
Location: Perth, Western Australia

Re: Question relating to Nyquist frequency

Postby Folderol » Mon Nov 11, 2019 9:30 am

Tim Gillett wrote:Nah, bats 200kHz, dolphins only 160 kHz.

Bats rule!
So they were were illegally receiving Droitwich in the days of the domestic radio license.
Who knew? :lol:
User avatar
Folderol
Jedi Poster
Posts: 11356
Joined: Sat Nov 15, 2008 1:00 am
Location: The Mudway Towns, UK
Yes. I am that Linux nut.
Onwards and... err... sideways!

Re: Question relating to Nyquist frequency

Postby Wonks » Mon Nov 11, 2019 9:35 am

Humble Bee wrote:Or a dolphin...

Maybe Bowie meant to write 'hear' instead of 'swim' in 'Heroes'.
User avatar
Wonks
Jedi Poster
Posts: 10889
Joined: Thu May 29, 2003 12:00 am
Location: Reading, UK
Correcting mistakes on the internet since 1853

PreviousNext