MP3 Trigger Firmware Version 2.40 Beta

by

Updated 5/31/2011

There have been many good suggestions for improvements and features over the past year. One reason they haven’t been incorporated is simply that I’ve been extremely busy with other work. The second reason is that each time I add a new feature or improve performance, I’ve had to make multiple version for different baudrates, alternate trigger functions, etc. A big pain. Clearly, what’s been missing is a way to set these options at run time.

So here is a beta release of a new version of MP3 Trigger firmware with the following features:

  • An MP3TRIGR.INI file (optional) that allows setting the baud rate and individual options for all 18 triggers, including regular, random, next and previous triggering functions as well as a restart lockout feature.
  • The ability to reprogram trigger inputs to control volume up and down.
  • A modified trigger file naming scheme that allows for more flexible track names.
  • Increased compatibility with SDSC (2GB or less) microSD cards.

New File Names

Previous firmware versions required that tracks associated with triggers be named “TRACKnnn.MP3″, where nnn was the trigger number. Beginning with version 2.40, the only requirement is that the track names begin with nnn.  So the following are both valid file names for trigger number 14:

“014Track.mp3″

“014 Breaking Glass.mp3″

The old style file names will no longer be associated with trigger inputs beginning with this version.

Flash Card Follies

I’ve spent a fair amount of time studying the microSD flash card situation. There are currently two basic types now available:  SDSC cards (2GB or less), and SDHC cards (greater than 2GB). Before the industry acceptance of SDHC, some manufacturers made larger capacity (>2GB) cards that were not SDHC compliant, and I’m discounting those in this discussion.

SDHC cards are only formatted FAT32 and cannot be formatted FAT16. Currently the MP3 Trigger V2 does not support FAT32, nor does it recognize the SDHC card during initialization. So don’t even think about trying to use one for the time being.

SDSC cards are only formatted FAT16 and these are what the current firmware is designed to use.  In this new version, I have found and fixed an issue that prevented certain SDSC cards from being recognized. (The Master Boot Record can sometimes be in sector 0 and sometimes not. I did not know that!) Also, I have found some PNY 2GB cards which are simply too slow to play 192kbps mp3 audio. File access measurements indicate that these cards are around 8% slower than “normal”, enough to introduce clicks and pops at the higher bits rates. Encoding the same audio at 128kbps allowed these cards to work.

So the message here is this: Use SDSC cards, and if you have trouble with 192kbps you probably have a slow card. In that case, either get another card or use a lower bitrate encoding.  If you find an SDSC card that is not recognized, please let me know.

Init File

The init file must be named “MP3TRIGR.INI” and must, like all the mp3 files, be in the root directory. The file is optional. If it does not exist, then the MP3 Trigger defaults to normal operation at 38.4Kbaud and all triggers starting their respect tracks (with the new names!).

Init file commands must begin with the “#” character and be followed by a space. Currently, the following three commands are supported:

#BAUD N      where N can be 2400, 9600, 19200, 31250 or 38400

#RAND N      where N can be 1 to 255

This function excludes the first N MP3 files from the random trigger function

#TRIG N, F, L     where N = trigger number (1 – 18), F = function type, and L = restart lockout enable

The allowable function types are as follows: F = 0 Normal trigger operation, F = 1 Next (same as nav forward),  F = 2 Random,  F = 3 Previous (same as nav back), F = 4 Start, F = 5 Stop, F = 6 Volume Up, F = 7 Volume Down.

The lockout feature, when enabled  (L = 1), will prevent the trigger from doing anything while audio is playing. This allows you to have tracks which cannot be restarted until they have completed.

For example, the following line will set trigger number 7 to be a random select, with restart lockout enabled:

#TRIG 07, 2, 1

All commands are optional. If you want 38.4Kbaud, you don’t need the #BAUD command. If you don’t want to change the behavior of a trigger input, you don’t need an entry for that trigger.  So for example, I use a single line in the init file to make trigger 18 be sequential (next), then I jumper that trigger and my MP3 Trigger powers up and continuously loops through all the tracks on the card:

#TRIG 18, 1, 0

