Multi-channel ADC speed (Audio meter)

I'm trying to make a multi-channel audio meter. Ideally 12 channel, 6 stereo pairs. However I could lose a few channels if the AVR can't handle it.

I tried sampling audio with the build in ADC and found it just wouldn't run fast enough to sample 5 channels sequentially. With higher ADC clock rates I started to get channel cross talk as the sample and hold circuit seems to need time to work.

In my design I could have channel 1 producing 0 volts, but channel 2 beside it at 2V, so cross talk will immediately show up on the meter with the adjacent channels flickering.

I think the highest output I could get, in 8 bit mode, with close to zero cross talk was around 2KHz. This is not enough to detect audio waveform peaks.

I was looking into using a peak detect circuit on each channel and sampling at a much lower frequency. This requires quite a lot of supporting circuitry in the form of quad opamp chips capacitors and diodes.

However then I got to thinking if I used an external 12 channel DAC that allows a higher scan speed... could I read the 12 channels fast enough.

Picking through ADC datasheets talks forever, so I thought I would ask if you guys think it is feasible to set an ADC like the MAX1139 (et al) to scan and be able to read all 12 channels at 20Khz-44Khz and still have enough processing power left to compute, store and decay peaks then feed either a multiplexed shift register and a dozen LED bargraphs or... a 16x12 grid of WS2811s.

I'm concerned this might just be too much for an ATMega328P, although I could, maybe use an ESP8266 which runs faster.

So to summarize... ideally:

Sample 12 half rectified audio channels at 8 bit resolution at 44Khz (528Khz total sample rate)
Store and decay peak values
Refresh a display with all 12 values with at least a 10Hz refresh rate.

Possible or pipe dream on AVR?

Paul

The cross-talk issue can be solved by buffering each channel to a low impedance before the ADC - at the
standard 10kSPS rate 10k impedance is low enough, but at higher rates the driving impedance needs to
be proportionally less.

529kSPS is beyond the AVR Arduinos, not even SPI is fast enough. The MAX1139 is I2C and thus cannot
be fast enough for this rate - SPI or parallel are the choices for speed.

Thanks. The test circuit I was running was just wiring Vcc and GND into alterate ADC channels without any resistance. So I can't see how a buffer would help. Of course in the real circuit I will need buffers anyway (individually or as part of a clip detect circuit) so the ADC does not taint the audio signal path.

Maybe I should surrender and go for the 12xOpamp peak detect circuits, a 12 channel I2C DAC and sample at a much lower rate, allowing the peak detect to do the hard work.

I just thought that using 1xExternal DAC + WS2811s I would save on a lot of ICs and support passives for the project. This doesn't look possible though.

I could invest time in learning a more powerful STM or PIC uC with a much faster DAC, but I don't fancy that approach either.

If you sample less frequently you'll get the audio spectrum aliased on top of itself to a lower bandwidth.

This might be fine for measuring signal level, although you'd not be as precise due to the missing infromation.

MarkT:
If you sample less frequently you'll get the audio spectrum aliased on top of itself to a lower bandwidth.

This might be fine for measuring signal level, although you'd not be as precise due to the missing infromation.

The ideal is to put a peak detector circuit on the channels. Basically an opamp, diode and a capacitor, so the capacitor charges to match the highest voltage peak of the waves and discharges much more slowly, although we are talking about discharging within a few milliseconds.

So rather than having to sample at full 44Khz to find the peak of the wave, you just sample the capacitor at a much lower rate like 1Khz or even the display update rate.

From oscilloscope tests it works rather well, the tricky part is matching the capacitor and any parallel discharge resistor to the impedance of the ADC. I found the AVR ADC pulled the capacitor down rapidly, so I had to remove the parallel discharge resistor completely.

An arduino DUE has 12 builtin ADC channels (12-bit ADC) and because the maximum sampling rate is 1 Msps, you can sample 12 channels at 83KHz each, well above the 44KHz target. There is a window feature to detect a certain voltage level and, eventually, trigger an interrupt.

Do you want the peaks? Or RMS or average? For digital recording you generally want the peaks. For "loudness" you generally want RMS or average or possibly A-weighting or EBU R128 analysis, etc.

It's not only crosstalk. The ATmega datasheet says you loose resolution above 15kHz which means you can only sample the signal/audio (accurately) to 7.5kHz (Nyquist sampling theory). With stereo you're down to 3250Hz and with 12 channels you're essentially just occasionally/random sampling the signal.

Most of the energy in real-world audio is in the mid & lower frequencies so you don't always need the highest audio frequencies, but you are going to loose some accuracy with slower sample rates.

Random "slow" sampling will still give you a reasonable indication of level/loudness if that's all you need but you might miss some peaks, and you will need to do some smoothing/averaging (as you would normally do).

I'm not sure about the processing... Calculation 12 averages or 12 RMS values is probably going to chew-up enough time to slow you down even further. Even "finding" the peak is gong to chew-up some processing time (and memory).

I've used peak detectors on my sound activated lighting and it works great! One of my effects is a "giant VU meter", but it's just an effect. It's "calibrated" based on the peak & average values stored in a circular buffer and so it's not calibrated in dB or anything meaningful...

I'm sampling the peak-detector output at about 10Hz which leaves me plenty of time for processing.

You'd need 3 quad op-amps* and the resistors & diodes. I'm not sure if my peak detector is fast-enough to capture a 20kHz peak (it's not important for my application). That depends on the capacitor value and the ability of the op-amp to charge the capacitor.

Oh.. The other complication is if you want accuracy down to zero-volts your op-amp needs bipolar power supplies.

  • That's for a positive peak-detector that ignores the negative-half of the waveform.

From oscilloscope tests it works rather well, the tricky part is matching the capacitor and any parallel discharge resistor to the impedance of the ADC. I found the AVR ADC pulled the capacitor down rapidly, so I had to remove the parallel discharge resistor completely.

It's simply an RC time constant. If the circuit is working correctly you need the resistor. The ADC input impedance/resistance is approximately 100 megohms (probably the same ballpark as a 'scope probe) but it's not necessarily a "resistor to ground" and it can't be counted-on to discharge the capacitor. An electrolytic capacitor will probably have enough leakage resistance to eventually discharge but I wouldn't count on it.

The charge-time depends on the effective output impedance of the op-amp, and the capacitor. If the capacitor is too big you might draw too much current and damage the op-amp.

The ADC inputs cross-talk via the capacitance of the ADC input, about 8pF, which gets switched around
and thus dumps charge between inputs (only noticeable for high impedance inputs). There is basically
no DC leakage (that 100M is a worst case figure at full temperature range of the chip, typically its way
higher).

You shouldn't put a large capacitor directly on the output of an opamp (unless the datasheet allows it),
as stability could be lost and it oscillates.