Audio Experiences

I'm currently doing some proof-of-concept and throughput tests with the mbed.

Don't forget that audio is +/- voltage. It sounds wrong if half of the audio is missing. :) Offset the input with an op-amp. Just divide 3.3v by half and use an inverting amp. Decouple the input with a cap in series.

Also, do analog pre-scaling, or pre-amplification, to get the waveform to fit nicely into the 3.3v envelope. The clipping indicator is useful for this, I'm just using trimpots. You can use the same offset amplifier as the preamplifier.

Output is weak. Use another op-amp. (At this point just get a quad op-amp. LM324 or LMC660 are both working fine.)

Use the ticker class to keep the sampling consistent. Otherwise there's strange noise if you're doing other things in the Main loop. In particular, serial communications, which are almost unpredictable in how much delay they'll add. Running ticker at different speeds just changes the frequency of the high-frequency output.

So far, it has been pretty easy to pump line-level audio into the analogIn and back out the analogOut.

There's lots of very high-freqency noise that will have to be filtered out analogly.

On my mBed, analogIn and analalogOut are not in the same scale. AnalogIn is really a 12-bit number, analogOut is 16 bit. Or so the datasheets say? In reality, the scales are the same. Input goes to 65535, so does the output.

Where are these blips of >70000 coming from? They seem to happen at any amplitude, at any time. Crackling the output.

Next I hope to take WavePlayer and reverse it. Or start adding audio effects, delays, reverb, pitch shift, etc. Maybe Autotune. :)

A useful tool is to turn on LED1 if the audio input is > 50000. It's my clipping indicator!

I have about 4 seconds or memory for 8kHz sampling. I won't need the full 4 seconds for most effects.

Why am I missing bass? Is it my DC blocking caps?

Waveforms are easily and very prettily plotted in excel line graphs by streaming the bytes out to Hyperterminal and logging them. GREAT FOR DEBUGGING! (You can easily see the range of input voltage and any distortion, clipping, not enough signal, noisy blips, etc.)


2 comments

11 Jan 2011

Maybe the blips are due to a ground loop?

 

 

11 Jan 2011

The missing bass may come from the small value of DC blocking caps. Try 22uF/16v, 47uF/16v or even 100uF. Also try to put bigger resistors.

Reliable input values for AnalogIn are only 2048 (12bits) - the sample of the input ( AnalogIn) is represented ( incapsulated ) in 2 bytes (16bits). I guess that from 0xABCD ( 16 bit ) the significant bytes are A,B and C. So it make sense to consider input as 0x0ABC as a value from 12 bit ADC.

For an audio sistem consider using different grounds for digital and analog or at least keep them separated until one point.

You need to log in to post a comment