Audio FX board filename parsing question

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Just_a_Bill
 
Posts: 3
Joined: Thu May 18, 2023 8:13 pm

Audio FX board filename parsing question

Post by Just_a_Bill »

I believe I understand the five modes of the Audio FX boards and how the file naming works. My question is, can you supply both "momentary" (Tnn, TnnLATCH, TnnNEXT#, or BANNED#) and "hold down" (TnnHOLDL) audio files for the same pin and get a different result depending on whether the button is mom-clicked or held down?

As an example, consider a Star Trek phaser with a button on pin 4, and the following files installed:
T04.OGG // rare-ish discrete "stun" sound (w/ circular light flash, as in The Man Trap)
T04HOLDL.OGG // standard sustained phaser-beam sound for typical continuous beam shots

I'm hoping the board would first check how long the pin was grounded and then search for a matching file for that method. Obviously if I include files for two or more of the momentary modes then I probably couldn't count on which one would get played... I understand that. But basically my question is, how does the parsing work?

Possibility #1. Files are searched as needed. A momentary press on 04 searches for any of T04, T04LATCH, T04NEXT#, or T04RAND# and plays one if found (in whatever order it searches, should there be more than one), even if a T04HOLDL is also present. A press-and-hold on 04 searches for T04HOLDL and plays it if found, even if a T04 file for one of the other modes is present.

Possibility #2. Files are "pre-assessed" somehow and only one mode is monitored for activations. If two or more modes are present for pin 04, whichever mode comes first in the board's precedence scheme is the only one that will play. Momentary pressing and press-and-holding are not both possible for the same pin; whichever one loses the precedence battle will be ignored.

Possibility #3. If two or more modes are found for the same pin, the board considers that an error and doesn't play anything.

Possibility #4. Some other option I didn't think of, or foolishly discounted as implausible. ;-)

I hope I'm asking the question in a non-stupid way. Thanks!

User avatar
dastels
 
Posts: 15663
Joined: Tue Oct 20, 2015 3:22 pm

Re: Audio FX board filename parsing question

Post by dastels »

You can try and see what happens, but I very much doubt it will work the way you home. Triggering happens when the trigger pin goes low (i.e. when the button is pressed). That's when it looks at the files and picks one to play. The hold trigger starts playing exactly like (and when) the regular trigger. The difference is that the hold trigger stops playing when the trigger goes high (button released) but loops for as long as it is low/pressed. The regular trigger plays through once regardless of how long the trigger is low.

If you want two behaviors, you need to use two triggers.

Dave

User avatar
Just_a_Bill
 
Posts: 3
Joined: Thu May 18, 2023 8:13 pm

Re: Audio FX board filename parsing question

Post by Just_a_Bill »

Yeah, I doubt it too. ;-) I'm still curious about the algorithm for picking a file when more than one could apply, and was hoping to understand that before I decide how many to buy. Thanks for responding.

User avatar
dastels
 
Posts: 15663
Joined: Tue Oct 20, 2015 3:22 pm

Re: Audio FX board filename parsing question

Post by dastels »

No idea what the process of picking a file is, and the code is proprietary. You could figure it out through experimentation.

Dave

User avatar
adafruit_support_bill
 
Posts: 88096
Joined: Sat Feb 07, 2009 10:11 am

Re: Audio FX board filename parsing question

Post by adafruit_support_bill »

These boards also have a serial interface. So you could add a small microcontroller board to process the button presses and implement your own custom triggering scheme.
https://learn.adafruit.com/adafruit-aud ... io-control

User avatar
Just_a_Bill
 
Posts: 3
Joined: Thu May 18, 2023 8:13 pm

Re: Audio FX board filename parsing question

Post by Just_a_Bill »

Thanks for the replies. I know I could determine it experimentally, but given the price of the board compared to other options I was trying to do some recon before spending $20-40 on that particular experiment. After some further digging, I think I will just write my own button logic, in which case something like the DFPlayer makes a lot more sense since they can be had for like 4 bucks apiece.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”