[sdiy] DECISION TIME: need a Ucontroller/ARM/DSP chip that will process audio

Olivier Gillet ol.gillet at gmail.com
Sun Mar 4 04:33:15 CET 2012


> 1. 10 bit adc

3 of which are rubbish if you don't take extra care. Check the
datasheet - if you want high quality conversions you need to put the
chip to sleep during conversions to avoid noise from the other
peripherals - or at least make sure you don't toggle GPIOs while a
conversion is taking place. Proper decoupling + use of a dedicated
external voltage reference can also help!

Or go with an external ADC or codec.

> 2. 8 bit dac which means errors converting floats to 0-255

Which 8-bit DAC are you using? You mention floats. Don't use them for
anything, they are emulated so incredibly slow. This applies to many
of the MCUs used here, even PICs, STM / LPC - no floating point unit
so only operations on integer types are efficient!

> I do know that chips like the pt2399 require serious input filtering....maybe i need to implement that on the avr as well

Which sample rate are you working at? To avoid aliasing problems, a
filter attenuating all frequencies above half the sample rate should
be present on the input.

Also check for clock jitter - writing to the DAC at unequal time
intervals makes everything sound ugly. On ATMegas the right way of
structuring audio output is to have a timer ISR and write samples from
there (generated in situ or pulled from a FIFO). You'll have to put
the code doing the write to the DAC at the very beginning of the ISR
to make sure that the code path from the beginning of the ISR to the
actual write to the DAC always executes in the same amount of time.
That's where the issue of "predictable" timing discussed in earlier
posts can arise...

In some older post you mentioned doing stuff in the main code loop:

void loop () {
  // Read some inputs
  // Write a sample
}

Don't do that, you won't get a regular sample clock!

Don't use arduino's analogRead (it's blocking!). Learn how the ADC
work on the ATMega, how to configure it...

First thing to do would be to have a simple "pass-through" project -
just take the input and write it to the output, as cleanly and
accurately as possible. Once you get that right, move to effects.
Don't get distracted by anything unless you don't get this basic thing
right.

Olivier



More information about the Synth-diy mailing list