Skip to content

Instantly share code, notes, and snippets.

@koyachi
Created October 11, 2011 14:27
Show Gist options
  • Save koyachi/1278218 to your computer and use it in GitHub Desktop.
Save koyachi/1278218 to your computer and use it in GitHub Desktop.
require 'coreaudio'
dev = CoreAudio.default_output_device
buf = dev.output_loop(44000)
line = ARGV[0]
puts line
44000.times do |t|
# buf[i] = 0x3FFF * rand()
# buf[i] = t * ((t >> 9 | t >> 13) & 25 & t >> 6)
buf[t] = eval line
end
buf.start
sleep 10
buf.stop
__END__
SYNOPSIS:
% ruby _dev_audio.rb 't * ((t >> 9 | t >> 13) & 25 & t >> 6)'
SEE ALSO:
http://d.hatena.ne.jp/miujun/20111003
https://github.com/nagachika/ruby-coreaudio/blob/master/examples/outloop_sine.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment