Skip to content

Instantly share code, notes, and snippets.

@kristopherjohnson
Created February 15, 2020 00:54
Show Gist options
  • Save kristopherjohnson/9ee6cfdbc57b75be6b06597ffb296681 to your computer and use it in GitHub Desktop.
Save kristopherjohnson/9ee6cfdbc57b75be6b06597ffb296681 to your computer and use it in GitHub Desktop.
AppleScripts for using SoX to play white noise
-- Choose a white noise generator and play.
--
-- Requires installation of SoX <http://sox.sourceforge.net>
-- With Homebrew: brew install sox
--
-- Starts a background process. Kill it with command "killall play" or by running the "Stop Playing" script.
set theSynth to ¬
choose from list {"pinknoise", "whitenoise", "brownnoise"} ¬
with prompt ¬
"Choose a synth" without multiple selections allowed and empty selection allowed
if not theSynth = false then
do shell script "/usr/local/bin/play -c2 -n synth " & (first item of theSynth) & " &>/dev/null & echo $!"
end if
-- Stops all /usr/local/bin/play processes
do shell script "killall play &> /dev/null &"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment