Audio For Teensy3 - What Features Would You Want?

Status
Not open for further replies.
Is the discussion here also about the audio libraries? For playing files out of SD card to I2S (and taking the master clock externally) there is no need for a separate board.

There IS need for an external board to do such things, as you obviously need, to say the least:

1)An SD card slot to be attached to the Teensy;
2)An I2S-compatible chip, such as the WM8731 codec from Wolson that will probably be on the board Paul is working on.
2bis)Theorically, the master clock for the Teensy and for an I2S device could be taken from a dedicated chip.

Needless to say that both of this come in SMD-only packages, and an I2S chip in particular may necessitate some passive external components. Unless you want to solder jumper wires from those tiny SMD pads to a breadboard, which is fine if you have the ability and the patiency to do such work, an external board is the only way to go.
 

That's a tiny board, maybe too tiny after all. Anyway, for adding memory also consider MRAM of FRAM nv SPI RAM's, might be already fitting the layout.
Everspin MR20H40 is the MRAM variant with 512kx8 (512 kbytes) chip which could be used as RAM or EEPROM or whatever, so for you could implement for example digital delay or reverb, or store few seconds of audio (depending on sample rate). Add another chip and double the RAM.
http://www.everspin.com/PDF/EST_MR2xH40_prod.pdf
http://de.mouser.com/ProductDetail/...25H40CDC/?qs=sGAEpiMZZMsSm7LhMeloEPcGBwqnPuOP



Considering the bad quality of the generated MCLK then maybe it would be best to use a DAC with a PLL and a MCLK output. That is CS4350 by Cirrus which can sync to LRCLK input only, and can be used with simple passive single-ended output filter:
http://www.cirrus.com/en/products/cs4350.html
http://de.mouser.com/Search/ProductDetail.aspx?qs=bUPhaerQQeHZRk%2buErHRaQ==

