Show HN: Jazz up your Python scripts with sound effects
github.com
github.com
If I were you, I'd try and find something that is Creative Commons, CC0 is best (the most permissive CC license). And then you can say in your disclaimer that the audio is CC licensed, which is ideal.
Using language that makes one amenable to takedown requests might be fine. But it’s no defense for infringing on others’ copyrights by posting their IP without a license.
OP, take parent comment’s advice and find some appropriately licensed music.
If only copyright were actually that simple. The music might be, and the performance not, or vice versa. Maybe the rights were assumed to be public domain, and then a company discovers the rights in their vault. Maybe the license is permissive, but one of the many people involved never agreed to it, and that means that it retroactively isn't licensed permissively.
All of the above have happened before.
Imagine running a long ML training script. Hearing a sound in your speakers when it ends (successfuly or not) is something I considered implementing, non ironically, at my job. Never got around to doing it.
long_running_command && say "That's all folks" 0 17 * * 1-5 say "You're gonna miss the train go now!!"
Which I put on my work computer. Since it came out of the speaker most of the time, not only did I not miss the train, but everyone else knew I had to go and respected that. alias SUCCESS='echo -e '\''\n\nSUCCESS'\''
&& bash -c '\''mpv ~/bin/kazoo-fanfare.mp3 &'\''
|| echo FAILED' # or play sad trombone sound
# (some escaping might not survive ...)
It's an always too-loud and too-annoying "Tadaa!" style fanfare that is very clearly NOT my music, and I will very frequently use it in the context of `make test && SUCCESS` to monitor long-running test suites while I do other work.I use this after my long-running Maven builds to play either a happy sound if the build succeeds or a sad (mocking) sound if it fails, based on the value of $?.
On Linux there's usually `aplay` but you'll need play (sox) or mpv etc. to play lossy-compressed audio... a bunch of sounds can be found under /usr/share/sounds/ depending on what's installed.
`espeak-ng` doesn't have as good voices as `say`, but some `festival` ones come close, although these days I usually use Googles tts, and save the ones I use frequently.
Here's the reference book on the topic: https://sonification.de/handbook/ (PDF is on the right menu)
some_long_command | mail -s "Command finished" email@example.com printf '\a'
or if you want to display a MacOS notification function alert {
osascript -e 'display notification "'"$1"'"'
}You can usually also type it after the command has started and it’ll still work
python -c 'print("\a")'
without thinking too much about it, but yours is way nicer!It works pretty well, but can be annoying when it goes off in a Zoom call...
Could you explain in detail or perhaps make a youtube video?
subprocess.Popen(['cvlc','--play-and-exit','/home/me/music/trumpet.mp3'])
Going to give your library a try!