Author Topic: Let's do the A/D math  (Read 7285 times)

MoltenVoltage

Let's do the A/D math
« on: July 14, 2010, 10:47:25 AM »
I have been thinking lately about sample rates for built-in analog>digital converters.  Stock DSP chips can capture 12 bits at 500 Ksps without any external parts.

"CD quality" is 16 bits at 44.1 Ksps.

So, the questions are 1) whether or not the 12 bit A/D can sound nearly as good as CD quality (i.e. good enough for stand-alone guitar effects), and 2) the proper way to calculate the resolution.

12 bits gets you 4,096 possible values.  Multiplied by 500,000 provides a resolution of 2,048,000,000.

16 bits gets you 65,536 possible values.  Multiplied by 44,100 provides a resolution of 2,890,137,600.

From my math, the 12 bit version is just over 70% the resolution of the 16 bit version.  This seems good enough for stand-alone guitar effects, as I used to use 12 bit samplers in my industrial band in the early 90's and they sounded decent, especially with all the other stuff happening.

I realize "good enough" is subjective, but maybe there is some logic as to why a 12 bit system is a reasonable alternative, or why it would sound lousy.
MoltenVoltage.com for PedalSync audio control chips - make programmable and MIDI-controlled analog pedals!

ExpAnonColin

Re: Let's do the A/D math
« Reply #1 on: July 14, 2010, 11:23:49 AM »
Very true, but the difference between aliasing distortion (eg, sampling rate is too low) and quantization distortion (eg, bit depth is too small) is big.

With proper anti-aliasing and reconstruction filters, anything even a little bit above 40 kHz sampling rate should have inaudible aliasing distortion, so really in that respect CD quality and 500 kHz sampling rate are equivalent.  Aliasing distortion sounds like a kind of shimmering noise on top of your audio.  Heck, for most systems (esp. guitar) you could get as low as 32 kHz without hearing it as long as your anti aliasing and reconstruction filters were good enough, as the frequency range of a guitar signal only really gets significant above 16 kHz if you have distortion... and plus, it's hard to hear that high!  All that being said, there really is no reason in an audio system that you should be sampling at 500 kHz, as it will force you to do more computation (unless you are doing nonlinear processing, but in that case you can just do the resampling in software).  44.1 kHz is plenty high, 96 kHz is somewhat overkill (but a convenient amount of oversampling).

