Reading multiples waves files in the same time

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
zaord
Posts: 96
Joined: Fri Jan 31, 2020 3:56 pm

Reading multiples waves files in the same time

Post by zaord » Sun Apr 11, 2021 12:53 pm

Hi,
For a pédagogical musical projet, I would need to create a system with several 'layers of sound' meaning one sound file for exemple melody, one for harmony and one for explaiations and I would to be abbe to mute each of those track when I wants duriing playing in the same time.

Do you have any idea of which sound format I should use ?
Do I need to use a external soundmodule or does Micropython could read up to 5 tracks simulaneously ?

I would need also a 3.5mm jack for headphone.

The duration of those simultaneous tracks could be up to 20 min.

Best, and Thanks for your experience sharing

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Reading multiples waves files in the same time

Post by pythoncoder » Sun Apr 11, 2021 12:58 pm

I think this is beyond the scope of microcontroller hardware for a variety of reasons.

I would consider using something like a Raspberry Pi hosting a full version of Linux. I'd ask for advice in a suitable forum: Linux has a variety of audio applications which can probably do what you are after.
Peter Hinch
Index to my micropython libraries.

User avatar
mathieu
Posts: 88
Joined: Fri Nov 10, 2017 9:57 pm

Re: Reading multiples waves files in the same time

Post by mathieu » Sun Apr 11, 2021 5:30 pm

To expand on pythoncoder's answer, I think the real hard part here would be to read "on the fly" or to store in memory 20 mn of non-repeating music, at a reasonably good sounding bitrate. If a lot of the audio is repeated (e.g. mixing single-tone piano notes with short percussion clips and one or more cyclic loops), as long as you can hold the data in memory you can play it, using a DAC or an I2S output. In my experience a TinyPICO, offering SPIRAM and I2S, works well (maybe throw in ulab for efficient mixing of audio tracks).

But, again, you'll probably never fit 20 mn of multi-track hi-fi audio in memory.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Reading multiples waves files in the same time

Post by pythoncoder » Mon Apr 12, 2021 7:04 am

My comment was based on experience developing this library which can play MP3 and FLAC files via an external decoder chip. Handling a single audio stream from a file on an SD card was near the limit of what could be achieved, even with the number crunching of decoding the stream offloaded to external hardware.
Peter Hinch
Index to my micropython libraries.

Post Reply