Class: SynthBlocks::Core::WaveWriter
- Inherits:
-
Object
- Object
- SynthBlocks::Core::WaveWriter
- Defined in:
- lib/synth_blocks/core/wave_writer.rb,
lib/synth_blocks/core/wave_writer.rb
Class Method Summary collapse
-
.write_if_name_given(samples) ⇒ Object
Static method to write to file given as first argument IF given.
Instance Method Summary collapse
-
#initialize(filename) ⇒ WaveWriter
constructor
A new instance of WaveWriter.
- #write(float_data) ⇒ Object
Constructor Details
#initialize(filename) ⇒ WaveWriter
Returns a new instance of WaveWriter.
22 23 24 |
# File 'lib/synth_blocks/core/wave_writer.rb', line 22 def initialize(filename) @filename = filename end |
Class Method Details
.write_if_name_given(samples) ⇒ Object
Static method to write to file given as first argument IF given
16 17 18 |
# File 'lib/synth_blocks/core/wave_writer.rb', line 16 def self.write_if_name_given(samples) raise "Not Implemented in OPAL" end |
Instance Method Details
#write(float_data) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/synth_blocks/core/wave_writer.rb', line 26 def write(float_data) buffer = WaveFile::Buffer.new(float_data, WaveFile::Format.new(:mono, :float, 44100)) WaveFile::Writer.new(@filename, WaveFile::Format.new(:mono, :pcm_16, 44100)) do |writer| writer.write(buffer) end end |