system.util.playSoundClip

Hello
So could help me, please?
I want to play sound wav in my ignition application and I don know where I have to save my file with wav effects. I think that I will have a sound file on the server and then I will play the sound. I must save my file to the root folder on my project? And what will then be the path?
It will be some this?

system.util.playSoundClip("C:\\MyRootFolder\\....\\siren.wav") 

My root application folder is :
" C:\Program Files\Inductive Automation\Ignition\data\projects\OPT_Reports"
Because this choice isn’t function :frowning:
Than you :smiley:

Are you trying to play a sound in Vision, or Perspective, or from wherever the gateway is running over whatever local speakers are connected?

Vision:
Use the Sound Player.

Perspective:
Use the Audio component (requires 8.1.16+).

Only in the rare case where you need to play unsolicited audio directly from a script would you use playSoundClip.

As for usage, you supply playSoundClip with the raw content of an audio file to pass to your speakers, so you would need to e.g. system.file.readFileAsBytes(path) and then pass the byte array to playSoundClip. The path to use to the file is going to depend on where you’re invoking your script from.

Thank you
I use Perspective but I don’t have component Audio I probably I have version 8.1.9 :frowning:
Is it possible how I can play my sound?

The right way would be to upgrade :slight_smile:
It's free to upgrade to the latest release of the same major version.

The workaround solution would be to use the iframe-based 'hack' described here:

You'll need to host your files in some way that's accessible (over the network) to everywhere you're launching Perspective sessions from.

Ok thank you for me will be better upgrade :smiley:

1 Like