Shing Lyu

Generating a notification sound in command-line

By Shing Lyu    

Disclaimer: The views expressed here are my own; they do not reflect the views of my current and past employers.

You want to play a notification sound in a Linux shell script, but don’t want to download any sound files (e.g. MP3, WAV, MIDI). Here is a script that generates the sound on-the-fly:

First install SoX, the Swiss Army knife of sound processing programs.

sudo apt-get install sox

Then:

play -n synth 0.3 pluck A3 vol -20dB repeat 2

Want to learn Rust? Check out my books:

Also available on O'Reilly and Amazon