Here is a sample MP3TRIGR.INI file that includes all of the documentation for the commands.

#BAUD 38400
#RAND 2
#TRIG 01, 0, 0
#TRIG 02, 0, 0
#TRIG 03, 0, 0
#TRIG 04, 0, 0
#TRIG 05, 0, 0
#TRIG 06, 0, 0
#TRIG 07, 0, 0
#TRIG 08, 0, 0
#TRIG 09, 0, 0
#TRIG 10, 0, 0
#TRIG 11, 0, 0
#TRIG 12, 0, 0
#TRIG 13, 0, 0
#TRIG 14, 0, 0
#TRIG 15, 0, 0
#TRIG 16, 0, 0
#TRIG 17, 0, 0
#TRIG 18, 0, 0

******************** ALL INIT COMMANDS ABOVE THIS LINE *********************

This is a sample init file for the MP3 Trigger V2, firmware version 2.40.

The init file is optional. If not present, the default parameters will be
in effect: 38.4Kbaud, and all triggers will start their corresponding
tracks with restart lockout disabled. If it is present, it must be named
MP3TRIGR.INI and be located in the root directory.

Only the first 512 bytes of the file are examined for commands, and the first
occurrence of the '*' character is treated as the end of file by the parser.
Comments are not allowed in the command section, but there is no restriction
on the length of the comments that follow the first '*'.

All commands must begin with the '#' character and be followed by a space,
then the command parameters separated by commas. White space is ignored. All
parameters are decimal numbers. Leading zeros are acceptable. See the above
examples - which are redundant since they are all default values.

The following commands are supported in firmware version 2.40:

#BAUD N

    where N is one of the following: 2400, 9600, 19200, 31250 or 38400

#RAND N

    where N is from 1 to 255

    The default behavior of the random trigger function is to play a random
    track from all the MP3 files on the flash card. The #RAND function will
    exclude the first N tracks (in the directory) from the random trigger
    function. So if there are 18 MP3 files on the card and N=4, then the
    first 4 MP3 files will be excluded from the random trigger function.

#TRIG N, F, L

    where:   N is the trigger number (1 - 18)
    F is the trigger function type (see below)
    L is the restart lockout enable

    The defined trigger function types (F) are as follows:

    F = 0: Normal operation
    F = 1: Next (same as the forward Nav switch)
    F = 2: Random
    F = 3: Previous (same as the back Nav switch)
    F = 4: Start (restarts the current track)
    F = 5: Stop
    F = 6: Volume Up
    F = 7: Volume Down

    The restart lockout feature, if enabled, will prevent that trigger
    from working if audio is currently playing. Use this if you want
    to prevent restarts before the track has reached the end. This
    feature does not apply to function types 5 - 7.

    L = 0: Restart lockout disabled (default)
    L = 1: Restart lockout enabled

You only need to include entries for triggers that are to be non-default.
As an example, I use the following single-line init file to make trigger
18 be a "Next" function, then hard-wire the trigger so that my MP3 Trigger
powers up and loops continuously through all the tracks on the card.

#TRIG 18, 1, 0

I’m currently working on updating the user manual for the new features and will post it here once the new firmware version is officially released. I wanted to get a beta release version out there to solicit some testing and feedback.

