Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 14 of 14

Thread: Reading multiples waves files in the same time

  1. #1
    Junior Member
    Join Date
    Apr 2021
    Posts
    5

    Reading multiples waves files in the same time

    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

  2. #2
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    8,568
    I'd use a PC.

  3. #3
    Junior Member
    Join Date
    Apr 2021
    Posts
    5
    Quote Originally Posted by Frank B View Post
    I'd use a PC.
    I need a portable device without OS

  4. #4
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    8,568
    I don't think reading 5 audio files with 44khz is possible.
    Perhaps it can work if the files are mono and with a lower sampling rate.. or by using two or 3 microcontrollers?

    The problem is not the micro. It's the SD card... Random access, which is needed here, is slow.

  5. #5
    Junior Member
    Join Date
    Apr 2021
    Posts
    5
    And If I use several sd card ?
    Soundfiles are monophonic

  6. #6
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    8,568
    Some time ago I created an experimental mp3 lib. Don't remember exactly how many mp3 simultanoulsy were possible.. must have been 3 or 4 @128kBps
    I can try and play a bit with it.
    However, i suspect, a higher compression would be needed. On the other hand, with mono files.. hmm..
    Would be some like 98 kBps ok? Or can we go even lower? AAC would be even better .. would have to look)

    However, these codecs have a serious lag on start.

  7. #7
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    24,452
    5 files can work from a flash memory chip.

    Today the WAV file player doesn't buffer enough to allow 5 to work simultaneously from a SD card. SD cards have far too much random access latency.

  8. #8
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    8,568
    Yes, FLASH is an option, if it is large enough.

  9. #9
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    8,568
    Ok.. so let's calc.
    5 files * 44100 samples/sec * 2 bytes per sample * 20 * 60 (20 minutes) :

    5*44100*2*20*60 = ~ 530 Megabytes

    I'd just use 5 Teensys... doable for 130$ maybe.. (cheap D/As) + 5 SDCards
    Not that much.

    Edit: 5x Teensy 3.5, + some caps and an headphone amp.
    Advantage: Very easy programming (5x the same program) , nothing to think much... The saved time is more worth.
    Last edited by Frank B; 04-26-2021 at 02:45 PM.

  10. #10
    Senior Member
    Join Date
    Mar 2013
    Location
    Austin, TX
    Posts
    110
    You could use my serial flash library for this but I haven't tried it for very large chips. It should work though.
    https://github.com/BleepLabs/Serial_...r_Teensy_Audio

    You can see some code on how to copy SD to flash here

    It does kind of sound like a job for a raspi though.

  11. #11
    Junior Member
    Join Date
    Apr 2021
    Posts
    5
    Hi Friends, thanks for your replies

    Quote Originally Posted by john-mike View Post
    You could use my serial flash library for this but I haven't tried it for very large chips. It should work though.
    https://github.com/BleepLabs/Serial_...r_Teensy_Audio

    You can see some code on how to copy SD to flash here

    It does kind of sound like a job for a raspi though.
    Do you have any shematic for hardware part ?

    I see this project : http://www.hypnotriod.org/beatsqueezer/#/features it use a stm32 and have exactly the feature I need. Do you have any idea how he get reed of those technical solutions ?

    Here a short video presenting functionalities : https://www.youtube.com/watch?v=21Yz...nel=IlliaPikin

    This really nice project have a design ressources forlder here : https://drive.google.com/file/d/0Bwj...lsOFB2UlE/view where the shematic is given. Thanks to you all
    Best Regards

    Ewen
    Last edited by zaord; 05-21-2021 at 07:40 AM.

  12. #12
    Junior Member
    Join Date
    Apr 2021
    Posts
    5
    I found here a list of several flash memories. Do you think 1GB is sufficient ?
    Which fammilly should I need to works with stm32 or teensy ?

  13. #13
    Member
    Join Date
    Nov 2012
    Location
    Portland
    Posts
    63
    Sometimes you just want it done with many nice features that you could never code yourself. That sorted out, now you can actually work on which files you want to play, the UI, etc.

    If this is one of those times, consider the Sparkfun WAV trigger or Super WAV trigger.. It's got polyphony, multiple outputs, looping, MIDI, pitch bend, some basic envelopes, and more. There is at least one eurorack module based on it. Only downside is 8-12 ms latency, which might be noticeable with a drum situation.

    It has multiple triggers, but if it's still going to need a brain, consider a Teensy of some sort. Could add an audio board to do effects, even. Back on topic!

  14. #14
    Senior Member
    Join Date
    Mar 2013
    Location
    Austin, TX
    Posts
    110
    You can use the audio adapter or spot on the bottom of the 4.1 to connect a serial flash chip.
    https://www.pjrc.com/store/teensy3_audio.html
    https://www.pjrc.com/store/teensy41.html

    For the ones larger than 8 pins you'll just need to solder them to the SPI pins yourself.

    Remember that they are measure in gigabits, not gigabytes.
    WAVs take 176k Bytes per second.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •