5
\$\begingroup\$

I wanna build some DSP effects on, for example STM32F4 processor, with frequency 96 or 192 KHz. Are 16-bit converters (ADC and DAC) enough for that kind of operation? Can I hear a diffrence when choosing 16-bits or 24-bits?

\$\endgroup\$
5
  • 1
    \$\begingroup\$ What is the max sampling rate of your ADCs/DACs? That is what affects the frequencies you want to sample. You can test whether you will hear a difference between 16-bit and 24-bit in Windows (Right-click the sound icon in the toolbox -> Playback devices -> pick the one you are using -> Properties -> Advanced and change between 24-bit and 16-bit). \$\endgroup\$
    – Mewa
    May 1, 2015 at 18:27
  • \$\begingroup\$ What sort of signals are you applying effects to and ultimately what do you do with those signals. \$\endgroup\$
    – Andy aka
    May 1, 2015 at 18:54
  • 1
    \$\begingroup\$ I want to create a platform that will allow me to create many various effects. I want to use with guitar. For the beggining I want to do simple ADSR envelope, but next maybe something like delay or chorus. \$\endgroup\$ May 1, 2015 at 19:09
  • 3
    \$\begingroup\$ Guitars have much lower frequency response and dynamic range than other audio sources. 16 bit would be fine. \$\endgroup\$
    – crgrace
    May 1, 2015 at 20:14
  • \$\begingroup\$ You might take a look at the hoxton owl. While I was not especially enamored with the demo sounds they have on their site, they do have schematics and a codebase on github. Their hardware includes an ARM processor, a WM8731 codec, some crystal clocks. etc. \$\endgroup\$
    – S. Imp
    Jul 7, 2020 at 4:53

6 Answers 6

8
\$\begingroup\$

It depends on who you ask. Most humans cannot hear beyond 20 kHz and 16 bits, so 96 or 192 kHz should be plenty.

As for hearing a difference between 16 and 24 bit converters it depends on your DSP. The key benefit of 24 bit converters is it gives you tons of additional headroom (dynamic range) so you can do a lot of mathematical operations and not add noticeable quantization noise.

In my experience, I can't tell the difference between 16 and 24 bit converters. Some people think they can. If I were you I would go with the 24-bit converters so it is one less thing to worry about and you can focus on your DSP code.

\$\endgroup\$
9
\$\begingroup\$

There is a lot of bad information and audio phoolery available on this topic, but if you're doing one channel of digital audio, 96kHz and 192kHz sample rates are silly. Human hearing extends to 20kHz. To satisfy Nyquist at 20kHz, we need a sampling rate greater than 40kHz. CDs are 44.1kHz, and 48kHz is another common sampling frequency.

Now, let's recall that digital audio is a discreet signal, not continuous. This means that is has a value at each sample time, and is undefined at all other times. For a bandlimited signal, sampled at or greater than Nyquist, there is only one signal that passes through each of these discreet samples. Any other signal that passes through all the sample points cannot satisfy Nyquist. The only reason to sample at 96kHz or 192kHz for a single channel is if you're oversampling with a low bit depth ADC. That's also silly, and we'll go there next.

We just discussed how a series of discreet samples matches exactly one signal. This is independent of bit depth. That does not mean bit depth doesn't matter. The conversion to digital introduces quantization noise. Quantization is noise introduced to the digital signal by "rounding" it the closest digital value, as shown in this image shamelessly stolen from Wikipedia.

enter image description here

Quantization noise is directly related to bit depth. It should be fairly obvious the more resolution(values to round to), the lower the quantization noise. A higher bit depth makes for higher full scale resolution. Higher resolution reduces quantization noise by having more values available to closely match the signal's value at a sample. Lowering quantization noise lowers the noise floor, and increases the signal-to-noise ratio (SNR).

Can you hear the difference between 16 and 24 bit quantization? I'll bet anything you can't. It's for a guitar, and guitars are not known for their dynamic range. A professional symphony? Maybe, without dither. The 16 bit noise floor is far enough down it's unlikely to be discernible, but the difference will be measurable.

In summary, my vote goes for 48kHz sampling rate, and 16 bit resolution. I strongly encourage anyone interested in this topic to watch this video.