Now you need extra ADC chip, there is the PCM1803A from TI which offers >100 dB SNR and is easy to use (no need for input buffer opamps either though guess all A/D's should be driven from low impedance source anyway):
http://de.mouser.com/Search/ProductDetail.aspx?qs=bUPhaerQQeHZRk%2buErHRaQ==
http://www.ti.com/lit/ds/sles142a/sles142a.pdf

Obviously those parts will cost more that a single cheap CODEC but then you would get much better SQ.



http://www.everspin.com/PDF/EST_MR2xH40_prod.pdf
 
Everspin MR20H40 is the MRAM variant with 512kx8 (512 kbytes)

I just looked it up and saw $15 for small quantity and $11 in volume!! Is that right?

Looks like the "small flag" part could be soldered onto the pads I put on the bottom side of the PCB.


Obviously those parts will cost more that a single cheap CODEC but then you would get much better SQ.

The first board is definitely going to be use the SGTL5000 codec. Its ADC is only in the 80 dB SNR & -70 db THD+N range. I've spent quite a bit of time listening to it. If you feed input to output with a lot of gain, of course you can amplify that tiny noise. But it really is very small when set at a gain reasonable for any real input signals.

The DAC also isn't going to win any audiophile awards (100 dB SNR and -80 dB THD+N), but it does sound as good as any portable CD player. The noise is very small.


Maybe sometime next year I'll make an "audiophile" board. Or maybe someone else will do it? There are a LOT of these high-end ADC and DAC chips on the market. Once the library is published, the really tough software side will be done (other than making MCLK an input).
 
I just looked it up and saw $15 for small quantity and $11 in volume!! Is that right?

Looks like the "small flag" part could be soldered onto the pads I put on the bottom side of the PCB.

looks interesting. but i guess these would have to be reflowed?
 
Just a quick update....

PCBs have been ordered, so the audio shield design is finalized and we're moving into production of the first batch.

Recently I've been working with the audio input side. I added a 256 point FFT object, so there's now something more interesting to actually do with the input audio, rather than just routing it to the output. Yesterday I put together a simple spectrum analyzer example (it'll be in the library's examples) which displays on a normal character LCD using the LiquidCrystal library.

I've been debating setting up a Kickstarter or Indiegogo campaign, to share info and let people sign up early for shields from the first batch. What do you think? Should I do it?
 
Why not ! I'd be glad to be an early adopter, I have a project where I need to light up pianos using ws2811 strips. I'm doing it on a Raspberry pi now with PureData but using the audio shield with FFT would probably reduce costs/complexity a lot !
 
I've been debating setting up a Kickstarter or Indiegogo campaign, to share info and let people sign up early for shields from the first batch. What do you think? Should I do it?

Yes, firstly for promotion or dissemination purposes and also to get payment in advance rather than having to front a large purchase and wait until they all sell.
Bear in mind that kickstarter seems to frown on the "muliples of a product" rewards unless they form part of an obvious set. But groups of items are fine (T3+audio, T3+audio+LCD, T3+audio+LCD+fancy wooden box with your name in lights and VIP status, etc. Or "5.1 surround bundle" with a T3 and three audio to get six channels, etc).

Extra examples or extra library additions can be stretch goals (the APNG library which I backed did that).
 
Maybe sometime next year I'll make an "audiophile" board. Or maybe someone else will do it? There are a LOT of these high-end ADC and DAC chips on the market. Once the library is published, the really tough software side will be done (other than making MCLK an input).

There are plenty of DAC's and ADC's but without a proper MCLK output or an external PLL it's not worth using them anyway. Also there are a little bit better codecs like AK4556 which might also be reasonable choice for CODEC. Teensy 3.0's Cortex-M4 chip also supports multichannel audio output (DSP/TDM format) so a DAC like PCM1691 should work fine there for applications like digital crossover for multiway speakers.

Regarding MCLK input can't you just sync to external LRCLK and/or SCLK (BCLK) clocks? MCLK (sometimes called System Clock or SCK) is not part of the core I2S interface specification, it's a signal that's needed only for the oversampling 1-bit (or "few" bit) converters. Teensy controller shoudn't need that for anything. For the best quality clock (less jitter) you should have external clock and use a single ADC or DAC which can be used in master mode to generate the other clocks.
 
I am a bit late to the party, but let me say this will work for my applications.

It should be fine for most audio applications just as it is. And thanks for figuring out that the I2S/PLL only works for 44.1 kHz. It might have been very painful designing to use the PLL at other sample rates and discovering belatedly that it didn't do other sample rates. Masterpiece of engineering, that, a PLL which can be programmed for thousands of possible frequencies, but only works correctly at one. This is sort of what you expect from the consumer audio market.

And this will work for my software designed radio (SDR) application, too. Faster sample rates and more bits per sample are useful in a radio because they translate to wider bandwidth and greater dynamic range, but anything is better than nothing.

When you get to trying the audiophile board, there's a lot of accumulated design experience in the sdr-widget and audio-widget google groups which built usb sound cards using the Atmel AT32UC3A3 targeting the best possible performance. The SDR version is full duplex, 48/96/192kHz, 24b/s, stereo using an AD5394A ADC and a CS4344 DAC. The Audio version has used a variety of DACs and power supplies and oscillators in a quest for something most of us cannot hear. The higher sample rates require a USB 2.0 audio driver (UAC2) on the host side, something Microsoft has not yet bothered to do, so they only work on Linux and MacOS. (There may be a work-around for this, there was certainly a lot of effort to make one.) And note that there are several ADCs that appear to be as good as the AK5394A until you look at the noise spectrum at high sample rates.

-- rec --
 
Teensy3 creates a pretty good MCLK for 44.1 kHz.

mmh, .. so is the consensus to go with 44.1kHz, if one wanted to keep things compatible with the audio API? i'm getting a bit confused as to the MCLK issue, or how serious it is - earlier in this thread, at least one person reported success when deriving a 12.880 MHz clock from the teensy3 (things "working correctly") but ever since MCLK-from-teensy3 was getting a great deal of bad press. i'm asking as for my next little board i'd like to swap the WM8731, which i've been using so far, for a CS4344; and, if possible, run it in double speed mode/96kHz, in which case i'd have to go with something like I2S0_MDR = I2S_MDR_FRACT(15) | I2S_MDR_DIVIDE(124); -- which doesn't seem to be a good idea, given Paul's measurements a few pages back ("utterly unusable clock waveform")? i guess i could always revert to 44.1, just wondering...
 
That's correct. For MCLK output from Teensy3, use only 44.1 kHz, or 22.05, or 11.025. If you set I2S_MDR_FRACT to anything other than 0 or 1, the MCLK output is terrible.

Sometime next year, after a couple revs of the audio library have filled in more functionality (eg, I've put in a lot more programming time), I'll probably work on MCLK as input, and perhaps an "audiophile" board, and maybe even 24 bit extensions in the library?

One problem with MCLK as an input to Teensy3 is the data stream is no longer synchronous to Teensy3's own clock. The audio library lets you also use an analog input pin as a source, and PWM pins as output. Without the clocks phase locked, mixing those on-chip interfaces with externally clocked I2S will force the streams to resync, which is not done very gracefully. But I believe it should be possible to make a modified copy of the I2S object with external MCLK that works well, as long as you don't also use CPU clocked I/O in the same program. I'm going to work on adding more audio effects and other nice features before looking into that. But maybe after the initial release, someone else will tackle it?
 
That's correct. For MCLK output from Teensy3, use only 44.1 kHz, or 22.05, or 11.025. If you set I2S_MDR_FRACT to anything other than 0 or 1, the MCLK output is terrible.

okay, i see. thanks for clarifying. so perhaps i'll stick to 44.1kHz for the time being but make provisions for adding an external oscillator, just in case. personally, i'm not so much craving for "audiophile" hardware specs (as in crazy decoupling schemes etc), only was hoping to add some dynamic range in my (synthesis) application. (truth is, an experienced DSP person could get way better sounds out of an 8bit DAC than i could get out of $$ hardware, so generally i tend to be more worried about the software side of things)
 
Yes, it is. I've been pretty quiet on this... but work is progressing on all those little mundane details to release a new hardware product.
 
With Teensy 3.1 it almost seems that an external board isn't needed anymore!
Given the Teensy 3.1 only has one DAC (digital to analog) pin, I would imagine you would still want an external board to do stereo (plus it is probably convenient to have an external board for things like voltage protection, 3.5mm connectors, etc.)
 
So far, the only code I've written for the DAC is analogWrite(). But I do plan to support the DAC in the audio library, perhaps not on the first release, but soon...

The DAC can trigger from the PDB, which of course is how I'll support it in the audio library, so it should stream 44.1 kHz sampled audio. The datasheet says the full-scale settling time is 15 us typical, 30 us worst cast, which is just fast enough.

Of course, the DAC is "only" 12 bits without any filtering, and a relatively weak signal that can't directly drive headphones. My intention has always been to support audio with and without the codec board. The library also supports using both ways simultaneously.
 
Many of the now-highly-appreciated first digital synths used 12 bit dacs (and 8-bit samples!) so with care, good results can be obtained with the teensy 3.
I did a quick 16-bit update of an old 8-bit singing voice synth. (SAM) and it sounds a lot better on Teensy 3!
 
Status
Not open for further replies.
Back
Top