R/E/P Community

R/E/P => R/E/P Archives => Dan Lavry => Topic started by: jaydizzle on January 20, 2005, 06:19:57 PM

Title: My humble opinion on why DSP and high samplerates are a good mix
Post by: jaydizzle on January 20, 2005, 06:19:57 PM
I've seen a lot of talk about why all of you don't like samplerates higher than 96k.  Admitedly I deal almost solely with sound synthesis and DSP, and do not record very many sounds on microphones(for which high samplerates do make less sense due to physical limitations of the microphone).  Here is a test to prove my point.  You can use other software, but this is what I use.  Open an instance of Reaktor 4 (or any softsynth) in your sequencer, and open a spectral analyzer on the master channel.  In reaktor 4 I build a very simple sine wave generator.  First, set the project samplerate and Reaktors internal samplerate to 24khz. Triggering a note somewhere in the 75-100hz range yields a harmonic at that frequency with no overtones, as can be seen on the spec analyzer.  It sounds like a pure sinewave, but a little muddy.  Now up the samplerate to 48k and it does indeed sound a little cleaner, although the spec analyzer still shows nothing above the fundamental frequency.  Now change the samplerate to 96k, and yet again, it sounds cleaner without gaining any frequency response above the fundamental which is still far below the nyquist and the theoretical maximum.  Next, I change the reaktor internal samplerate to 192k, while leaving the project and soundcard rates at 96k.  Reaktor generates a sine wave at 192k and then resamples by adding every 2 samples together, and dividing by two.  The result is slightly more accurate, and even though we are still listening at 96k, it does sound a little cleaner.  Finally, change reaktors internal samplerate to 384khz, and do the same.  At this point, the difference is becomeing very slight, as we are approaching the point of diminishing returns.
Test 2:
Generate an oscillogram of a 10khz sine wave at 24, 48, 96 and 192khz samplerates, and examine them with your wave editor zoomed all the way in(showing individual samples in sample by sample steps).  At 24khz, each oscillation occurs over a time period of about 2 samples.  It is indistinguishable from a triangle or saw wave, and is essentially random noise.  At 48khz, each oscillation is about 5 samples long, but is still lacking definition, and is still not a very accurate mathematical depiction of a sine wave.  Next, 96khz is a significant improvement, and 192 is even more so.  This illustrates that higher samplerates improve not just frequency response but high end definition as well.  This is especially important when you do a lot of DSP and digital mixing, which will muddy up high freqs in a hurry at lower samplerates.  Individual sounds sound fine recorded at lower samplerates(like 48khz), and can still sound fine if mixed via analog equipment, but when you're mixing digitally, a lot of definition is gained in the 5-10khz range by using higher samplerates, even if you just resample sounds recorded at a lower rate to the higher rate before mixing.  This is just my 2 cents on the issue, from my experience, with the utmost respect to the work and experience of people far more distinguished than myself, like Dan Lavry and Bob Katz and many others.
Title: Re: My humble opinion on why DSP and high samplerates are a good mix
Post by: danlavry on January 20, 2005, 07:05:56 PM
jaydizzle wrote on Thu, 20 January 2005 23:19

I've seen a lot of talk about why all of you don't like samplerates higher than 96k.  Admitedly I deal almost solely with sound synthesis and DSP, and do not record very many sounds on microphones(for which high samplerates do make less sense due to physical limitations of the microphone).  Here is a test to prove my point.  You can use other software, but this is what I use.  Open an instance of Reaktor 4 (or any softsynth) in your sequencer, and open a spectral analyzer on the master channel.  In reaktor 4 I build a very simple sine wave generator.  First, set the project samplerate and Reaktors internal samplerate to 24khz. Triggering a note somewhere in the 75-100hz range yields a harmonic at that frequency with no overtones, as can be seen on the spec analyzer.  It sounds like a pure sinewave, but a little muddy.  Now up the samplerate to 48k and it does indeed sound a little cleaner, although the spec analyzer still shows nothing above the fundamental frequency.  Now change the samplerate to 96k, and yet again, it sounds cleaner without gaining any frequency response above the fundamental which is still far below the nyquist and the theoretical maximum.  Next, I change the reaktor internal samplerate to 192k, while leaving the project and soundcard rates at 96k.  Reaktor generates a sine wave at 192k and then resamples by adding every 2 samples together, and dividing by two.  The result is slightly more accurate, and even though we are still listening at 96k, it does sound a little cleaner.  Finally, change reaktors internal samplerate to 384khz, and do the same.  At this point, the difference is becomeing very slight, as we are approaching the point of diminishing returns.
Test 2:
Generate an oscillogram of a 10khz sine wave at 24, 48, 96 and 192khz samplerates, and examine them with your wave editor zoomed all the way in(showing individual samples in sample by sample steps).  At 24khz, each oscillation occurs over a time period of about 2 samples.  It is indistinguishable from a triangle or saw wave, and is essentially random noise.  At 48khz, each oscillation is about 5 samples long, but is still lacking definition, and is still not a very accurate mathematical depiction of a sine wave.  Next, 96khz is a significant improvement, and 192 is even more so.  This illustrates that higher samplerates improve not just frequency response but high end definition as well.  This is especially important when you do a lot of DSP and digital mixing, which will muddy up high freqs in a hurry at lower samplerates.  Individual sounds sound fine recorded at lower samplerates(like 48khz), and can still sound fine if mixed via analog equipment, but when you're mixing digitally, a lot of definition is gained in the 5-10khz range by using higher samplerates, even if you just resample sounds recorded at a lower rate to the higher rate before mixing.  This is just my 2 cents on the issue, from my experience, with the utmost respect to the work and experience of people far more distinguished than myself, like Dan Lavry and Bob Katz and many others.



It may be helpful to you to read my paper sampling theory. Clearly even a 10KHz sine wave sampled at say 44KHz does not look much like a sine wave when viewed as a time domain "sample by sample plot". So What? It does not matter! If you take that DIFFERENCE between that 10KHz "sample by sample" plot and the analog continues wave you have what we call the error signal. It is the difference. Now analyze it in the frequency domain, and you will see that the difference is all at high frequencies over Nyquist. Therefore removing the error (the difference) can be done by filtering the energy above Nyquist. Once you filtered the high frequencies (removed the difference) the outcome is THE ORIGINAL. The outcome has the right value at ALL THE POINTS including any point between the samples.

I alredy stated the above a number of times, addresing each and every one of the points you brought up from many angles. You know, I worked pretty hard at putting that paper together, and it is based on over 2 dozen years of design experience with conversion. It would be good if you took just a couple of hours to read it and a maybe a a few hours to think about it.

Regards
Dan Lavry
Title: Re: My humble opinion on why DSP and high samplerates are a good mix
Post by: jaydizzle on January 20, 2005, 07:36:02 PM
I'm sorry, I did not intend to offend, and I'm new to this forum, and as well haven't read many of the papers you have written, but I will search for and read them later tonight.
Title: Re: My humble opinion on why DSP and high samplerates are a good mix
Post by: danlavry on January 20, 2005, 07:56:46 PM
jaydizzle wrote on Fri, 21 January 2005 00:36

I'm sorry, I did not intend to offend, and I'm new to this forum, and as well haven't read many of the papers you have written, but I will search for and read them later tonight.


I am not offended at all. But I am all for efficiency, and have addressed the same issue so many times... The papers are under support at http://www.lavryengineering.com

Regards
Dan Lavry
Title: Re: My humble opinion on why DSP and high samplerates are a good mix
Post by: dayvel on January 21, 2005, 01:03:18 AM
How in the world could a sine wave sound "muddy"?
Title: Re: My humble opinion on why DSP and high samplerates are a good mix
Post by: PookyNMR on January 21, 2005, 04:58:33 PM
dayvel wrote on Thu, 20 January 2005 23:03

How in the world could a sine wave sound "muddy"?


