Introducing the Sonic_pi gem

require 'sonic_pi'

s =<<EOF
loop do
  sample :perc_bell, rate: (rrand 0.125, 1.5)
  sleep rrand(0, 2)
end
EOF

sp = SonicPi.new
sp.run(s)
sleep 6
sp.stop

The above code plays the Haunted Bells example which I copied from sonic-pi.net.

Note: I luckily discovered the Sonic_pi gem via www.reddit.com/r/ruby [reddit.com] which I accessed using TOR since my ISP blocks access to Reddit.com.

Resources

Tags:
Source:
2122hrs.txt
Published:
19-02-2015 21:22