Audio player for microcontroller with speed control

I need a audio player that can smoothly change the playback speed of an audio sample in real time.

From my research, I have found that the WAV Trigger can do this but it’s a bit overkill for what I need.

I don’t need to mix or play multiple sample at the same time. I just need something that read a MP3 or WAV file from a SD card and play it at a gradually increasing speed.

It will be controlled from a microcontroller like a Arduino or a ESP32 so it doesn’t need to have hardware trigger.

Thanks

Surely you can do it within the Arduino or whatever, when playing the sample back to the DAC you can speed up or slow down the sample rate. I have some drum sample playback modules that I can speed up and slowdown the sample by reading a pot or an incoming midi value to change sample speed. This works well over PWM outputs but is proving a little problematic with i2s to the DAC for better quality playback.

1 Like

I have consisted that but there is a few issue with this.

First you need a fairly fast microcontroller for this and it may not be possible to do anything else with it at the same time.

Second, I was looking for a more integrated solution. I did used SD card mp3 player in other project in the past and it worked well. But they don’t seem to be able to change the playback speed.

From what I have seen, only WAV Trigger or WAV mixed Shield, etc. have that ability but they are both a bit expensive and big for my use case.

I’m working with a small enclosure and have only limited space for electronic and I may need make other similar project so I’m not willing to buy a 60 $ WAV Trigger for each of them.

I’ll look further into how to do this with a MCU but if there is an other way, please let me know.

It depends how much storage you need, I bought 16mb Pico clones for £5 each with a £5 stereo DAC, the Pico is dual core 133mhz CPU, plenty of power and I’m not even using DMA to speed things up.

A Teensy 4.1 is around £20 and has an SD slot and a 600mhz processor, again paired with a £5 DAC it would easily cope. The SD card would allow you to playback gigabytes of data.

You dont need super speed and power but you do need storage and probably i2s to talk to a stereo DAC for quality audio. I don’t think a 16mhz Arduino would cut it, but there are plenty of more suitable boards like esp32, Teensy, etc

1 Like

I’ll probably need a SD card since I’ll have about an hour of audio, so that at least 60 MB of mp3, more if it’s WAV.

The thing is that I have no experience with i2s or mp3 decoding. Most library only read or write audio without alteration. So I’ll need to either find one that does or make something myself.

Since the audio is only a small part of the overall project, I wasn’t expecting to put too much time on it.

Well i2s is only the protocol, I’d never used it knowingly until a few weeks ago when I ported some pwm code to use an i2s interface. It’s not difficult, just determine the i2s connections to the DAC (3 pins) configure it and playback, you can set sample bits, speed etc.

I’ve tried an ESP32-C3 but it didn’t support i2s well, the esp32-s3 does a better job, the Pico does and would need an SD card adding, Teensy probably does it perfectly well but I need 16 boards so Teensy is too much so I went for 16mb picos.

2 Likes

You could use the Daisy Seed platform for this. Similar to using a teensy with the audio board, but the 16 bit dac is built in, so no need for the extra board. It is also compatible with SD cards. It has a powerful MCU, so it can handle a lot of processing on the samples.

3 Likes

I like the daisyseed, especially the PureData elements but one board is still over £30 here.

1 Like

Have you looked at any DSP ICs?

1 Like

I have looked at codex chip like the VS1063 but at a glance they don’t seem to be able to manipulate the audio in any way. As I said the WAV Trigger is able to speed up sample but it use a STM32 with a custom close source firmware meaning that I need another MCU if I want to do anything other that what the WAV Trigger already does.

If you have a DSP recommendation, I’ll be interested