If it were at 40hz?  Wink
Title: Re: My humble opinion on why DSP and high samplerates are a good mix
Post by: Dan Mills on February 09, 2005, 08:28:02 PM
Or if the reconstruction filters are woefully inadequate!

Actually running at high sample rates CAN have some advantages (at least for internal DSP).
Remember that non linear processing can itself generate aliasing in the digital domain!

Consider multiplying two sine waves of say 10Khz and 15Khz sampled at 48Khz. Now in the analog domain the output of the gilbert cell would ideally contain 5Khz & 25Khz, but because of the discreet time nature of sampled systems that 25Khz aliases around the 24Khz Nyquest limit and gives a component at 23Khz.

This effect means that there are real advantages to upsampling prior to fast non linear processing (such as limiting or 'clipping'), obviously it is then possible to low pass filter and downsample again prior to conversion, but this downsampling tends to introduce overshoot relative to the level the 'limiter' is set at....

Incidentally this is one reason why it is so important to lowpass filter the gain control signal in digital compressors and the like (many plugin authors seem to forget this detail).

This is also why doing clipping in the digital domain is a hard problem, just clamping the sample values sounds horrid and in any case the reconstruction filters will still overshoot.

Now personally, I love the ready availability of 192Khz cards, it makes generating MPX multiplex for broadcast very cheap and easy in software, but given I am buying a 192Khz converter which should put the nyquest limit at 96K, do so many of the silly things have reconstruction filters going over at ~40K!
If I was just doing audio, then 40K would be ample and I would be running a 96K card!
 
Regards, Dan Mills.
Title: Re: My humble opinion on why DSP and high samplerates are a good mix
Post by: danlavry on February 10, 2005, 09:21:31 PM
Actually running at high sample rates CAN have some advantages (at least for internal DSP). Remember that non linear processing can itself generate aliasing in the digital domain!

Consider multiplying two sine waves of say 10Khz and 15Khz sampled at 48Khz. Now in the analog domain the output of the gilbert cell would ideally contain 5Khz & 25Khz, but because of the discreet time nature of sampled systems that 25Khz aliases around the 24Khz Nyquest limit and gives a component at 23Khz.


First, I already talked about non linear processing and digital, the two just do not go together. Even a slight non linearity in the transfer curve will produce such a wide band cross products, that 192KHz is not going to help much! Even 1MHz may not cut it… Remember that a 1% cross product is -40dB tone! You do not want that much energy to alias into the audio band.

Second, your example is not of a real world application, for audio because audio non linearity is typically a transfer function alteration for say tube emulation, or slow amplitude change such as compression or a limiter function. Your multiplication of two sine wave is something we do in radio or TV or other modulation and demodulation applications…

But let us take your example for the moment, assuming I multiply 2 equal amplitude 10KHz and 15KHz, then the outcome will be a difference between a 25KHz cosine wave and a 5KHz cosine wave (simple trigonometry).
So I can assure you that an 88.2KHz with say a solid 40KHz performance, will be more then sufficient to handle that multiplication! In fact, 88.2 or 96KHz is enough to contain a multiplication of say 20Khz and 21kHz.

This is also why doing clipping in the digital domain is a hard problem, just clamping the sample values sounds horrid and in any case the reconstruction filters will still overshoot.

So you think that clipping with 192KHz is much better then clipping with 44.1KHz? Do the math and you will see it is about as bad. But one way or the other, going to 192KHz to allow digital clipping is like shooting yourself in the foot to become a runner.

But we are talking audio, and you agreed that 40KHz is enough…

Regards
Dan Lavry
Title: Re: My humble opinion on why DSP and high samplerates are a good mix
Post by: Dan Mills on February 11, 2005, 06:59:28 PM
[quote title=danlavry wrote on Fri, 11 February 2005 02:21]Actually running at high sample rates CAN have some advantages (at least for internal DSP). Remember that non linear processing can itself generate aliasing in the digital domain!


First, I already talked about non linear processing and digital, the two just do not go together. Even a slight non linearity in the transfer curve will produce such a wide band cross products, that 192KHz is not going to help much! Even 1MHz may not cut it? Remember that a 1% cross product is -40dB tone! You do not want that much energy to alias into the audio band.


