How To Use an Audio ADC

Hey guys,

I am attempting to convert an analog audio signal from an iPod or other music device into a digital signal that can easily be transmitted across a distance by some form of emitter (whether it be light, radio, etc). However, I do not know how to use an of the ADC IC's. I've been trying to come up with a way to do it without an IC, but I figured it's better not to reinvent the wheel unless I have to.

So, that being said, does anyone have any general advice on which Audio ADC IC's to use and how to go about using them?

Thanks, Tyler

What bandwidth? The arduino has an ADC built in.

@KeithRB: Thanks for such a quick response. I want as nice of a signal as I can get. I would be very happy with 48kHz. Would it be able to do that?

The arduino has an ADC built in.

I guess that would make a lot of sense since it has analog/digital pins. Haha.

No, maybe about 1-2 kHz.

You need a lot more power than an arduino can handle, maybe a due would work a bit better.

The Due certainly can sample its ADC much faster, less than 2us I think now.

It also has a lot more RAM to store samples. However it will affect the choice of transmitting hardware - partly because its 3.3V rather than 5V, and because not all libraries work with it yet - it is officially still in beta.

The Due also should be able to interface to I2S ADCs and DACs via its synchronous serial interface, although I've not tried this in earnest yet.

The Due also should be able to interface to I2S ADCs and DACs via its synchronous serial interface,

Yep, the SSC is on pins A14,15,16 and B17,18,19 and these are broken out to the headers. So it should be possible to to hook up a nice codec or similar IC.


Rob

So, knowing that I can’t get a high quality sound out of the Uno’s built in ADC, you guys are suggesting a Due. How can I figure out the sampling rate of this board?

In the documentation of the analog commands it says: “It takes about 100 microseconds (0.0001 s) to read an analog input, so the maximum reading rate is about 10,000 times a second.” Does this mean that 10kHz is the max any board in Arduino is going to get?

MarkT: The Due certainly can sample its ADC much faster, less than 2us I think now.

So can the Uno, or any AVR chip...

But you wouldn't want to. Neither of them has an audio-quality ADC.

Trying to do it with Arduinos will only end in disappointment (IMHO). The best way to do this would be to hack a pair of wireless headphones or something like that (assuming you want to listen to the sound at the other end, which you don't say...)

The Teensy 3.1 has a 16 bit ADC, good to ENOB of 13 bits. Definitely good enough for audio. Teensy 3.1 now includes a DAC, so you could use one on each end. It uses the ARM Cortex 4 (the Due uses ARM Cortex 3) at 72MHz, overclockable to 96MHz.

https://www.pjrc.com/teensy/teensy31.html

https://www.pjrc.com/teensy/adc.html

You don't really need 48ksps sample speed for a pair of headphones. But the Teensy 3.1's ADC can do it, the conversion time is much faster than required.

For the receiving side, you can either use analogWrite() out and filter it, as it is PWM, or break the single 12 bit DAC into two outputs for stereo.

The Teensy 3.1 has a 16 bit ADC, good to ENOB of 13 bits. Definitely good enough for audio.

Could be I'm missing something, but there is info out of DS:

31.4.5.6.2 Long conversion time configuration A configuration for long ADC conversion is: • 16-bit Differential mode with the bus clock selected as the input clock source • The input clock divide-by-8 ratio selected • Bus frequency of 8 MHz • Long sample time enabled • Configured for longest adder • High-speed conversion disabled • Average enabled for 32 conversions The resulting conversion time is generated using the parameters listed in the preceding table. Therefore, for bus clock equal to 8 MHz and ADCK equal to 1 MHz, the resulting conversion time is 57.625 ?s, that is, AverageNum. This results in a total conversion time of 1.844 ms

http://www.pjrc.com/teensy/K20P64M72SF1RM.pdf

Yes, there is 16-bits ADC, only it's good for 500 Hz sampling rate. To go faster, you have to switch to 10-bits or 8-bits mode.

I don’t really want to have the resulting audio go into headphones. I would like to come out of a speaker. Preferably two or more speakers for a stereo rather than mono effect.

So, the Arduino won’t do it. I’m not quite sure whether or not the Teensy 3.1 would do it. What are my other options. Should I simply not try to go that high? I would like to be able to use these as nice computer speakers or for my TV; would 48kHz just be overkill?

Thoughts?

You aren't mastering a recording. Remember CrO2 cassette tapes? With Dolby? 16kHz max bandwidth. Regular tape with Dolby, more like 12kHz. Most people think they can hear up to 20kHz. Maybe if you are a baby with good hearing.

I could hear the 15.75kHz noise from a CRT TV flyback. Very few people around me could hear it.

With all the compression and normalization in modern music, you'd be hard pressed to tell the difference between 8 bits and 16 bits.

I'm just saying, don't go crazy with the specs you want.

Hmmm... yeah that makes sense. Well, if its not worth it to get so high then why are all CDs done at 44.1kHz and whatnot. Haha. What is their reason for it?

You need arduino DUE, it has no issue with sampling 48 / 96 ksps, two channel or all 12 channel simultaneously. So it's only 12-bit resolution. To have a real HiFi, you need to wire up external ADC to DUE via I2S (SSC). Sparkfun has PCM1803 board, 24-bits stereo , 48/64/96 ksps programmable. I make one working at my test-bench. Other options 'd be WM8731 or big line of products from CS, CS5331 etc.

Tresky: Hmmm... yeah that makes sense. Well, if its not worth it to get so high then why are all CDs done at 44.1kHz and whatnot. Haha. What is their reason for it?

Harmonics.

http://www.youtube.com/watch?v=cIQ9IXSUzuM&feature=share&list=FL3l6MouugID_cbT3Ua8gfmQ

http://youtu.be/Zvireu2SGZM

polymorph: With all the compression and normalization in modern music, you'd be hard pressed to tell the difference between 8 bits and 16 bits.

8 bit has easily heard artifacts, well above perception thresholds. 12 bit is getting more like it for reasonable quality.

Also 8 bit has a noise level comparable to cassette tape.

Also 8 bit has a noise level comparable to cassette tape.

True, but people listened to cassette tapes for years. Do the same thing both FM radio and Dolby does to reduce hiss - preemphasis on highs before capture, deemphasis after the DAC or PWM takes it back to analog.

The Teensy 3.x is 16bit/13ENOB, in any case. The PWM and DAC are high enough bits.