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

Thread: Can I play multiple mp3s at once with a teensy 3.6 and serialflash?

  1. #1
    Junior Member
    Join Date
    Jul 2017

    Can I play multiple mp3s at once with a teensy 3.6 and serialflash?

    Can I play multiple (at most 6) audio files at once, encoded as mp3 or aac on a teensy 3.6 with serialflash and the audioboard?

    I'm working on an audio project for an art installation.

    The idea: You get a battery powered unit that hangs around your neck. It tracks your location within the installation (two rooms and a bridge that joins them). There are 47 different audio loops that fade in and out depending on where you are (some are talking pieces about artwork on the walls in specific places, some are musical loops that mesh with each other).

    I'm using Decawave DWM-1001 development kit units for the tracking, that's fine for getting the x,y coordinates within the installation. It uses UART and sends a packet to the teensy in the form POS,25.0,48.2,3.0,95. POS for position, then x,y,z and finally how accurate the location data is as a percentage. It sends its data at 10hz which is fast enough for our purposes.

    I haven't written all the code I need so far but this is how I'm thinking about this:

    1)Get position data
    2)use strtok to split it into different variables so I have a tagPosX and tagPosY float with x and y coordinates (this works fine)
    3)compare x,y coordinates with x,y coordinates of each of the loops and get a linear distance to it
    3a) if its coming into range of loop[i] play loop[i]
    3b) if its going out of range of loop[i] stop playing
    4) adjust volume of all loops from min to max over a certain range (so first it plays at 0, then start fading in at a certain point, then have it at max volume maybe from like 50cm to the loop, then fade out again

    We really want to have at most 6 loops playing at once. We bought 6 teensy 3.6 and 6 audioboards. We have 256mbit serialflash cards for the audio (one room on each teensy, basic mixer to mix the audio together, three units all in all - each with 2 teensies) which is enough space for all the loops as long as they're mp3 encoded. I had googled it a bit and saw that 1) the teensy 3.6 should handle playing a bunch of files at once and 2) that it should handle playing mp3s but didn't realise that it might not work together.

    If I canít Iím thinking about maybe using one voice per teensy, have them communicate between themselves and use 6 teensies at once, one per track.. it just sounds really overkill and complicated. Do yíall have any ideas?

    Thanks so much!

  2. #2
    As far as I am aware, there hasn't been an AAC or MP3 decoder written for the teensy audio library, so you would probably need to first find an open source decoder and get it working with the teensy audio library.

    The bigger problem is the computing horsepower required to do MP3 decoding. I doubt very much you're going to be able to do more than 1 or 2 MP3 decoders simultaneously with a teensy 3.6.

    A teensy 4 on the other hand, now that would be interesting to see. It's on another level, computing-wise.

  3. #3
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Ayer Massachussetts
    FrankB developed a MP3 library a few years ago, and added a AAC player as well. However, it was developed in the Teensy 3.2 time frame, and only plays one MP3 file at a time.

    I see he made a few mods 6 months or so ago for the Teensy 4.0:

  4. #4
    Oh wow, that is quite the library. Thanks for sharing that.

  5. #5
    Junior Member
    Join Date
    Jul 2017
    Yeah, I had looked at the library but wasn't sure if it could or couldn't play multiple mp3s at once. I feel like I saw a post from him mentioning playing multiple mp3s with it but I'm not sure, guess I'll just have to try it once I get the teensies and flash chips. Thanks for the help!

Tags for this Thread

Posting Permissions

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