Sha256: ad84f9f8b0f7084401f6599fe7c65a38bff18fd311b6637d1f31c2002693eeb2
Contents?: true
Size: 376 Bytes
Versions: 3
Compression:
Stored size: 376 Bytes
Contents
require "coreaudio" dev = CoreAudio.default_output_device buf = dev.output_buffer(1024) phase = Math::PI * 2.0 * 440.0 / dev.nominal_rate th = Thread.start do i = 0 loop do wav = Array.new(1024){|j| (0.4 * Math.sin(phase*(i+j)) * 0x7FFF).round } i += 1024 buf << wav end end buf.start sleep 2 buf.stop puts "#{buf.dropped_frame} frame dropped." th.kill
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
coreaudio-0.0.3 | examples/outbuffer_sine.rb |
coreaudio-0.0.2 | examples/outbuffer_sine.rb |
coreaudio-0.0.1 | examples/outbuffer_sine.rb |