In terms of bit depth, the rule is that one bit corresponds to 6 dB of dynamic range... so 16 bit is 96 dB, and 12 bit is 72 dB.  Humans can hear about a 90 dB dynamic range, so 16 bit is "just good enough" and 12 bit is "pretty good".  Quantization distortion basically sounds like white noise over the signal until you get into really low-bit depths, when it just sounds like nasty distortion.  In other words, yeah, you will be hard-pressed to hear 12 bit quantization without the right head phones, and if you do it will come through as white-ish noise over the top of the signal.  That being said, if you try to sell a guitar pedal with 12-bit quantization when everyone else has 24-bit, good luck!  (the joke is that their 24-bit anti-alising and reconstruction filters, preamps, etc probably have an SNR of around 72 dB so it shouldn't make a huge difference anyways )

-Colin

slotbot

Re: Let's do the A/D math
« Reply #2 on: July 14, 2010, 11:42:49 AM »

12 bits gets you 4,096 possible values.  Multiplied by 500,000 provides a resolution of 2,048,000,000.

16 bits gets you 65,536 possible values.  Multiplied by 44,100 provides a resolution of 2,890,137,600.

i think usually the word "resolutiuon" is used for bit depth (ie 12 bit resolution) and bit rate is used for what your calling resolution. ie your first calculation yields a bit rate of ~2Gbps. (Giga bits per second)

i wonder how possible it is to find out the rates used in some well known commercial pedals, this might give you a good idea of whats "acceptable" (ie a dd3 or what not)

Also you can always upsample and to get rid of some of that "white noise" effect Colin mentions. Even if you sample 12 bits at 22 KHz you can smooth it a bit by interpolation. Since most mcus with 12 bit AD are 16 bit your interpolations can use all 16 bit. Still not as good as actually sampling 16 bit but even linear interpolation can give (subjectively) good results.

G. Hoffman

Re: Let's do the A/D math
« Reply #3 on: July 14, 2010, 03:13:02 PM »
It's been 10-15 years, so I may be remembering this wrong, but I seem to recall that CD's have 15 bits of data and one bit used for data correction.

Still, I would have to go with 12 bit being unacceptable, myself.  For distorted guitar sounds, it MIGHT work, but for anyone doing any kind of clean guitar sounds it just isn't going to work.

Gabriel

earthtonesaudio

Re: Let's do the A/D math
« Reply #4 on: July 14, 2010, 03:50:53 PM »
Don't forget that the CD itself is an analog thing (just a series of dimples on a disc) and to be read, the information on it had to be converted to digital after the laser bounced off it.  I have the vague impression that a high percentage of CD players use cheap-but-adequate 1-bit sigma delta ADCs with minimal analog filtering (for cheapness) to retrieve the data from the disc.  Any noise or lack of dynamic range you've ever heard on a CD also included those extra ADC/DAC steps in the player itself.  If you're just going through one pedal's conversion and the final output comes from a speaker, then to first order you have one less conversion and your audio quality will be better by that amount, whatever "that amount" is.

PRR

Re: Let's do the A/D math
« Reply #5 on: July 14, 2010, 11:57:58 PM »
> recall that CD's have 15 bits of data and one bit used for data correction.

No.

A 1-for-15 ECC would be hardly worthwhile.

The scale may be understood as 0-64K, or as 0-32K and a +/- sign bit. When we wiggle audio we interpret as +/-32K. The raw bits may be writ as 0-64K, I forget. It matters to the guy who writes the software. If he did right (if not, it would be very obvious!), it does not matter to us.

Audio CDs have a checksum on each block. The original CD players spun and played in real-time. If there was an error, that's just too bad. Going-back and re-reading would cause a "glitch" worse than just dropping that block. Doing extended error correction was beyond the skill of the processors available at popular price.

Computer/data CDs do have extended error correction. There is no concept of "real time", and a CD is so much faster than a diskette that slow error correction is no big deal. OTOH computer data often HAS to be bit-perfect.

> whether or not the 12 bit A/D can sound nearly as good as CD

Here are three 200*316 or 63,200 pixel images. The "sample rate", number of dots per Kelly Bundy, is the same in all three. However the "sample depth", number of possible colors per dot, is 16-bit, 7-bit, or 4-bit.

The texture in the hat, and the gradation of light/dark around the curves, renders very differently from 16 to 7 to 4 bit depth. The "fur" on the hat gets indistinct, the light/dark gradation around curves breaks-up into blobs and stripes like a topo-map, the hair turns into Impressionist streaks.

> "good enough" is subjective

Yes. The 4-bit version has some effect. However many lovers of fine art might prefer a 100*158 (half size) rendition with enough color-depth so that the fine gradations don't break-up.

Assume your 12-bit depth and imagine a minimum signal, fluctuating 1 and 0 in the bottom bit. This comes out as 72dB down from full output and gross distortion. True, tape and LP are OTOO 72dB (often -60dB from zero VU and 12dB headroom above zero VU). But a barely-audible tape/LP level is not grossly distorted, just drowned in hiss.

> I used to use 12 bit samplers in my industrial band in the early 90's and they sounded decent

For a short time, LPs were mastered with a 12-bit digital delay (to give "look-ahead"). This was considered "good enough" and a lot less hassle than tape delay. However these ultimately sound harsh, rough. Fortunately the cost of 16-bit's worth of delay came down.

You need both samples/second and depth/sample.

Yes, in a busy band one instrument on 12-bit path may not stink.

Full-orchestra audio paths need to pass >15KHz or they lack zizzle. But only a few instruments actually throw sound that high. Many individual instruments are done before 5KHz. Therefore while "full audio" wants a 32KspS or 44KspS sample rate, you could do guitar with less, maybe 10KspS. (However filtering is much more critical when the sample rate comes down into the audio band.)

It is not clear that your 500KspS sample rate is "good" when audio can be quite-fine at 20KspS-44KspS.

Ronsonic

Re: Let's do the A/D math
« Reply #6 on: July 15, 2010, 02:31:19 PM »
I have been thinking lately about sample rates for built-in analog>digital converters.  Stock DSP chips can capture 12 bits at 500 Ksps without any external parts.

"CD quality" is 16 bits at 44.1 Ksps.

So, the questions are 1) whether or not the 12 bit A/D can sound nearly as good as CD quality (i.e. good enough for stand-alone guitar effects), and 2) the proper way to calculate the resolution.

"Never resort to mathematics until you have exhausted all the possibilities of a couple of toothpicks and a piece of string."

I've worked on dozens of 12 bit samplers thanks to Emu and their SP-12 and SP-1200 series. The reason so many people are still using the archaic things is specifically because of the 12 bit samples and the effect it has on the sound. Of course these same people often bypass the anti-aliasing filters too. And yes you can hear it and see it on a scope. The praise is "It really cuts through the mix." The criticism is "it sounds gritty." With guitar the effect will be less drastic because of the limited HF content and FR of the amps and other equipment.

There is a difference between the two things you mention: CD quality is different from "good enough for stand-alone guitar effects." Most pedals and guitar effects are not CD quality and don't need to be. You are looking for an effect, sound altering if not sound production, that's a different game than sound recording and sound reproduction.

The question is whether the higher sample rates help get what you want or not. The 12 bit will be more "effecty" the 16 more "hifi."

Not quite what you were asking but hope it helps with perspective.
« Last Edit: July 15, 2010, 02:34:32 PM by Ronsonic »
http://ronbalesfx.blogspot.com
My Blog of FX, Gear and Amp Services and DIY Info

Ronsonic

Re: Let's do the A/D math
« Reply #7 on: July 15, 2010, 02:33:07 PM »
Ooops
http://ronbalesfx.blogspot.com
My Blog of FX, Gear and Amp Services and DIY Info