Hello,
Could be nice to have this feature. For example, playing music on background and have button sounds on foreground or music and sounds in game, rotor, engine and other sounds at once in model, etc. I'm sure, second core could do the trick (which one is actually playing sound files in Annex). There is Arduino library (for ESP32), which does this.
Thanks
Audio mixing / playing more wav/mp3 at once
- cicciocb
- Site Admin
- Posts: 1979
- Joined: Mon Feb 03, 2020 1:15 pm
- Location: Toulouse
- Has thanked: 425 times
- Been thanked: 1320 times
- Contact:
Re: Audio mixing / playing more wav/mp3 at once
That could be nice but I fear that this will not fit inside.[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Tue Nov 23, 2021 5:13 pm Hello,
Could be nice to have this feature. For example, playing music on background and have button sounds on foreground or music and sounds in game, rotor, engine and other sounds at once in model, etc. I'm sure, second core could do the trick (which one is actually playing sound files in Annex). There is Arduino library (for ESP32), which does this.
Thanks
In fact Annex already use both cores, the core 1 is dedicated to the basic interpreter and the core 0 for the wifi and the mp3 / wav
-
- Posts: 4
- Joined: Mon Nov 22, 2021 6:52 pm
Re: Audio mixing / playing more wav/mp3 at once
Well, I was thinking about the same, for my project. One core will process wavs and web/wifi and second control/monitor/comm.
However, I'm not afraid about processor power for this. I could see AVR running *.MOD files player. 4 simultaneous 8000kHz samples from SD card at once + effects for each channel + 44780 LCD. Ok, AVR was @24MHz and written in assembler. ESP32 (mainly @240MHz) should do the job too. BUT it doesn't need to be necessary mix of 10 MP3s. Only few wavs for example. And with same sample rate, etc. I believe, it would need only slight modification of current routines. Firstly, handling (opening and transferring more (let's say 2 at the beginning) wave files from SD) and then short mixture calculation. So file management and wav processing remain same (only doubles CPU requirements) I2S or DAC routine remains same as there is still same data flow as with only one wav.
I found this quite simple (and simplified) example, how to do it, if you're interested: https://www.xtronical.com/i2s_ep5/
Ok, I don't want to argue as only you know, how much CPU consumption current situation has. I also don't know, how it would perform on ESP8266 or ESP32 at lower speed.
However, I'm not afraid about processor power for this. I could see AVR running *.MOD files player. 4 simultaneous 8000kHz samples from SD card at once + effects for each channel + 44780 LCD. Ok, AVR was @24MHz and written in assembler. ESP32 (mainly @240MHz) should do the job too. BUT it doesn't need to be necessary mix of 10 MP3s. Only few wavs for example. And with same sample rate, etc. I believe, it would need only slight modification of current routines. Firstly, handling (opening and transferring more (let's say 2 at the beginning) wave files from SD) and then short mixture calculation. So file management and wav processing remain same (only doubles CPU requirements) I2S or DAC routine remains same as there is still same data flow as with only one wav.
I found this quite simple (and simplified) example, how to do it, if you're interested: https://www.xtronical.com/i2s_ep5/
Ok, I don't want to argue as only you know, how much CPU consumption current situation has. I also don't know, how it would perform on ESP8266 or ESP32 at lower speed.
- Electroguard
- Posts: 852
- Joined: Mon Feb 08, 2021 6:22 pm
- Has thanked: 273 times
- Been thanked: 321 times
Re: Audio mixing / playing more wav/mp3 at once
Instead of separate cores a simple work-around could be to use 2 audio sources into the same amp/speaker by using 2 devices, a device for playing background music and another for sound effects. ESP devices are relatively small and cheap, and one device could easily control the volume and playback of the other using serial2 or whatever, with the added advantage of double the gpio's and timers available.
-
- Posts: 4
- Joined: Mon Nov 22, 2021 6:52 pm