diff options
author | Grant Shangreaux <grant@unabridgedsoftware.com> | 2021-11-13 19:55:09 -0600 |
---|---|---|
committer | Grant Shangreaux <grant@unabridgedsoftware.com> | 2021-11-13 19:55:09 -0600 |
commit | c7e88b7d605fd19d9ff54681a42fd69d079d92b1 (patch) | |
tree | 280d7019d5ce8576458098f36cdea2112814fd4a /klangfarb | |
parent | 31e34297ed073927a63d0d9fccafc868998b8f46 (diff) |
Add: Envelope Iterator implementation and click to trigger note
Diffstat (limited to 'klangfarb')
-rw-r--r-- | klangfarb/main.gd | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/klangfarb/main.gd b/klangfarb/main.gd index 268934f..751527a 100644 --- a/klangfarb/main.gd +++ b/klangfarb/main.gd @@ -57,19 +57,19 @@ func _check_waveform(): func _process(_delta): if self.is_playing(): - synth.apply_bend(apply_bend) - synth.frequency(freq) - synth.phasor_bend(phasor_bend) +# synth.apply_bend(apply_bend) +# synth.frequency(freq) +# synth.phasor_bend(phasor_bend) synth.frequency_modulation(frequency_modulation) - synth.fm_frequency(fm_multiplier * freq) +# synth.fm_frequency(fm_multiplier * freq) synth.fm_depth(fm_index) synth.continuous(continuous) _check_waveform() _fill_buffer() func _ready() -> void: - # buffer length of 100ms gives us ~realtime response to input changes - self.stream.buffer_length = 0.1 + # buffer length of 10ms gives us ~realtime response to input changes + self.stream.buffer_length = 0.05 # ensure Godot/Sine have the same sample rate synth.set_sample_rate(self.stream.mix_rate) # get our AudioStreamPlayback object @@ -80,10 +80,13 @@ func _ready() -> void: func _input(event): # Mouse in viewport coordinates. - if event is InputEventMouseButton: + if event is InputEventMouseButton && event.is_pressed(): print("Mouse Click/Unclick at: ", event.position) + synth.trigger() elif event is InputEventMouseMotion: freq = event.position.x + synth.frequency(freq) # phasor_bend.x = event.position.x / 1024 # phasor_bend.y = event.position.y / 600 fm_multiplier = 600 / (event.position.y + 1) + synth.fm_frequency(fm_multiplier * freq) |