\$\endgroup\$
6
  • 3
    \$\begingroup\$ That video was amazing. This is going to open some questions from me. \$\endgroup\$
    – efox29
    May 2, 2015 at 3:16
  • \$\begingroup\$ +1 for the difference between measurable and discernible - sometimes, the difference is just too small to be heard. \$\endgroup\$
    – Greg d'Eon
    May 5, 2015 at 18:49
  • 1
    \$\begingroup\$ Under ideal conditions, 16-bit sampling at 44100Hz will be adequate. Using a higher bit depth and sampling rate, however, may simplify some aspects of system design. For example, getting 96dB SNR from a 16-bit ADC would require that the input gain be set perfectly. If a device has to accept input from a variety of devices whose peak level might vary by a factor of 100, a fixed-gain 16-bit ADC would only be good for about 56dB when used on a low-level signal. By contrast, a typical 24-bit audio ADC would be able to manage a consistent useful SNR over its entire dynamic range. \$\endgroup\$
    – supercat
    May 5, 2015 at 19:40
  • 1
    \$\begingroup\$ @MattYoung: There are two different forms of SNR: the ratio between the a signal level and noise level measured at the same time, or the ratio between the maximum signal level and the lowest level of noise that can ride on a non-zero signal. For the first measure, even 48dB would be adequate for a guitar. For the second, however, much more is required. If there's a difference of more than 48dB between the loudest and softest input levels a box should accept, a 16-bit ADC would only have 48dB SNR by the second measure, which isn't really enough. \$\endgroup\$
    – supercat
    May 5, 2015 at 20:04
  • 1
    \$\begingroup\$ @MattYoung: With regard to sample rate, if one wants a 12Khz passband, then 48kHz sampling with an SNR of 48dB would require a 48dB/octave filter. Using 96kHz sampling would require a 24dB/octave filter, and using 192kHz sampling would only require a 12dB/octave filter. Further, using crude interpolation algorithms at 192Khz may yield results comparable to using better filtering algorithms at 48Khz, but require a lot less coding effort. \$\endgroup\$
    – supercat
    May 5, 2015 at 20:12
4
\$\begingroup\$

Something to consider is that the performance of your ADC and DAC will depend a great deal on the support circuitry and PCB layout. I'm not an ADC expert, but my understanding is that from an electrical standpoint, 16-bit is high-end and 24-bit is extreme. If you're using a 5V reference, 1 least-significant bit is 76 uV on a 16-bit converter. That's a best case noise floor of -96 dB. Are you confident that you can control noise to that extent? Keep in mind that your recording environment also produces noise. Unless you're in a recording studio and you have a really nice circuit board, I don't think a 24-bit ADC will help you. I also suspect that 96 kHz is overkill, and that 48 kHz would work just as well.

Just for fun, you might experiment with the 12-bit ADC on the STM32F4 to see if you can hear a difference vs. 16-bit.

\$\endgroup\$
0
\$\begingroup\$

An easily-overlooked quirk of quantizing systems like ADCs is that an ADC which always returns the reading nearest to the input value will add a significant amount--up to ±½LSB--of harmonic distortion, which can be much more objectionable than would be ±½LSB of broad-spectrum noise. An ADC which added ±½LSB of broad-spectrum noise with the right characteristics could eliminate the harmonic distortion, but if the characteristics of the noise weren't quite right some distortion would remain. While it's not impossible to design a high-quality 16-bit ADC which has a very-well-shaped ±½LSB noise source, it's often much easier to simply extend the measurements to report 24 bits, thereby reducing quantization noise (and the resulting harmonic distortion) by a factor of at least 256. While going all the way to 24 bits might not have much advantage beyond e.g. going to 20, it probably doesn't really add much to the cost from a hardware or software perspective.

As an analogy, suppose one needs a device which will report a voltage accurate to within 0.06 volts. Would it be easier to design such a device with a readout in tenths of a volt, or in hundredths? If the readout is in tenths, then the device must be able to resolve the difference between 1.139 and 1.161 volts (the former must be reported as 1.1, and the latter as 1.2)--a difference of just over 0.02 volts. If the readout were in hundredths, it could report a value of 1.10 volts for anything up to 1.159 volts, and a reading of 1.11 volts for anything down to 1.061 volts, a spread of about 0.1 volts. Thus, providing more significant figures in the readout actually reduces the accuracy of circuitry necessary to achieve a given accuracy of result.

