Method: AudioStream::AudioInputMetronome#initialize
- Defined in:
- lib/audio_stream/audio_input_metronome.rb
#initialize(bpm:, beat: 4, repeat: nil, soundinfo:) ⇒ AudioInputMetronome
Returns a new instance of AudioInputMetronome.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/audio_stream/audio_input_metronome.rb', line 5 def initialize(bpm:, beat: 4, repeat: nil, soundinfo:) super() @bpm = bpm @beat = beat.to_i @repeat = repeat @synth = Synthesizer::PolySynth.new( oscillators: Synthesizer::Oscillator.new( source: Synthesizer::OscillatorSource::Sine.instance, phase: 0, ), amplifier: Synthesizer::Amplifier.new( volume: Synthesizer::ModulationValue.new(1.0) .add(Synthesizer::Modulation::Adsr.new( attack: 0.0, hold: 0.05, decay: 0.0, sustain: 0.0, release: 0.0 ), depth: 1.0), ), soundinfo: soundinfo, ) @soundinfo = soundinfo end |