Shop OBEX P1 Docs P2 Docs Learn Events
Idea: "Autofocus" for P2-ADC for Audio - Does it make sense? — Parallax Forums

Idea: "Autofocus" for P2-ADC for Audio - Does it make sense?

Hi, perhaps someone can have a look over this idea, if it does make sense?

ENOB of the adcs is about 12.4bits, which is not much for audio, so it would be nice, if we could squeeze out more of the adcs, to be able to do some sound processing.

In my last project I am using programmable gain to achieve good signal to noise ratio over a broader range of amplitude levels. In that application this is easily possible, because I can simply repeat the measurement, if the range is not good.

During this project I had the following idea:
Always use 2 (or more, let's assume 2 now) adcs in parallel ( we have got plenty :-) ) using different gain factors. Let's assume Channel A has gain 1 and Channel B has 3.16. So for higher amplitudes Channel B will saturate. So there is a limit, where you must switch between the channels. So there is the next question: It is unlikely, that both adcs will have the same result at this switching level, which would introduce glitches. The idea is therefore to have some blending range, where a weighted average between the two channels is used.
The overall result will be something like a "floating-point-adc".

I do not know, if a saturated adc can recover fast enough?
If this idea is good, it is likely, that the method is already used, perhaps somebody can give me some hints and a link? Often you just have to know the right name to google....

Thanks! Christof

Comments

  • Sounds like a very interesting question to me.

    I do not have a name ready to Google for but I have an idea.
    Weird as it might be and possibly plain stupid but...since, as you said, there are plenty of ADC channels waiting to be used perhaps averaging three (with the proper weights, of course) of them - two with gain 1 and one with gain 3.16 - could be a solution ?
    This way you could always have one additional unity gain channel to pick up samples fast while the saturated channel could recover in a more relaxed time constrain ?
    It will not be trivial to use that idea, if it's feasible at all, but certainly doable by a skilled Forther like yourself. Surely and sadly, not within reach with my current TAQOZ skills.
    How many channels do you need (are there enough) ?

  • evanhevanh Posts: 16,027

    What has been tried already, with positive results, is averaging two linked channels. Using same gain on both channels.

  • cgraceycgracey Posts: 14,206

    Maybe it would be good to use capacitors in series for the higher-than-1x-gain ADC pins. These would form high-pass filters that could keep the ADCs from saturating with over- or under-voltage. You would then have to do some integration of the conversions to create final samples.

  • @cgracey said:
    Maybe it would be good to use capacitors in series for the higher-than-1x-gain ADC pins. These would form high-pass filters that could keep the ADCs from saturating with over- or under-voltage. You would then have to do some integration of the conversions to create final samples.

    That sounds like pre-emphasis. It is a good technique to reduce noise is some situations. I don't know if a P2 pin is one of those. It depends whether the SNR decreases at higher frequencies.

    The critical issue with this idea is "how often to switch between pins?" I don't think it should switch from 1x to high gain instantaneously every cycle. That would create crossover distortion like a class B amplifier. Smoothly transitioning every cycle would add non-linearity. Either of these effects might add enough to the total harmonic distortion it might not be worth the noise reduction. Note that any mismatch in DC offset or gain between the ADCs will increase the distortion. The DC offset should be fixable with a software high pass filter.

    If I was doing this I would decrease the gain immediately and increase it if the high gain pin would not have clipped in the last 1/20 second. I think the ADCs can recover from saturation almost instantly. The 1/20 sec would be ages. By switching ADCs infrequenly, mismatches in offset and gain should be less noticeable.

    The term "autofocus" would be well suited for a feedback type system. Suppose the audio input and a DAC pin were summed together and the output fed to the ADC. The DAC would be driven to hold the sum close to Vcc/2. It would be possible to use high gain ADC all the time. This setup would need to be oversampled and would have slew rate limitations.

  • evanhevanh Posts: 16,027

    Oooh, going very high-pass like that, and adding tracking, converts the singular ADC frontend from first-order into second-order! I think.

    For small deviations, the R-C curve looks mostly linear. Which means the first accumulator in the smartpin can be the integrator. So, in effect, a Sinc2 becomes Sinc1 and Sinc3 becomes Sinc2. Or is it the other way round and a Sinc1 becomes Sinc2 in effect ...?

  • evanhevanh Posts: 16,027

    That's cool anyway, because software decides on the number of diff'ing stages to match up.

  • @cgracey said:
    Maybe it would be good to use capacitors in series for the higher-than-1x-gain ADC pins. These would form high-pass filters that could keep the ADCs from saturating with over- or under-voltage. You would then have to do some integration of the conversions to create final samples.

    Thanks, Chip, I think I understood this. The charge of the capacitor used to integrate will "run away".

Sign In or Register to comment.