Last active
April 3, 2020 20:59
-
-
Save havenwood/5a0de73eb4fb2581f38d33fc1644656f to your computer and use it in GitHub Desktop.
Example refactor for akem on #ruby IRC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
File.open IO::NULL, 'w' do |dev_null| | |
File.readlines('samples.txt', chomp: true).each do |sample| | |
sample_speed = rand(0.1..1.0) | |
cmd = "play -v 1 \"#{sample}\"" | |
puts cmd | |
if rand(2).zero? | |
Process.detach spawn(cmd, err: :out, out: dev_null) | |
else | |
system(cmd) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment