Is there something so I can play a noise when Julia finished running? Like I have

is there something so I can play a noise when Julia finished running? Like I have a function

function foo(beta)
    beta[1].^2.0 - beta[2].^0.5

    #Function that pops off a sound
    noise() #Does this exist?
end

and want a sound to pop off in the end

Note that the original poster on Slack cannot see your response here on Discourse. Consider transcribing the appropriate answer back to Slack, or pinging the poster here on Discourse so they can follow this thread.
(Original message :slack:) (More Info)

2 Likes

One option: you can try my package, Alert.jl. It creates a notification, which, depending on your os settings will play a sounds as well.

6 Likes

You can use the run command to play a sound with a music player.
In linux I use the following:

run(play "pathToFolder/soundFileName", wait=false)

e.g.

run(play "mySound.mp3", wait=false)

1 Like

print('\u0007') prints the BEL character, which in many terminals will cause a beep to sound. print('\u0007'^5) for 5 beeps.

5 Likes

On Mac OS, my favorite is to put a line with

run(`say \"I am done\"`)

It’s kind of fun to watch the reactions of nearby colleagues too when the oracle speaks.

6 Likes

For those on Windows, some text-to-speech can be called using:

str = "I'm done!"
run(`powershell -Command "\$sp = New-Object -ComObject SAPI.SpVoice; \$sp.Speak(\"$str\")"`)

And a basic beep, with pitch and duration, using:

run(`powershell -Command "[console]::beep(600,300)"`)
4 Likes