fmSoundPlayer logo

fmSoundPlayer

LuminFire

Summary

Product Type: Apps

Price: Free

Last updated: 1/13/2017

Language: English

Product website

Category

Play sounds on command using FileMaker

Shows a technique to play sounds via script control.

At LuminFire, we do a daily stand-up SCRUM meeting with our developers. Since having fun while we do brilliant work is one of our company values, we thought it would lighten up the meeting if we added some interesting sound effects to help keep us on track. For example, a gong sound gathers us all together. If someone has used up too much time or needs to take a topic offline we sound the end of game buzzer. When we launch a new WordPress website or put a custom FileMaker app into production there’s applause! A new person added to the group gets a doorbell sound. If there’s an emergency you here the siren warning sound.

We thought this might be a great opportunity to create a quick FileMaker app to help us out. It’s a simple database of sounds, titles, and two container fields to hold an image and an mp3 or wav sound file. Along the way we learned that playing a sound on command is a little trickier than expected. First, there is no simple “Play Sound” script command in FileMaker. There are script commands to play movies…but that’s not the same thing. After several attempts to make this work we finally arrived at the following solution. First, you need a global container field in the table to be used as a utility to play the sound on script command. We called it gSoundPlayer. On the layout in the Inspector you must select this field and optimize for “Interactive content” and then check “Start playback automatically”. Normally, you do not want this set since as soon as you enter a record it would play the sound….annoying. We also found it helpful to hide the field by entering a “1” in the “Hide object when” Inspector field Behavior area. Then drag the gSoundPlayer field into the header or footer of the layout so there is only one instance of it on a list view. This is critical to avoid multiple instances of the field on one layout that creates an issue where they try to all play simultaneously and ruin the sound quality.

The script to Play the sound moves the sound from the Sound container field to the global gSoundPlayer field. Upon doing so it will automatically play. Then the script waits for a few seconds for the duration of the sound if it can be calculated or 5 seconds if unknown or >= 10 seconds (wav files). It then clears the field stopping the sound play.

Pretty straight forward once you know the trick. Download the sample file at the end of the article. You can use it to create your own sound collection and play them on demand.

Additional resources

Claris product features

See why Claris products are the top choice for developers for their low code needs.

See features

Product resources

Get instant access to helpful resources and start creating custom apps today.

Get resources