Indeed, but all gain control operations will have this effect! Zipper noise is not just due to step changes in gain but also due to aliasing of high frequencies products.


Second, your example is not of a real world application, for audio because audio non linearity is typically a transfer function alteration for say tube emulation, or slow amplitude change such as compression or a limiter function. Your multiplication of two sine wave is something we do in radio or TV or other modulation and demodulation applications?


But the sine wave case is just a degenerate case of this (as well as being a hell of a lot easier to analyse)! The transfer function case is tricky because like all non linear functions it generates IM products. However, even so it should be possible given a sufficiently high SR to design a band limited version of a given transfer function such that all the intermod products (of signals within the audio band) are guaranteed to remain within the nyquest limit.

Limiters are another area the really benefit from high sample rates as the gain control signal can (if the programmer is not paying attention) contain high frequency components. Consider the discontinuty when the signal hits the threshold of a hard knee limiter.


This is also why doing clipping in the digital domain is a hard problem, just clamping the sample values sounds horrid and in any case the reconstruction filters will still overshoot.


So you think that clipping with 192KHz is much better then clipping with 44.1KHz? Do the math and you will see it is about as bad. But one way or the other, going to 192KHz to allow digital clipping is like shooting yourself in the foot to become a runner.


No, but it does allow you to run a fast limiter which if you design the control loop filter correctly is almost equivalent to a band limited clipper. It is not possible to do clipping in the digital domain (and have it sound anything other then nasty), but you can play some games with fast limiting. Some systems I have seen run internal DSP at up to ~0.5Ms/s to allow this sort of thing to work.
Orban has a neat trick with a hilbert transform to allow the gain control change to occur at zero crossing (which still sounds nasty but less so)!


But we are talking audio, and you agreed that 40KHz is enough?


Ohh for converters, no problem. In fact if the reconstruction filters give a clean (in both amplitude and phase response) DC - 20K, that is sufficient. I have not heard 20K in the last 20 years...  After all integer ratio resampling to a higher rate if needed for dsp is well established math.

Now getting that filter behaviour usually requires something a little faster then 44.1, but 96 is way more then is really needed.  

Regards,
Dan Mills.
Title: Re: My humble opinion on why DSP and high samplerates are a good mix
Post by: danlavry on February 11, 2005, 08:08:14 PM
[quote title=dmills wrote on Fri, 11 February 2005 23:59]
danlavry wrote on Fri, 11 February 2005 02:21

Actually running at high sample rates CAN have some advantages (at least for internal DSP). Remember that non linear processing can itself generate aliasing in the digital domain!



The transfer function case is tricky because like all non linear functions it generates IM products. However, even so it should be possible given a sufficiently high SR to design a band limited version of a given transfer function such that all the intermod products (of signals within the audio band) are guaranteed to remain within the nyquest limit....

Regards,
Dan Mills.


Again, I disagree that you get any significant help when doing
limiting at 192KHz instead of say 96KHz. The "damage goes far beyong the first 2 harmonics...

You said is possible with sufficiently high SR to design a band limited version of a given transfer function such that all the intermod products (of signals within the audio band) are guaranteed to remain within the nyquest limit.

You can do better then make a statement that it is possible to do something. Figure it out all the way then what you say will have a lot more value.

This time I will do it for you and the other readers:

If your non linearity can be made of a polynomial of nth order, you will need to have 5fs to avoid aliasing. For a 10th order, you are at a pretty high rate 10fs... Try a good approximation for an exponential transfer function - it is nearly hopeless...

Also, I am not against LOCALIZED very high sample rates. We do it all the time, and for a good reason. The AD modulator sections of sigma delta operate at 64fs-1024fs. Nearly all DAC's (sigma delta or not) upsample by some factor. Non linear processing does call for a lot of upsampling then processing and then down sampling. I said it all and if you read my paper I would not be repeating it here again. My issue is with sampling rates of the audio data itself such as data we store and transfer.

Regards
Dan Lavry