\$\endgroup\$
0
\$\begingroup\$

In your case, for sampling an electric guitar with a maximum peak frequency of about 2.5kHz and a falloff slope of at least 12dB/octave at higher frequencies I'd agree with the general consensus of 48kHz and 16 bit resolution, although if you get into heavy modifications (such as multiple delay streams) then 24 bits would serve you better as @crgrace pointed out.

No one has yet mentioned psychoacoustics which play an important role in the perception of digital audio, and since your question was about whether you can hear a difference I think this remains to be explained. Our perception of sound is dominated more by phasing information than by frequency and distortion. You mentioned delay and chorus as your next interests after envelope modulation. Both of these effects add phasing information to the original source.

However, if you decided you wanted to increase the scope of your project to include acoustic guitar or vocals there would be a noticeable effect using a 48kHz sample rate and 16 bit depth. Sibilance, the "s" sound in speech, often occurs with vocals. An acoustic guitar with a piezo pickup also has a form of sibilance (although not of the same type) and it's best to filter out signals over 3-5kHz to avoid this issue. But with vocals you can't really do much except to apply a de-essing filter.

Sibilance is a complex sound which has an interplay of phasing information at moderately high frequencies. The most obvious case is a sizzle cymbal. Mic and record it at various sampling rates and compare the recorded sound with the live. As you progressively reduce the sample rate the recorded signal will sound more like harsh noise until it becomes unbearable. On a good recording you'll be able to hear the rivets travel around the cymbal. This is one reason why some people prefer analogue recordings over CDs.

As a rule of thumb you need the sample rate to be 10x the highest signal frequency to minimise phasing distortions. An electric guitar produces few overtones higher than 5kHz and so a 48kHz sample rate will work quite well. But if you want to use your effects more generally, such as pitch correction or chorus for vocals, I would recommend going with higher sample rates.

\$\endgroup\$
-1
\$\begingroup\$

Bit depth, which is what the OP is talking about does not have anything to do with being able to hear some range of frequencies. In other words, bit depth represents the resolution of sound intensity. I bet, if you get a high quality music and produce it through a 16 and 24 bit converters, you will hear the difference big time! The image below shows exaggerated quantization "staircase" on the 16 bit sampling:

enter image description here

Now, sample rate, which OP confuses with ADC, is different. I think he means 96ks/s and 192ks/s, which would mean oversampling. These numbers usually represent the multiples of 24kHz - a maximum hearing frequency with some spare overhead (due to non-ideal lowpass filters). Thus, 48kHz sampling would be slightly over Nyquist rate, 96Khz just means it is stereo (two cahnnels), and 192 is quadro.

Thus, you do need to sample each channel at around 48kHz, and if you can get a 24bit ADC sampler - go for it - most of commercial sound samples are 24bit depth. However, if you sound source (quitar) is noisy enough to kill the resolution, than spending extra money for the 24bit convertor will not improve your sound.

And as @crgrace said, higher bitdepth will allow you to decrease the loss of information during digital sound processing due to truncation errors.

\$\endgroup\$
9
  • \$\begingroup\$ Bit depth has nothing to do with "sound intensity," but with dynamic range and SNR. \$\endgroup\$
    – Matt Young
    May 1, 2015 at 20:00
  • \$\begingroup\$ @MattYoung Right, did you mistaken it for volume? I meant the resolution of sound intensity which is essentially SNR. \$\endgroup\$
    – Nazar
    May 1, 2015 at 20:05
  • 3
    \$\begingroup\$ MP3 compression is not a simple reduction in bit depth \$\endgroup\$ May 1, 2015 at 20:29
  • 1
    \$\begingroup\$ That edit just makes this answer plain wrong. Bit depth has NOTHING to do with quality. Quantizing at 8 or 24 bits will get you the exact same signal. The difference is the 24 bit version will have a much lower noise floor. \$\endgroup\$
    – Matt Young
    May 2, 2015 at 1:20
  • 6
    \$\begingroup\$ That last image is absurdly inaccurate. \$\endgroup\$
    – hobbs
    May 2, 2015 at 3:39

Not the answer you're looking for? Browse other questions tagged or ask your own question.