Sha256: e25e7edba8edfa27de6b60c04c2fab3f333de8829ee71e36db6dd57ea8de3369

Contents?: true

Size: 236 Bytes

Versions: 12

Compression:

Stored size: 236 Bytes

Contents

require "coreaudio"

dev = CoreAudio.default_output_device
buf = dev.output_loop(44000)

phase = Math::PI * 2.0 * 440.0 / 44000.0
44000.times do |i|
  buf[i] = ((0.4 * Math.sin(phase*i)) * 0x7FFF).round
end

buf.start
sleep 2
buf.stop

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
coreaudio-0.0.12 examples/outloop_sine.rb
coreaudio-0.0.11 examples/outloop_sine.rb
coreaudio-0.0.10 examples/outloop_sine.rb
coreaudio-0.0.9 examples/outloop_sine.rb
coreaudio-0.0.8 examples/outloop_sine.rb
coreaudio-0.0.7 examples/outloop_sine.rb
coreaudio-0.0.6 examples/outloop_sine.rb
coreaudio-0.0.5 examples/outloop_sine.rb
coreaudio-0.0.4 examples/outloop_sine.rb
coreaudio-0.0.3 examples/outloop_sine.rb
coreaudio-0.0.2 examples/outloop_sine.rb
coreaudio-0.0.1 examples/outloop_sine.rb