Using BMT to Trigger Overlapping Instances of a Sound File

I’m on a MacBook Pro 13" 2017 running Ventura 13.6.1 with BMT Pro 1.9.1. build 1057. I made a translator in BMT that takes a note on input (middle C) and runs the following AppleScript as its output: do shell script "afplay path/to/soundfile.wav".

If I press middle C ten times in a row, really quickly, BMT will play soundfile.wav ten times in a row, back to back, without overlap. So if soundfile.wav is six minutes long, in that example, BMT will generate ten instances of soundfile.wav that play back-to-back for one hour.

Preferred Goal
I’m able to press middle C to trigger multiple, overlapping instances of soundfile.wav that can start and stop at different times, where the next instance can start (immediately when I press middle C) before the previous instance ends. The length of soundfile.wav is known in advance (let’s say it’s two seconds).

Another Option
I’m able to press middle C to trigger one and only one instance of soundfile.wav at a time such that BMT ignores me if I press middle C while soundfile.wav is playing. The length of soundfile.wav is known in advance (again, let’s say it’s two seconds).

The use of AppleScript isn’t essential. Triggering the sound file from a note on message is what’s important. I’m grateful for whatever help anyone can give! Thanks!


Hi and welcome to the Bome community!

I suspect it is the shell script that is causing serial execution or maybe even AppleScript do.

Try just using a command line with a delay and a ‘&’ at the end to put afplay into the background. Use the execute outgoing action to call it. See the example below although I used a keystroke ‘0’ to trigger it instead of MIDI.

aplay.bmtp (764 Bytes)

Steve Caldwell
Bome Customer Care

Also available for paid consulting services:

That did it! Calling afplay by way of ‘execute file’ (as the outgoing action) makes sense. I expected there would be a simple, elegant solution to this problem. I also figured I could count on your help, Steve, based on the ways I’ve seen you help others on this forum. Thank you so much!