Vague Question About Project Use and Ability - Teensy 4.1, Micro SD Card, I2S Multiple Audio Formats

HopWorks

Active member
Hi All, I've been away for a very long time. I first posted here in 2013 concerning the Teensy 3.0.
I have a few Teensy 4.1 boards now, and after working with the Pico (and the W, 2, 2w) and the ESP32-S3 N32R8 WROOM 2, I have had some success with my current project. But after hitting yet another brick wall, I thought maybe it is time to bring one of my Teensy 4.1's out of its static wrap and see what it can do with my project.
I wanted to post here my needs to see if someone that is experienced would think it is possible and how easily it could be accomplished. I do not need to be taught how, but maybe some references to reading would be helpful. I just wanted to ask before I start yet another fork off the highway down scary dark dirt roads and down deep rabbit holes with no solution.
My project uses multi MCU boards and a bit complex, but for this function/portion, I want to use a platform to handle reading audio files from a micro SD card (32gb) through a SPI sd card module, and send audio out using I2S to a decoder, then feed a stereo 3w amp module to two tiny speakers. I will use other MCU boards to handle visual interaction... RGB lighting, TFT displays, interaction using buttons, and the WiFi connection. So my Teensy 4.1 will need to be able to handle two SPI connections because one of those SPI ports ties all my other MCU's together for communications. The other SPI of course is for the micro SD card.
For audio file formats, I am undecided on a format yet. I need an audio container protocol/codec that can either have a timing track included or metadata per frame. I still have research to do on what will be the best to use. I have DAW and other audio software that I can place additional data tracks or embedded metadata so that is a bit later.
I have numerous boards and devices I could just build a MP3 player with, but my project needs a bit more from the audio playback, like I mentioned, timing for other features to go in-sync with the audio.
It's not a commercial device I am prototyping, but rather a super cool glass-enclosed decorative feature for my wife to show her how much I love her. And I want to throw in as many bells and whistles that I can. A TFT to show images, another to show lyrics with the audio, addressable RGBW to handle lighting, to show off the custom 3D-printed and etched-in-crystal props that make up the display. She's an incredible person that would just be floored by it.
Anyway, I have been out of the Teensy loop for a long time and just wondered if my highly-regarded 4.1 versions would be up to the audio task.
I apologize for the vague request, just wanted to know if it is possible. If so, I'll take that dirt road off the highway and try my luck. Otherwise, I'll have to work it out with my ESP32-S3-N32R8V and go that route.
I sincerely appreciate your time reading this, and excited on what responses I may get. Have a great week!
Hop
 
@HopWorks: Since you are planning to make use of the T4.1, you might want to use the T4.1's onboard microSD socket in place of adding an external SD card reader. The onboard interface should be much faster & would have the additional benefit of not tying up an additional SPI interface. Reading from the microSD & generating sound at the same time can have some unique timing challenges, but there are a number of posts here on this forum where doing so has been successfully implemented and/or demonstrated.

Good luck & have fun !!

Mark J Culross
KD5RXT
 
Take a look at https://forum.pjrc.com/index.php?threads/yet-another-file-player-and-recorder.70963/ and https://forum.pjrc.com/index.php?th...samples-teensyvariableplayback-library.67613/

Both are restricted to 16-bit 44.1kHz WAV files, but they cope with up to 8 channels so you could add tracks with timing data. To extract that data during playback, take a look at AudioRecordQueue, which can be used to pass audio data into your application in real time.

Should be very doable, but there is a bit of a learning curve :)
 
@HopWorks: Since you are planning to make use of the T4.1, you might want to use the T4.1's onboard microSD socket in place of adding an external SD card reader
I have to look at them again, because I do not remember a card reader on the board, but I do remember the 4.1 version. Sure enough, there is one WOW! I bought these both in 2022 back when they were a bit cheaper at $27 US. I never opened the packages though. Thanks for the heads up! Had I remembered they had their own card reader and about what you said with the on board interface being faster, I would have targeted these and been a week into it already.
Thanks for the reply and info!!

PXL_20250306_125204108.RAW-01.COVER_s1.jpg
 
Last edited:
Take a look at https://forum.pjrc.com/index.php?threads/yet-another-file-player-and-recorder.70963/ and https://forum.pjrc.com/index.php?th...samples-teensyvariableplayback-library.67613/

Both are restricted to 16-bit 44.1kHz WAV files, but they cope with up to 8 channels so you could add tracks with timing data. To extract that data during playback, take a look at AudioRecordQueue, which can be used to pass audio data into your application in real time.

Should be very doable, but there is a bit of a learning curve :)
I do not mind the learning curve at all. But until I retire, I have a large chunk of my week consumed by working. So I just did not want to go chasing my tail again if there was no hope at the end of the dance. For example, with the ESP32-S3-DevKitC-1 N32R8V WROOM2, everything was moving along nicely until I ran into an issue with SD card libraries. No slam on the ESP32 at all, and a number of people I have read got something similar working nicely. I am not sure my attempt with Teensy will be any faster or easier at all. I just like the foot print, the power, and I remembered it had an FPU so DSP was a possibility. It's a rather impressive board if I can remember how to program it. I am not overly fond of Arduino IDE. Maybe PlatformIO will work with it. Looks like I will be doing a bit of reading to catch up.
Thanks for the fast reply and info, I appreciate it!
 
I am not overly fond of Arduino IDE. Maybe PlatformIO will work with it.
Have a look at VisualMicro. It works with Visual Studio and also offers The plug-in allows you to use breakpoints for step-by-step execution, monitor execution time between breakpoints, and set conditional breakpoints based on data or hit count.
I wouldn't be without it.
 
Have a look at VisualMicro. It works with Visual Studio and also offers The plug-in allows you to use breakpoints for step-by-step execution, monitor execution time between breakpoints, and set conditional breakpoints based on data or hit count.
I wouldn't be without it.
Thanks! That's great to hear! What device/debugger do you use for this board? Or is it all capable through USB? Oops, spoke too soon and I see that debugging is not possible 'out-of-the-box' but that people have mods that have worked and posted that here. I have a number of debuggers and serial adapters and interfaces. I wondered what all the internal header mounts were for. I just grabbed a number of pinout docs that I will print and place by my bench but haven't fully studied them yet.
I am not sure I want a paid solution with the software you recommended. There are just so many platforms out there so open source has been my path for the last 25 years. I will have a look at it though, thanks for the suggestion!
 
I know what you are saying but Visual Studio Community is FREE and Visual Micro can be used for 45 days before you have to buy it and then only US$19 a year (US$1.58 a MONTH).
$1.58 a Month for hassle free development.
Oh I know. I write VB.NET and other languages in VS2022 and I still keep a 2019 version around just in case. I WILL give it a try for sure. And if I am not mistaken, you do the perpetual license for I think $65 or close to that, it's for life of the software. If you do not mind me asking... does Visual Micro support other platforms too? Does it handle automating the build and flash piece? And I am curious how it handles the debug part without the hardware support for that. I'll know more by this weekend, just thought I'd ask.
 
Back
Top