Playing RAW/WAV from SD Card via I2S

Status
Not open for further replies.

weeky

Member
Hi,
I'm new on this forum and quite new in the topic of teensy. For a small project I need to be able to play some short sound files. I used a WTV020 board in combination with a simple 2.5 Watt Mono Amp from Adafruit and it worked...okay. The sound module does not work that great and I get a lot of click and pop and some annoying beep noises produced by the sound module.

Now I want to take this project a step further and need the power of a teensy and I thought I might as well use it's capability to output I2S sound. Unfortunately the enclosure is not big enough for the Audio Adaptor. So my question is:

Can I use the simple SD Card Adaptor for the Teensy, read the sound files and output them via I2S to an Adafruit MAX98357A I2S Amplifier? Will this reduce the produced noise (no ground loops)? Or will it be better to use a Teensy Prop Shield in combination with the SD Card Adaptor and Output the sound via it's internal amplifier (then I could use the flash memory for short sounds which need to be played immediately?)?

Best Regards
 
Hi,
I'm new on this forum and quite new in the topic of teensy. For a small project I need to be able to play some short sound files. I used a WTV020 board in combination with a simple 2.5 Watt Mono Amp from Adafruit and it worked...okay. The sound module does not work that great and I get a lot of click and pop and some annoying beep noises produced by the sound module.

Now I want to take this project a step further and need the power of a teensy and I thought I might as well use it's capability to output I2S sound. Unfortunately the enclosure is not big enough for the Audio Adaptor. So my question is:

Can I use the simple SD Card Adaptor for the Teensy, read the sound files and output them via I2S to an Adafruit MAX98357A I2S Amplifier? Will this reduce the produced noise (no ground loops)? Or will it be better to use a Teensy Prop Shield in combination with the SD Card Adaptor and Output the sound via it's internal amplifier (then I could use the flash memory for short sounds which need to be played immediately?)?

Best Regards

I just ordered this board. Let's see if we can bring it to work. Worst case we have to adjust some things in I2S output :)
 
A question, what are these soundfiles, how long are they (in seconds) ?
If they are very short, it might be possible to convert them to AAC (which makes them even smaller) and store them in the teensy-flash..?
 
Some of them are bigger (200-300kByte), some of them smaller, but they are a few. So I don't think storing them in the flash would work.
 
Don't under-estimate the compression of aac.. :) and since that board is mono, reducing them to one channel helps even more.
 
But , of course, the prop-shield will work , too. you can store the sounds in the prop-shield flash - which means you don't need the sd-card.
 
Well, that might work for a few I guess. But I'm planning to extend that project, so I guess I will need the storage space of a SD card. But just for clarity, in theory playing raw or wav from a sd card to output them on the teensy in I2S format to an external device works, and is not a unique feature of the audio adaptor?
 
No, no unique feature of the audio adaptor.
But, maybe, we have to adjust the output-I2S-format a bit. There is no "standard" I2S, and some chips need adjustments.
At a first glance (took a quick look to the datasheet), we might have luck and it works out of the box. maybe.
 
Note, I suspect the prop shield may have problems with i2s.

As I read the pin layouts, i2s uses pin 9 for BCLK, pin 11 for MCLK, pin 13 for RXD0, pin 22/A8 for TXD0, pin 23/A9 for LCRLK.

The audio shield which uses i2s, has to use the alternate pin 7 for SPI MOSI (normally pin 11) and alternate pin 14 for SPI SCLK (normally pin 13). I don't believe that i2s has alternate pins for the Teensy 3.1/3.2.

The prop shield does not allow the use of the alternate SPI pins, and uses pin 7 for LED enable.

The forthcoming Teensy 3.5/3.6 will have other alternate pins for i2s.
 
Well, that's not too bad, I guess I have to use a sd card anyway. Frank I'm very interested in your project using the same hardware as I'm planning to use. Glad to hear that it is no unique feature of the adio adaptor. Just out of curiosity, the way I understood is that the teensy sends the audio via I2S to the audio adaptor which processes it? So I could theoretically simply take the signal on the I2S pins and process them in the external device e.g. a digital amplifier? But the audio adaptor does not fit anyway.
 
My Adafruit MAX98357A arrives tomorrow (hopefully: I'll be not @home..)
I'll test it as soon I have it.
 
My Adafruit MAX98357A arrives tomorrow (hopefully: I'll be not @home..)
I'll test it as soon I have it.

Ok...that was boring...no fun...

It workes out of the box, flawlessly, and without any problems...:D
 
Last edited:
Frank,
I just received my new T3.5 and T3.6 and I am ready to start diving into I2S audio for the first time. I have the same Adafruit MAX98357A breakout sitting here that I would like to try.
1) Do you think my Picoscope2203 (analog bandwidth = 5MHz max) is up to the task of I2S debugging? What bandwidth scope do you use?
2) I am looking at the PJRC audio library gui (http://www.pjrc.com/teensy/gui) and I notice that the control section does not include the MAX98357A. Do you use the GUI? Did you get the MAX98357A working with some other example code?

I hope to run through Paul's audio workshop this weekend:
https://hackaday.io/project/8292-microcontroller-audio-workshop-had-supercon-2015

Thanks!
frenchy (Steve French)
www.voltvision.com
 
Frank,
I just received my new T3.5 and T3.6 and I am ready to start diving into I2S audio for the first time. I have the same Adafruit MAX98357A breakout sitting here that I would like to try.
1) Do you think my Picoscope2203 (analog bandwidth = 5MHz max) is up to the task of I2S debugging? What bandwidth scope do you use?
2) I am looking at the PJRC audio library gui (http://www.pjrc.com/teensy/gui) and I notice that the control section does not include the MAX98357A. Do you use the GUI? Did you get the MAX98357A working with some other example code?

I hope to run through Paul's audio workshop this weekend:
https://hackaday.io/project/8292-microcontroller-audio-workshop-had-supercon-2015

Thanks!
frenchy (Steve French)
www.voltvision.com


Hi, Steve,

1) 5MHz is way too slow. The clock signal is more than double speed.. i guess you need minimum 25MHz, better more. I don't own a scope, and use a Salae Logic Analyzer (100MHz) instead.
But, good news: No need to debug anything these days.. I2S "just works" :)

Edit: for <=192MHz !. My Teensy 3.6 has problems with I2S on higher overclocking.

2) Yes, use the Audio-Library and simply add the I2S-Object (but not the SGTL5000 control). That's all to do.

Have fun :)
Frank
 
Last edited:
Status
Not open for further replies.
Back
Top