From 3ba195c2d91af5cfe5675e0e8b00f3f242af688c Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Mon, 4 Sep 2023 18:38:05 +0200 Subject: [PATCH] add new controls + rename slide_speed > slidespeed --- packages/core/controls.mjs | 3 +++ packages/superdough/synth.mjs | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/core/controls.mjs b/packages/core/controls.mjs index 71f58427..36a5728b 100644 --- a/packages/core/controls.mjs +++ b/packages/core/controls.mjs @@ -664,7 +664,10 @@ const generic_params = [ // TODO: LFO rate see https://tidalcycles.org/docs/patternlib/tutorials/synthesizers/#supersquare ['rate'], // TODO: slide param for certain synths + ['vibrato'], + ['vdepth'], ['slide'], + ['slidespeed'], // TODO: detune? https://tidalcycles.org/docs/patternlib/tutorials/synthesizers/#supersquare ['semitone'], // TODO: dedup with synth param, see https://tidalcycles.org/docs/reference/synthesizers/#superpiano diff --git a/packages/superdough/synth.mjs b/packages/superdough/synth.mjs index e1d7905c..4ebfb3ac 100644 --- a/packages/superdough/synth.mjs +++ b/packages/superdough/synth.mjs @@ -43,7 +43,7 @@ export function registerSynthSounds() { vibrato = 0, vdepth = 100, slide, - slide_speed = 1, + slidespeed = 1, } = value; let { n, note, freq } = value; // with synths, n and note are the same thing @@ -64,7 +64,7 @@ export function registerSynthSounds() { vibrato, vdepth, slide: slide * freq, - slide_speed: sustain / slide_speed, + slidespeed: sustain / slidespeed, partials: n, }); @@ -150,7 +150,7 @@ export function waveformN(partials, type) { return osc; } -export function getOscillator({ s, freq, t, vibrato, vdepth, slide, slide_speed, partials }) { +export function getOscillator({ s, freq, t, vibrato, vdepth, slide, slidespeed, partials }) { // Additional oscillator for vibrato effect if (vibrato > 0) { var vibrato_oscillator = getAudioContext().createOscillator(); @@ -168,7 +168,7 @@ export function getOscillator({ s, freq, t, vibrato, vdepth, slide, slide_speed, if (vibrato > 0) { o.frequency.value = Number(freq); - slide > 0 && o.frequency.linearRampToValueAtTime(freq + slide, t + slide_speed); + slide > 0 && o.frequency.linearRampToValueAtTime(freq + slide, t + slidespeed); var gain = getAudioContext().createGain(); gain.gain.value = vdepth * 100; vibrato_oscillator.connect(gain); @@ -185,7 +185,7 @@ export function getOscillator({ s, freq, t, vibrato, vdepth, slide, slide_speed, } else { // Normal operation, without vibrato o.frequency.value = Number(freq); - slide > 0 && o.frequency.linearRampToValueAtTime(freq + slide, t + slide_speed); + slide > 0 && o.frequency.linearRampToValueAtTime(freq + slide, t + slidespeed); o.start(t); const stop = (time) => o.stop(time); return { node: o, stop };