The Audio Codec is the Heart: The picture above shows the Tympan audio interface. The heart of the board is the audio codec at the top-center. An audio codec is a highly-integrated chip that, among other duties, does all of the amplification and digitization of the incoming analog audio signals. Choosing the right codec and then properly designing the circuit board around it are both key elements to achieving a low-noise design with maximum dynamic range.
Choosing an Audio Codec: The Teensy Audio Board uses the SGTL5000 audio codec. Presumably it was chosen because it is small, low-cost, low-power, and has a built-in headphone driver. For my Tympan audio interface, I want all these same features, but I also want it to be quieter. After looking at a bunch of options, and after talking with colleagues who have experience with a variety of TI parts, we chose to go with the Texas Instruments TLV320AIC3206 (product page here). It's got many of the same features as the SGTL5000 but promises better audio performance, though at the cost of a few extra bucks per chip. If it gets me the wider dynamic range that I want, I'll be very happy with that trade-off.
Circuit Design: Like with the SGTL5000 on the Teensy Audio Board, the TI 3206 needs both the I2C and I2S buses to communicate with the host processor (the host processor being a Teensy 3.5 or 3.6). Also like the Teensy Audio Board, we will run the TI 3206 in "slave" mode, where all clocking is provided by the host processor. In other words, our connections to the TI 3206 parallel the connections used by the SGTL5000. Therefore, in designing our Tympan circuit, the schematic for the Teensy Audio Board was a great help. Yay for open source! And, to continue the sharing, our own schematic is available on the Tympan GitHub here.
Software Driver: After laying out the PCB and getting it fabricated, we had to write software to allow the Teensy and the TI 3206 to talk to each other. Since I wanted to fit within the Teensy Audio ecosystem, we needed to write a "AudioControl" module that configures the TI 3206 to be in the proper I2S mode so that Teensy's existing I2S functions can successfully transfer audio data to and from the codec. Luckily, I've got a buddy (Brendan, of FlexVolt fame!) who dived in and figured it all out. His Arduino/Teensy compatible "AudioControl" module is now on the Tympan GitHub (h-file is here, cpp file is here). Thanks, Brendan!
Measuring the Self Noise: Once Brendan got the software side of things working [and, in the process, finding errors in the Tympan design -- we erroneously swapped "DIN" and "DOUT" by accident! Oops! The schematic above has been corrected.], I turned my attention to measuring the new system's audio performance. My primary concern was the noise floor of the new hardware. Was it better than the Teensy Audio Board? To find out, I used a raw 3.5 mm stereo plug in the Tympan's input jack and shorted both the left and right inputs to ground. Now, when I start recording, I should only see the Tympan's own self-noise.
Arduino Sketch: Now I need some software to do the actual recording. So, starting from the Arduino sketch used to record the noise for the Teensy Audio Board (here), I swapped it over to use the Tympan audio board instead of the Teensy audio board (new version here). This sketch digitizes the input audio (which has been shorted to ground) and sends the digital samples over USB to be recorded on the PC.
Results, USB Audio: With the inputs shorted on my Tympan board, and with me recording the audio via USB in Audacity (as discussed here), I recorded the self-noise of the Tympan. The spectrum of the self-noise is shown below. It's a pretty flat spectrum, which is always nice to see. The only unexpected feature is the increase in the noise seen at the highest frequencies. What is that?
It's a pretty nice spectrum, except for the bump up at the high frequencies. What's that?!? |
By disconnecting the USB cable and recording the audio via SD card, the bump in the spectrum goes away. Now the self-noise is nice and flat. Excellent. |
Dynamic Range Comparison: Another way to express this same data is to show the dynamic range of the system. The dynamic range is the difference between the max allowed input signal and the system's noise floor. I want as wide a dynamic range as possible, so as to better mimic the human ear. As can be seen below, the Tympan audio board does indeed provide greater dynamic range than the Teensy audio board. Specifically, the Tympan is getting 92.4-94.6 dB of dynamic range (in the 125-8000 Hz band) versus 80-81 dB for the Teensy Audio Board. This is quite an improvement!
Keeping Perspective: While I am very pleased with the performance of the TI 3206 on the Tympan audio board, it's important to remember that the Teensy audio board has some significant advantages in other areas. First, you can go buy your own Teensy Audio Board right now, whereas you can't (yet) get a Tympan. Second, the Teensy Audio Board is remarkably inexpensive. It's hard to see the Tympan board ever being that inexpensive. Yes, PJRC did a fantastic job making a good piece of hardware at a fantastic price. That's for sure.
Next Steps: I'm going to use the Tympan as a platform for open source hearing aid experiments. But, a hearing aid is more than just electronics. So, my next steps are to start adding in other elements like microphones and earphones. And, I have to get back to making audio processing algorithms! That's where the fun really happens!