add new controls
+ rename slide_speed > slidespeed
This commit is contained in:
parent
60f5032b12
commit
3ba195c2d9
2 changed files with 8 additions and 5 deletions
|
|
@ -664,7 +664,10 @@ const generic_params = [
|
||||||
// TODO: LFO rate see https://tidalcycles.org/docs/patternlib/tutorials/synthesizers/#supersquare
|
// TODO: LFO rate see https://tidalcycles.org/docs/patternlib/tutorials/synthesizers/#supersquare
|
||||||
['rate'],
|
['rate'],
|
||||||
// TODO: slide param for certain synths
|
// TODO: slide param for certain synths
|
||||||
|
['vibrato'],
|
||||||
|
['vdepth'],
|
||||||
['slide'],
|
['slide'],
|
||||||
|
['slidespeed'],
|
||||||
// TODO: detune? https://tidalcycles.org/docs/patternlib/tutorials/synthesizers/#supersquare
|
// TODO: detune? https://tidalcycles.org/docs/patternlib/tutorials/synthesizers/#supersquare
|
||||||
['semitone'],
|
['semitone'],
|
||||||
// TODO: dedup with synth param, see https://tidalcycles.org/docs/reference/synthesizers/#superpiano
|
// TODO: dedup with synth param, see https://tidalcycles.org/docs/reference/synthesizers/#superpiano
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ export function registerSynthSounds() {
|
||||||
vibrato = 0,
|
vibrato = 0,
|
||||||
vdepth = 100,
|
vdepth = 100,
|
||||||
slide,
|
slide,
|
||||||
slide_speed = 1,
|
slidespeed = 1,
|
||||||
} = value;
|
} = value;
|
||||||
let { n, note, freq } = value;
|
let { n, note, freq } = value;
|
||||||
// with synths, n and note are the same thing
|
// with synths, n and note are the same thing
|
||||||
|
|
@ -64,7 +64,7 @@ export function registerSynthSounds() {
|
||||||
vibrato,
|
vibrato,
|
||||||
vdepth,
|
vdepth,
|
||||||
slide: slide * freq,
|
slide: slide * freq,
|
||||||
slide_speed: sustain / slide_speed,
|
slidespeed: sustain / slidespeed,
|
||||||
partials: n,
|
partials: n,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -150,7 +150,7 @@ export function waveformN(partials, type) {
|
||||||
return osc;
|
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
|
// Additional oscillator for vibrato effect
|
||||||
if (vibrato > 0) {
|
if (vibrato > 0) {
|
||||||
var vibrato_oscillator = getAudioContext().createOscillator();
|
var vibrato_oscillator = getAudioContext().createOscillator();
|
||||||
|
|
@ -168,7 +168,7 @@ export function getOscillator({ s, freq, t, vibrato, vdepth, slide, slide_speed,
|
||||||
|
|
||||||
if (vibrato > 0) {
|
if (vibrato > 0) {
|
||||||
o.frequency.value = Number(freq);
|
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();
|
var gain = getAudioContext().createGain();
|
||||||
gain.gain.value = vdepth * 100;
|
gain.gain.value = vdepth * 100;
|
||||||
vibrato_oscillator.connect(gain);
|
vibrato_oscillator.connect(gain);
|
||||||
|
|
@ -185,7 +185,7 @@ export function getOscillator({ s, freq, t, vibrato, vdepth, slide, slide_speed,
|
||||||
} else {
|
} else {
|
||||||
// Normal operation, without vibrato
|
// Normal operation, without vibrato
|
||||||
o.frequency.value = Number(freq);
|
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);
|
o.start(t);
|
||||||
const stop = (time) => o.stop(time);
|
const stop = (time) => o.stop(time);
|
||||||
return { node: o, stop };
|
return { node: o, stop };
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue