add new controls

+ rename slide_speed > slidespeed
This commit is contained in:
Felix Roos 2023-09-04 18:38:05 +02:00
parent 60f5032b12
commit 3ba195c2d9
2 changed files with 8 additions and 5 deletions

View File

@ -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

View File

@ -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 };