Audio alert, sound, beep or buzzer

Product: PowerShell Universal
Version: 1.5.16

Thought i would throw out a random one… Has anyone worked out how to make an audio alert from UD? I have attempted various posts, like https://forums.ironmansoftware.com/t/building-the-sound-module/2300 or https://forums.ironmansoftware.com/t/help-play-audio-onevent/2220 but i cant seem to get anything to make a noise say click a button and it beeps (or other sound)

Any ideas?

@McAndersDK @AlonGvili @KelDinn - any ideas would really help here!

@psDevUK - dont suppose you have a random component for this that you are hiding :wink:

The idea is, i have written a front end for woocommerce, when an order pops in, we need an audio alert! sounds easy but digging into it, not so easy! I would use the printer buzzers but they dont work either…

Cheers!

Hi @neo I got tomorrow off work, need to be looking for a job really, as I recently got made redundant, which sucks, but hey this covid thing has done a whole lot more damage to other people. Sound is one area I have not looked into yet in react, which is a bit weird as I used to love playing vinyl on my technic 1210s back in the day. Anyways man I am happy to do some research maybe today or tomorrow…I don’t want to promise anything but more than happy to be a have a go hero on the challenge.

Boom I do have a working solution…sadly I was having issues getting this to build as a component, I tried a few out there, but things didn’t quite go to plan…So I thought about the awesome Invoke-UDJavascript that @BoSen29 brought to the build a while back.
Went for something simple:-

New-UDDashboard -Title "Sound Demo" -Content {
New-UDButton -Text 'Click For Sound' -OnClick {
    Show-UDToast -Message 'Wait for the rocket sound!'
    Invoke-UDJavascript -Javascript "var audio = new Audio('https://assets.coderrocketfuel.com/pomodoro-times-up.mp3');audio.play();"
}   
}

I tested this on remote desktop connection with sound (as not in office) and all was good. So this should allow you to play any sound using this technique shown above, for when you want an alert sound to play.
I hope this is what you are after to get the desired results. :smile:

Ah man! you are a legend… how have i come this far with UD and not known about Invoke-UdJavascript!

Thanks once again!

2 Likes