Need suggestions about dual I2S output & control

ScubaBearLA

New member
Hi everybody--

I've got a project where i need to switch between two prerecorded stereo audio tracks playing simultaneously, like a "with" and "without" experience. I'm trying to wrap my head around how to approach this...

My thought is this: Teensy 3.X reads audio file(s) from memory or SD card when "play" button is pressed.


  • Should I play two stereo files simultaneously, and toggle which I2S stream goes to my DAC?

  • Or could I play a four-channel file somehow and toggle which pair of that stream is output?

Any suggestions and hardware recommendations to build this demonstrator device are welcome!

Thanks--

--Alan
 
Based on using my improved SD playback library (see https://forum.pjrc.com/threads/70963-Yet-Another-File-Player-(and-recorder)) … caveat, it’s untested on a Teensy 3.x … you could use either 2x stereo (2x AudioPlayWAVstereo objects) or 1x quad (AudioPlayWAVquad object) along with suitable files. For stereo files you’d want to use cueSD() to cue up the files, then play() to start them in perfect sync. Either way, use 4x AudioEffectFade objects to do a fast cross-fade between with and without, so you don’t get a click. Mix the 4 AudioEffectFade outputs using 2 AudioMixer4 objects to your I2S output.

Sorry, can’t do an image from the Design Tool, or code, not at PC now or for a while…
 
Based on using my improved SD playback library (see https://forum.pjrc.com/threads/70963-Yet-Another-File-Player-(and-recorder)) … caveat, it’s untested on a Teensy 3.x … you could use either 2x stereo (2x AudioPlayWAVstereo objects) or 1x quad (AudioPlayWAVquad object) along with suitable files. For stereo files you’d want to use cueSD() to cue up the files, then play() to start them in perfect sync. Either way, use 4x AudioEffectFade objects to do a fast cross-fade between with and without, so you don’t get a click. Mix the 4 AudioEffectFade outputs using 2 AudioMixer4 objects to your I2S output.

Sorry, can’t do an image from the Design Tool, or code, not at PC now or for a while…

Thank you for that suggestion, sounds like a perfect way to go! I can see I have a big learning curve ahead of me though... what hardware do you suggest I start with? Right now I know for sure I have a Teensy 3.2 and a Teensy_3 audio board. Would it be difficult or impossible to use these? If so, what should I buy instead? I'm trying to keep this solution low cost, but I'd also like my development to go as smoothly as possible!

Thanks--

--Alan
 
Sounds like you have the right hardware to make a start, at least. I’d suggest not jumping straight in to SD card playback; either follow the audio tutorial on the PJRC website or look at the many audio examples packaged with Teensyduino. Then do a simple piece of code playing different tones and switching between them. Lastly install my updated library and try the SD stuff.

If you need to upgrade hardware, Teensy 4.x is your only real option at the moment, due to supply chain issues. Teensy 4.1 is a bit more expensive but gives you a faster SD card slot; you’d also need a matching audio adaptor, as the pin out is different.
 
Back
Top