49 Responses to “MP3 Trigger Firmware Version 2.40 Beta”

  1. olanvin  on April 14th, 2011

    Great job !
    The possibility to navigate with the trigger inputs is a great improvement, it works fine !
    Thanks for the update, it gives me an easier way to drive my R2′s sounds !
    Friendly yours
    Olivier

  2. df  on May 2nd, 2011

    nice revisions!
    any possibility of releasing a “line out” mp3 trigger which includes safe buffers on the analog outputs?

    • robertsonics  on May 3rd, 2011

      Certainly possible – we are considering a V3 release with SDHC-FAT32 (larger than 2G) microSD card support. Here’s my question, however: Is it possible to have a single audio jack and output circuit that supports both headphone and line-out, or would we need separate jacks? Need to investigate this…

  3. df  on May 7th, 2011

    robert,
    who needs larger than 2gb!?!?!? (Seriously—with mp3s even my largest files are under 20 mb on the trigger)

    a single output jack would be the best—you could start with line out, and just incorporate another op amp to handle the headphone portion of it. this could even be switched in/out by a little spdt, depending on how you’re using the device.

    in my opinion a “line out” mp3 trigger is much more useful—so far, each time i’ve used this product, i’ve had to make some sort of “safe” buffer/amplifier to handle the analog outs.

    • robertsonics  on May 9th, 2011

      This issue with the SDHC microSD cards > 2GB is not so much one of capacity as availability. I’m told it’s becoming harder to locate the smaller FAT16 variety. If they are phased out, then obviously we need to be able to use the newer type.

      I wonder if two separate audio jacks – one headphone and one line-out – would be better than a switch? Less chance for error…

      • Mike H  on November 27th, 2011

        The problem with 2 jack outputs is that plugging headphones into line out is ok. But plugging line out into headphones = dead chip according to the files.

        If 2 RCA phono were used for line out then a) the ground could automatically be 0v, and b) headphones wont fit RCA.

        I do appreciate that 2 RCA is quite some real estate on the board.

        Superb board – having fun with PIRs triggering Christmas tunes (well getting ready for the Season)

  4. df  on May 16th, 2011

    two jacks are interesting—that’s actually what i do when i modify these units.

    or, you could also just select it with a jumper, instead of a switch.

  5. dhon_  on May 18th, 2011

    Could you describe how the next button functions if
    1) there are no tracks playing (does it start playing?)
    2) there is already a track playing (does it advance to the next track?)

    Thanks, looks like a great project :)

    • robertsonics  on May 19th, 2011

      Yes, and yes. It’s exactly the same function as the forward navigation switch.

  6. dhon_  on May 19th, 2011

    Thanks, one more thing – when it finishes playing a track, does it automatically advance to the next if no buttons are pressed, or will it stop?

  7. dhon_  on May 20th, 2011

    (I received a detailed reply via email – thanks Jamie)

  8. Robert  on June 15th, 2011

    Hi there!

    Does the “hardware” trigger stop functioning with this release? I’m able to use all other commands from software except ‘T’.

    I’ve tried both ” ‘T’ and ’18′ ” and ” ‘T’ and 18 ” but none of them work. I’ve set the 18 trigger to play a random track and it works when shorting the pins on the board, but not from software.

    Also –
    With the v2 board, how do I trigger triggers above 9 with a single char if it is required to be a char, not a number?

    • robertsonics  on June 15th, 2011

      Per the user guide, the (upper case) “T” command is a 2-byte command where the second byte is ASCII “1″ through “9″. This command only allows you to start the first 9 trigger tracks. (Recall that the original MP3 Trigger only had 7 trigger inputs.)

      The (lower case) “t” command is also a 2-byte command, but the second byte is the binary value of the trigger track 1 – 255. Therefore, to start track 18 you would send the ASCII character “t”, followed by the binary value 18, or hex value 12h.

      I hope this answers the question you were asking.

  9. Robert  on June 18th, 2011

    Hi there,

    Not really. What I’m having troubles with is sending the uppercase triggers from software, and I’ve tried sending the number as letters. I’ve also tried after posting to assign the randomcommand to trigger 1 and send “T” and “1″ but no disco.

    It’s not crucial for my application, but I’m just curious if someone else is experiencing the same problem as I.

    All other commands works as intended.

  10. Robert  on June 19th, 2011

    Ok, I’ve narrowed it down.
    The triggers does work, but they trigger tracks directly instead of trigger the random command.

    I’ve currently got:
    #BAUD 19200
    #TRIG 01, 2, 0

    This does not work.
    If I add a 001.wav that file gets played thou.

    The baud setting is read, so the ini file works… and it is the correct setting for a random trigger, yes?
    Must I use #RAND as well even if I don’t want to exclude tracks?

    • robertsonics  on June 20th, 2011

      Ok – now I think I understand. You are using the init file to set a trigger input to the random function, then using a serial command to start that trigger. Well, to be honest, I never considered this. I assume that the serial commands are being used to start specific tracks, so that sending “T1″ will always start “001Track.MP3″. The serial commands start tracks, not trigger inputs.

      I also assumed that if you had a serial connection, the processor that is sending the commands could implement the random function and just send commands to play tracks in a random order.

  11. Morten  on June 20th, 2011

    Serial stop command?

    Hi.

    I want to just send a stop command by serial.
    But as far as I understand there is only the ‘O’ command, but that will also start playing again if trigged again.

    I want just a “stop”, that will do nothing if the player is already stopped.

    I have a stop hardwired on trigger 18, but wold prefer a serial option.

    Also? Any chance for a “Pause” function?

    • robertsonics  on June 20th, 2011

      Morten – Try sending a trigger command for a track that doesn’t exist. I’m traveling and can’t confirm, but I think if you try to start a non-existent track, it will effectively stop whatever is currently playing.

      This is different than a “pause” command, however. There is currently no way to start a track except at the beginning.

  12. DavidT  on June 25th, 2011

    Hello, I was curious as to how difficult it would be to provide via serial the track names in some later version? I’m trying to use this device in an application where it would be useful to know when I’ve reached the end of an album. Currently the Trigger only tells you when a track has finished, not WHICH track has finished. In general, a little bit more feedback from the Trigger would be nice. It’s not a very busy bus :)

  13. FireyFate  on June 27th, 2011

    I’m planning to hook mine up to a 17 position break before make rotary switch, and each of the MP3 tracks is going to be pretty long.

    When I release one trigger and hit another, will it interrupt the currently playing track and move to the next?

    Thanks!

  14. j2  on July 7th, 2011

    One feature that would be useful in my project would be to have a trigger to start one random track of a selection of tracks, or round-robin a track selection.

    As in i would be able to have

    001_Clip_A.mp3
    001_Clip_B.mp3
    002_Clip_A.mp3
    002_Clip_B.mp3
    002_Clip_C.mp3
    etc

  15. johnh  on July 29th, 2011

    Hi
    Just trying out the new firmware and I like having the ini file to configure the options.
    It might be a hassle but can we have another trigger option so that once you have triggered a track you can’t trigger that track again until it is finished (as you can now) but you can trigger another track before the current track is finished.
    Thanks
    JH

    • robertsonics  on August 8th, 2011

      johnh,

      If I understand you correctly, it actually works the way you want now. The restart lockout is per trigger. So if you have restart lockout enabled on one trigger, that trigger will not be able to start its track until it is completed, but other triggers will start immediately. At least that’s what I think happens. Try it!

  16. Hunter  on July 29th, 2011

    These new updates are really exciting!

    My feature request from v1 still stands: I’d like to be able to play any one of the 255 mp3s by sending 8-bit parallel data via 8 of the triggering pins. Would it be possible to configure this behavior via firmware, or could it perhaps be implemented in v3? :)

    (In case you’re wondering, the reason I want this is to interface with 1980s pinball machine MPU boards, which send sound requests to their sound boards via parallel.)

  17. FireyFate  on July 30th, 2011

    I’m using this board in 1930s radios I gut and install modern components into. I’m using a break before make rotary switch for channel selection.

    So far I’ve built two, and on both units when I go from trigger 8 to 9, track 8 continues to play. I have to switch it to 10, then back to 9 before 9 will play.

    Any idea why this is??

  18. driedeker  on August 4th, 2011

    just set this up works great.
    now is it posable to have the #rand N asignable to any of the triggers and place this in ini so,
    if pin 3 say is assigned for rand 4 to 8 and then pin 9 for rand 10 to16 and such
    Thanks
    Terry

  19. GvB  on August 5th, 2011

    Still, with v2.4 having problems with hanging.
    Could this be solved? Or someone who knows what the problem is?

    • robertsonics  on August 8th, 2011

      GvB,

      I responded to you over at SparkFun as well. Since you’re the only one I’m aware of having this issue, and I’m not able to duplicate it myself, I’ll need more information in order to be of any help. Please contact me directly at info(at)robertsonics(dot)com.

  20. j2  on August 7th, 2011

    Howabout a setting in the ini-file to be able to set the default volume when the device starts up?

    • robertsonics  on August 8th, 2011

      j2,

      This is a great idea. Don’t know why I didn’t think of it myself. I’ll add it to the list for the next release.

  21. driedeker  on August 9th, 2011

    Perhaps I was not Clear with my question
    how about more than one *rand
    *rand0 random file say n to whatever
    *rand1 random file say n to whatever
    etc etc
    is this possible
    then in the ini
    *rand0 to pin whatever
    *rand1 to another pin etc etc

  22. oiv  on August 21st, 2011

    This sound like a great device for a project I have but… I would need a way to play 3 or 4 individual files and then some way to play randomly all the other files _except_ those three or four. (or more..)

    Like background music and then for some special cases music or ads if needed.

    yes. One more nice feature :)

    • robertsonics  on August 21st, 2011

      If I understand you correctly, that’s precisely what the #RAND functions in the init file does. Please read about it above.

      • oiv  on August 21st, 2011

        Uh. Thanks. Reading _does_ help :D

  23. FireyFate  on August 24th, 2011

    I’m not sure if this would be useful for anyone else, but I use very long MP3s on mine simulating radio channels… and it’s a bit tiresome that every time I turn it on or change the channel the file starts from the beginning. Would it be possible in a future Rev to have a file resume last playing position?

  24. Andy  on August 31st, 2011

    We really need a pause command on this. There is a project I could really sell using these but with no pause command its really difficult so I am currently trying out another model.

    • robertsonics  on September 1st, 2011

      Ok. Can you tell me how you would want it implemented? For example, one way would be to add a “pause” trigger function type to the init file. A trigger input set to this function type would alternately pause and resume whatever track is playing. If no track was playing, it would do nothing. There would also be a “pause” serial command which would do the same thing.

      No information about track and play position can be preserved over a power cycle, however.

      • Morten  on September 9th, 2011

        Yes thank you! :-)
        I have just made a sort of jukebok using the mp3 trigger with an arduino and sprakfuns Capasative senor breakot. Its cool! you just touch some metallic signs to selct track. Even if i may not need a pause function on this project it would be very nice to have when need arrise! A simple play/pause command like you describe.

        Other nice things to have:
        A confirmation via serial that the track has acutally started playing. Like you have when the file stops or is interrupted.

        A way to send a filename back to the Arduino. For example the part of the filename after the three digits. Example: 001_My Song.mp3 returns “My Song”.
        Or you can set the name in the .ini file.
        But this should be an option you can enable or disable in the .ini file.

        Got other ideas, but focus on the pause function first! :-)

  25. HalloweenHauntings  on September 4th, 2011

    I want to implement the MP3 trigger in a Halloween prop I am using, however I have an issue with the serial commands. The controller I am using (a PROP-1 from Efx-Tek, based on the Basic Stamp 1) only goes up to 2400. Using the INI file, I am (hopefully) setting the rate to 2400. I am also repurposing input pins to volume control.

    I seem to be having trouble communicating with the MP3. I have debug commands in my code that let me know where in execution the program is, I know it is getting past the serial communications, however the trigger does not respond. I can manually play the files using the nav switch.

    The PROP-1 serial I/O is TTL 5V. I have options for True, Inverted, Open-collector True and Open Collector inverted. Limited to 8 data, No parity and 1 stop bit. Baud rates of 300, 600, 1200, or 2400 only.

    I can provide snippets of code, if necessary.

    The INI file looks like this:

    #BAUD 2400
    #TRIG 01, 0, 1
    #TRIG 02, 0, 1
    #TRIG 03, 0, 1
    #TRIG 04, 0, 0
    #TRIG 16, 5, 0
    #TRIG 17, 7, 0
    #TRIG 18, 8, 0

    The files are 001-start.mp3, 002-pop.mp3, 003-end.mp3, and 004-teaser.mp3.

    • robertsonics  on September 14th, 2011

      See my reply below to Tom_in_AZ.

  26. FireyFate  on September 5th, 2011

    How about a “skip forward xx seconds” trigger configurable by ini? That would be GREAT!

  27. degatt2  on September 12th, 2011

    Yes, i have a hard time finding a sdcard less than 2gb. also, I have to say: great work. i think the best upgrade come with the fat32 support. because if you are not a power user on the mac-terminal, probably you can’t get the sdcard formated to fat16.

  28. Tom_in_AZ  on September 14th, 2011

    Hello,
    Can someone please help me get my board working via a serial connection? The manual for this board was made more for people more advance/experienced in Arduino, and not really for beginners. I have updated the board to v2.4, and I am using it with an Arduino UNO and a TTL Bluetooth circuit. The BT circuit is recognized by the UNO, and they can talk back and forth at 38400 baud with the UNO using its native Serial Monitor (USB com3), and the BT connected wirelessly to a PC on its own BT com port (BT Com4). The only MP3Trigger library I found is: http://github.com/sansumbrella/MP3Trigger-for-Arduino and I have the NewSoftSerial10c (http://arduiniana.org/NewSoftSerial/NewSoftSerial10c.zip) library as well installed. I just can’t figure out how else to make this work. As a note, my MP3 files all play when I use the on board slider switch to cycle through them manually, so I know it does see and can play the files. I also started a thread on SparkFun to see if someone there can help as well. http://forum.sparkfun.com/viewtopic.php?f=32&t=29843
    Thanks in advance for any help in making this work, I would love to be able to show my group hot to work it so that they can be used in our robots.
    Tom

    • robertsonics  on September 14th, 2011

      Unfortunately, getting async serial communication working the first time can be really difficult, and equally difficult to help troubleshoot. Everything has to be correct, including bit-rate, number of start/stop bits parity, polarity, etc. Once it works at all, it works great, but the first time can be a bear.

      As I’ve said before, I’m not an Arduino user so I can’t really be of any help in that department. Hopefully other people can.

      What I do in these cases is to use an oscilloscope to see exactly what it being sent on the transmit pin, and that always clearly shows any problems and points to a solution. Without seeing what’s going on you’re left to guess, because it either works or it doesn’t. There’s no in-between.

      One suggestion, though it does involve another purchase, is to get a SparkFun FTDI Basic module, which connects directly to the MP3 Trigger serial control port and lets you plug into a USB port on your PC or Mac. Then you can run a terminal program, type commands directly from your keyboard and see responses. Unless there’s something wrong with your MP3 Trigger unit, this is guaranteed to work. Once that works, you at least have a baseline.

      Also, focus on the 2-byte ASCII commands. Many people get tripped up when the second byte is a binary value.

  29. chris_oremus@hotmail.com  on September 24th, 2011

    I am using this for a performers costume and this will play sounds like effects. I need the tracks to play quickly after being triggered. Is there any way to shorten the delay between trigger and play time?

    • robertsonics  on September 26th, 2011

      I’ve measured the time between activating a trigger and the start of sound to be on the order of 100 milliseconds, which seems plenty fast to me. If you are experiencing longer delays, then very likely your MP3 files have non-audio meta-data (tags) in the beginning of the file and you’ll need to re-encode them without tags to get rid of the delay.

  30. YiPP  on November 7th, 2011

    Hi Robert,

    Question: we have 5 MP3 triggers running in a museum, 10 hours a day. It seems that sometimes boards stop working randomly.
    We replaced an SD card, and that board worked again.
    Two weeks later, 2 units had stopped. A technical employee at the museum took out the SD cards,gave them a wipe and a blow of air and put them back. The units worked again.

    I wouldn’t say it’s particularly dusty in this museum, so what could be the case here?
    Any thoughts?

    regards,
    Woody

    • robertsonics  on November 11th, 2011

      I need quite a bit more information in order to be of any help. Have you updated to the most recent version of firmware found on this site? What state are they in when they stop? Can you play sounds using the navigation switch? Is the status LED working or is it stuck on or off? Does the unit start working if you simply cycle the power?

  31. FireyFate  on November 23rd, 2011

    Hmmm… I guess none of my questions have warranted a response.

    Oh well, I’ll just switch over to the FEZ Music Shield for my projects.