News for hackers. Stuff that matters.
Re:Show HN: Jazz up your Python scripts with sound effects by roywiggins on Tuesday September 15, 2020 @03:59PM (#24486036)
"No Copyright Infringement Intended" is a meaningless disclaimer. Either the music is public-domain or permissively licensed and you're fine, or it's not and you're probably not.

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.

Re:Show HN: Jazz up your Python scripts with sound effects by joan_kode on Tuesday September 15, 2020 @04:49PM (#24486538)
It's obviously not supposed to be a disclaimer of any legal value, judging from the sentence immediately after your quote: "I might take down these tracks or add more depending on the number of lawsuits I get slapped with". I don't particularly condone this attitude, but at least it's pretty clear. Either you slap him with a lawsuit/DMCA and the tracks will be removed or you don't and they probably won't.
Re:Show HN: Jazz up your Python scripts with sound effects by phantomshelby on Tuesday September 15, 2020 @04:57PM (#24486615)
Hey OP here, the tracks I used are taken from https://www.youtube.com/user/gamingsoundfx which is kinda a royalty-free stock audio library, I realise now that my statement that was funny when I wrote it might come back to haunt me dreams so I am gonna update it, Thanks for letting me know
Re:Show HN: Jazz up your Python scripts with sound effects by skocznymroczny on Wednesday September 16, 2020 @04:58AM (#24490834)
I wouldn't describe it as 'royalty-free stock audio library'. It's obvious many sounds aren't free to use, be it rips from games or TV shows.
Re:Show HN: Jazz up your Python scripts with sound effects by devenblake on Tuesday September 15, 2020 @05:48PM (#24487116)
The DMCA process with GitHub and most hosting sites is very straightforward and mostly automatic, I don't see why it would be a problem. With most older works it's nigh impossible to figure out who owns the copyright anyway.
Re:Show HN: Jazz up your Python scripts with sound effects by shakna on Tuesday September 15, 2020 @09:47PM (#24488768)
> Either the music is public-domain or permissively licensed and you're fine, or it's not and you're probably not.

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.

Re:Show HN: Jazz up your Python scripts with sound effects by jagged-chisel on Tuesday September 15, 2020 @07:25PM (#24487880)
Regardless of intent, infringement happens. Someone making the above statement seems to think “infringement” means “plagiarism.” Also, a DMCA takedown request isn’t “being slapped with a lawsuit.”

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.

Re:Show HN: Jazz up your Python scripts with sound effects by tapland on Tuesday September 15, 2020 @06:47PM (#24487620)
Made me remember the wild homemade sound effects on 90s shareware games
[dead]
Re:Show HN: Jazz up your Python scripts with sound effects by Bjartr on Wednesday September 16, 2020 @04:17AM (#24490618)
Which laws are okay to break for the sake of a joke and which aren't?
Re:Show HN: Jazz up your Python scripts with sound effects by H8crilA on Tuesday September 15, 2020 @03:57PM (#24486014)
This is useful!

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.

Re:Show HN: Jazz up your Python scripts with sound effects by stonewareslord on Tuesday September 15, 2020 @08:09PM (#24488172)
On Mac or Linux, I run "tput bel" to the end of expextedly long-running commands. On Mac, the icon bounces and system makes a beep sound. On linux (i3/urxvt), the window and workspace turns red until I focus it.

You can usually also type it after the command has started and it’ll still work

Re:Show HN: Jazz up your Python scripts with sound effects by uryga on Wednesday September 16, 2020 @06:40AM (#24491316)
i've always used

  python -c 'print("\a")'
without thinking too much about it, but yours is way nicer!
Re:Show HN: Jazz up your Python scripts with sound effects by Resinderate on Tuesday September 15, 2020 @04:18PM (#24486249)
Do this sometimes on mac, simply with:

  long_running_command && say "That's all folks"
Re:Show HN: Jazz up your Python scripts with sound effects by jedberg on Tuesday September 15, 2020 @04:30PM (#24486359)
My favorite cron of all time was:

    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.
Re:Show HN: Jazz up your Python scripts with sound effects by computronus on Tuesday September 15, 2020 @05:34PM (#24486975)
The built-in `afplay` shell command works for mp3s and for the stock aiff sounds under /System/Library/Sounds.

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 $?.

Re:Show HN: Jazz up your Python scripts with sound effects by lozf on Tuesday September 15, 2020 @09:21PM (#24488619)
Love the idea of checking the exit code! Seems I have some modifications to do.

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.

Re:Show HN: Jazz up your Python scripts with sound effects by gknoy on Tuesday September 15, 2020 @04:37PM (#24486424)
I do the same thing with a shell alias called `SUCCESS`:

  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.
Re:Show HN: Jazz up your Python scripts with sound effects by joshvm on Tuesday September 15, 2020 @07:55PM (#24488069)
There is a very simple way to tell if an ML script has failed: the GPU fans turn off. No joke. Even with a water cooled machine, I know something has gone wrong if I come back in an hour and the rig is silent.
Re:Show HN: Jazz up your Python scripts with sound effects by jcelerier on Tuesday September 15, 2020 @05:52PM (#24487148)
There's a whole research field about doing that actually.

Here's the reference book on the topic: https://sonification.de/handbook/ (PDF is on the right menu)

Re:Show HN: Jazz up your Python scripts with sound effects by asah on Tuesday September 15, 2020 @04:14PM (#24486222)
Another super easy option: send a slack message on a private channel (one LOC) which turns into a combo desktop and cellphone notification, which you can disable during sleeping hours, flow into zapier/ifttt etc etc etc
Re:Show HN: Jazz up your Python scripts with sound effects by encom on Tuesday September 15, 2020 @07:14PM (#24487812)
Re:Show HN: Jazz up your Python scripts with sound effects by nicbou on Tuesday September 15, 2020 @07:53PM (#24488061)
I have an alias called "ding" that plays a sound. Add "; ding" to a command and you're set.
Re:Show HN: Jazz up your Python scripts with sound effects by ketzo on Tuesday September 15, 2020 @07:59PM (#24488103)
Wow, I love that. Would you mind posting the full alias?
Re:Show HN: Jazz up your Python scripts with sound effects by nicbou on Wednesday September 16, 2020 @04:10AM (#24490575)

    printf '\a'
or if you want to display a MacOS notification

    function alert {
        osascript -e 'display notification "'"$1"'"'
    }
Re:Show HN: Jazz up your Python scripts with sound effects by this_machine on Saturday September 19, 2020 @01:04PM (#24528842)
I liked this idea so I packaged 'ding' into something you can install[1].

[1] https://github.com/alexdelorenzo/onhold

Re:Show HN: Jazz up your Python scripts with sound effects by vimax on Tuesday September 15, 2020 @09:36PM (#24488707)
Or for system monitoring. You could have different function play different sounds so the whole program sounds melodic in normal operation. If the melody is off or you hear discordant notes then you know something's up.
Re:Show HN: Jazz up your Python scripts with sound effects by rattray on Tuesday September 15, 2020 @10:53PM (#24489109)
Agreed! I played the star wars opening track on the conclusion of a script I wasn't sure would terminate. Very exciting. But turned out to have been triggered on an unexpected error case :(
Re:Show HN: Jazz up your Python scripts with sound effects by mac-chaffee on Tuesday September 15, 2020 @06:10PM (#24487323)
If you're using a cloud-based linux server, most of them have "mail":

    some_long_command | mail -s "Command finished" [email protected]
Re:Show HN: Jazz up your Python scripts with sound effects by nl on Wednesday September 16, 2020 @01:14AM (#24489749)
I put 'say Data Prep phase 1 complete' in my training scripts.

It works pretty well, but can be annoying when it goes off in a Zoom call...

Re:Show HN: Jazz up your Python scripts with sound effects by saboot on Tuesday September 15, 2020 @11:43PM (#24489344)
My personal approach is a shell script that calls the slack webhook api, so I get a slack message when my job finishes.
Re:Show HN: Jazz up your Python scripts with sound effects by petargyurov on Tuesday September 15, 2020 @04:10PM (#24486182)
I like this. It doesn't take itself seriously and implementing it via decorators is a great choice. Might use it in some hobby scripts!
Re:Show HN: Jazz up your Python scripts with sound effects by fredley on Tuesday September 15, 2020 @03:42PM (#24485849)
This will go great with my analogue terminal bell! https://news.ycombinator.com/item?id=24432930
Re:Show HN: Jazz up your Python scripts with sound effects by phantomshelby on Tuesday September 15, 2020 @04:59PM (#24486648)
Looks super cool : ) always loved old school
Re:Show HN: Jazz up your Python scripts with sound effects by mattgreenrocks on Tuesday September 15, 2020 @06:56PM (#24487678)
In the past, I’ve used the Mac’s text to speech capabilities to help debug async shell prompts. It’s hard to relate but using aural cues as clues to execution paths feels quite different from print-based debugging.
Re:Show HN: Jazz up your Python scripts with sound effects by just-juan-post on Tuesday September 15, 2020 @07:12PM (#24487796)
Ok that's a seriously awesome idea. It's kinda like sonar: You know what's normal and then listen for the differences?

Could you explain in detail or perhaps make a youtube video?

Re:Show HN: Jazz up your Python scripts with sound effects by jerf on Tuesday September 15, 2020 @11:55PM (#24489399)
Not the question you asked, but I bet you find this interesting: https://www.computerworld.com/article/2771333/the-history-of... , I'm referencing the part after "The best ping story".
Re:Show HN: Jazz up your Python scripts with sound effects by canada_dry on Tuesday September 15, 2020 @09:01PM (#24488513)
Getting mp3 to play on linux via python for some reason has been a challenge, and I ended up using this abomination:

  subprocess.Popen(['cvlc','--play-and-exit','/home/me/music/trumpet.mp3'])  
Going to give your library a try!
Re:Show HN: Jazz up your Python scripts with sound effects by thehappypm on Wednesday September 16, 2020 @02:43PM (#24495946)
This doesn't look like an abomination to me!
Re:Show HN: Jazz up your Python scripts with sound effects by jedberg on Tuesday September 15, 2020 @04:03PM (#24486103)
FYI if you're on a Mac using a Virtualenv, you might need to do 'pip install pyobjc' to get the music to play.
Re:Show HN: Jazz up your Python scripts with sound effects by mixmastamyk on Wednesday September 16, 2020 @01:12AM (#24489742)
Reminds me of a similar but slightly more direct module I wrote named boombox:

https://pypi.org/project/boombox/

Re:Show HN: Jazz up your Python scripts with sound effects by byteface on Wednesday September 16, 2020 @04:15AM (#24490606)
great. now to add benny hill theme to all bulid scripts... https://www.youtube.com/watch?v=MK6TXMsvgQg
Re:Show HN: Jazz up your Python scripts with sound effects by harveywi on Tuesday September 15, 2020 @04:22PM (#24486294)
Fezzik, do you hear that? That is the sound of ultimate suffering.
Re:Show HN: Jazz up your Python scripts with sound effects by Fishysoup on Tuesday September 15, 2020 @06:55PM (#24487671)
I just discovered I've always wanted this.
Re:Show HN: Jazz up your Python scripts with sound effects by griffinkelly on Tuesday September 15, 2020 @06:40PM (#24487564)
I have nightmares of the error sounds from Matlab, not sure if I need this in my python anytime soon.
Re:Show HN: Jazz up your Python scripts with sound effects by monadic2 on Tuesday September 15, 2020 @11:59PM (#24489422)
This is violence.