I am planning to use NUCLEO-G031K8 board as an audio interface for my electric guitar to computer. So I designed a circuit to amplify small signal of guitar. When I check board's datasheet it is written it samples analog signals with 12-bit depth. (Source) and it can be extended to 16-bit resolution through hardware oversampling. I did some research online but could not find a solid answer. How to use oversampling? And also when I record my guitar is it a good quality interface to use after design or not? How to evaluate it? Because for example this audio interface samples 24-bit/96 khz resolution I wonder will I have similar to this one or a worse one.

  • 1
    \$\begingroup\$ How do we know how good instrument preamp you built, so how can we measure the quality of unknown circuitry? Also, a 12-bit ADC inside a MCU, even oversampled to get 16-bit results, will never be able to match a 24-bit audio ADC chip. \$\endgroup\$
    – Justme
    Commented Nov 11, 2020 at 11:25
  • 2
    \$\begingroup\$ By sampling at 256 times the frequency and averaging 256 samples, oversampling increases the resolution by 4 bits (e.g. from 12 to 16 bit). The STM32G031K8 can do this in hardware (see ch. 14.8 in the reference manual). The sampling frequency jumps from 96 kHz to 24.5MHz. Whether that makes sense given that the ADC in an MCU isn't a high precision part is another question... \$\endgroup\$
    – Codo
    Commented Nov 11, 2020 at 16:29

1 Answer 1


Let's be practical and realistic but firstly this answer has got nothing to do with your preamplifier design - without a schematic it's impossible to say.

Anyway, CD quality is 16 bits stereo so, if you are happy with 16 bits then there is no great reason to go any higher in sample resolution. But let's think about a piece of music (say a solo classical guitar piece) on a CD. Let's say it starts quietly and builds to around half-full-scale resolution. "Quiet" might mean 20 dB lower than the middle-section of the piece of music so, if the middle-section is about half-full-scale resolution (16 bits) then it will have 15 bits resolution approximately.

Now the quiet section at the beginning might be 20 dB down (or one hundredth of the amplitude) and that means the resolution in those opening few bars is 6 bits lower in resolution i.e. it will have a signal that is equivalent to a 9 bit full-scale-signal.

And, when listening to a CD of a quiet intro on a piece like this, if you are still happy with the sound quality then you will be more than happy with 12 bits of resolution. If it's an electric guitar and has distortion as an FX then I doubt that you would tell the difference if less-than 8 bit resolution were used to encode the analogue signal.

Like I said: be practical and realistic.

What might kill your sound is if you are not sampling fast enough i.e. not sampling at least 40 k samples per second. If it's more like 20 kSps then you will begin to notice the difference and the top clean edges of the guitar sound will just start to be lost.

Another thing that might give annoyance is not using a proper anti-alias filter AND sampling at too low a rate. For audio, the general limit is 20 kHz and sampling is done at 44 kSps i.e. sampling is done fast enough to avoid problems of aliasing. Of course, with audio (and no ultrasonics picked up) you wouldn't need an anti-alias filter at 44 kSps but, if you were sampling at 20 kSps then you probably would because, anything between 10 kHz and 20 kHz might be "bounced" down into the digitized spectrum and sound awful.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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