From bb833fe84ac4c3b89c8f8cc00f5fc4ac8c5b6d9f Mon Sep 17 00:00:00 2001 From: Jacob Lee Date: Fri, 3 Dec 2021 14:24:36 -0500 Subject: Additive synthesis works! Clean up needed --- klangfarb/.import/.gdignore | 1 + klangfarb/main.gd | 32 ++++++++++++++++---------------- 2 files changed, 17 insertions(+), 16 deletions(-) create mode 100644 klangfarb/.import/.gdignore (limited to 'klangfarb') diff --git a/klangfarb/.import/.gdignore b/klangfarb/.import/.gdignore new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/klangfarb/.import/.gdignore @@ -0,0 +1 @@ + diff --git a/klangfarb/main.gd b/klangfarb/main.gd index 86ebc87..590d45b 100644 --- a/klangfarb/main.gd +++ b/klangfarb/main.gd @@ -41,19 +41,19 @@ func _fill_buffer() -> void: # playback stream buffer playback.push_buffer(synth.frames(to_fill)) -func _check_waveform(): - if waveform == "square": - synth.square() - elif waveform == "sine": - synth.sine() - elif waveform == "triangle": - synth.triangle() - elif waveform == "sawtooth": - synth.sawtooth() - elif waveform == "white_noise": - synth.white_noise() - elif waveform == "brown_noise": - synth.brown_noise() +#func _check_waveform(): + #if waveform == "square": + #synth.square() + #elif waveform == "sine": + #synth.sine() + #elif waveform == "triangle": + #synth.triangle() + #elif waveform == "sawtooth": + #synth.sawtooth() + #elif waveform == "white_noise": + #synth.white_noise() + #elif waveform == "brown_noise": + #synth.brown_noise() func _process(_delta): if self.is_playing(): @@ -68,7 +68,7 @@ func _process(_delta): synth.set_decay(decay) synth.set_sustain(sustain) synth.set_release(release) - _check_waveform() + # _check_waveform() _fill_buffer() func _ready() -> void: @@ -79,7 +79,7 @@ func _ready() -> void: # get our AudioStreamPlayback object playback = self.get_stream_playback() # prefill the stream's sample buffer (which feeds DAC) - _check_waveform() + #_check_waveform() _fill_buffer() func _input(event): @@ -89,7 +89,7 @@ func _input(event): synth.trigger() elif event is InputEventMouseMotion: freq = event.position.x - synth.frequency(freq) + # synth.frequency(freq) # phasor_bend.x = event.position.x / 1024 # phasor_bend.y = event.position.y / 600 fm_multiplier = 600 / (event.position.y + 1) -- cgit v1.2.3