Merge branch 'main' into glossing/lfo-anything
This commit is contained in:
commit
0e3840aff4
7 changed files with 80 additions and 63 deletions
|
|
@ -524,7 +524,7 @@ export const wchoose = (...pairs) => wchooseWith(rand, ...pairs);
|
|||
* @example
|
||||
* wchooseCycles(["bd",10], ["hh",1], ["sd",1]).s().fast(8)
|
||||
* @example
|
||||
* wchooseCycles(["bd bd bd",5], ["hh hh hh",3], ["sd sd sd",1]).fast(4).s()
|
||||
* wchooseCycles(["c c c",5], ["a a a",3], ["f f f",1]).fast(4).note()
|
||||
* @example
|
||||
* // The probability can itself be a pattern
|
||||
* wchooseCycles(["bd(3,8)","<5 0>"], ["hh hh hh",3]).fast(4).s()
|
||||
|
|
|
|||
|
|
@ -256,7 +256,15 @@ export function drywet(dry, wet, wetAmount = 0) {
|
|||
let mix = ac.createGain();
|
||||
dry_gain.connect(mix);
|
||||
wet_gain.connect(mix);
|
||||
return mix;
|
||||
return {
|
||||
node: mix,
|
||||
onended: () => {
|
||||
dry_gain.disconnect(mix);
|
||||
wet_gain.disconnect(mix);
|
||||
dry.disconnect(dry_gain);
|
||||
wet.disconnect(wet_gain);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
let curves = ['linear', 'exponential'];
|
||||
|
|
@ -291,6 +299,10 @@ export function getVibratoOscillator(param, value, t) {
|
|||
gain.gain.value = vibmod * 100;
|
||||
vibratoOscillator.connect(gain);
|
||||
gain.connect(param);
|
||||
vibratoOscillator.onended = () => {
|
||||
gain.disconnect(param);
|
||||
vibratoOscillator.disconnect(gain);
|
||||
};
|
||||
vibratoOscillator.start(t);
|
||||
return vibratoOscillator;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,8 +65,9 @@ export function getNoiseOscillator(type = 'white', t, density = 0.02) {
|
|||
export function getNoiseMix(inputNode, wet, t) {
|
||||
const noiseOscillator = getNoiseOscillator('pink', t);
|
||||
const noiseMix = drywet(inputNode, noiseOscillator.node, wet);
|
||||
noiseOscillator.node.onended = () => noiseMix.onended();
|
||||
return {
|
||||
node: noiseMix,
|
||||
node: noiseMix.node,
|
||||
stop: (time) => noiseOscillator?.stop(time),
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ export class Orbit {
|
|||
}
|
||||
|
||||
sendDelay(node, amount) {
|
||||
effectSend(node, this.delayNode, amount);
|
||||
return effectSend(node, this.delayNode, amount);
|
||||
}
|
||||
|
||||
duck(t, onsettime = 0, attacktime = 0.1, depth = 1) {
|
||||
|
|
|
|||
|
|
@ -48,19 +48,17 @@ export function registerSynthSounds() {
|
|||
[0.001, 0.05, 0.6, 0.01],
|
||||
);
|
||||
|
||||
let sound = getOscillator(s, t, value);
|
||||
let { node: o, stop, triggerRelease } = sound;
|
||||
|
||||
// turn down
|
||||
const g = gainNode(0.3);
|
||||
|
||||
const { duration } = value;
|
||||
|
||||
o.onended = () => {
|
||||
o.disconnect();
|
||||
let sound = getOscillator(s, t, value, () => {
|
||||
g.disconnect();
|
||||
onended();
|
||||
};
|
||||
});
|
||||
|
||||
let { node: o, stop, triggerRelease } = sound;
|
||||
|
||||
const { duration } = value;
|
||||
|
||||
const envGain = gainNode(1);
|
||||
let node = o.connect(g).connect(envGain);
|
||||
|
|
@ -466,7 +464,7 @@ export function waveformN(partials, phases, type) {
|
|||
}
|
||||
|
||||
// expects one of waveforms as s
|
||||
export function getOscillator(s, t, value) {
|
||||
export function getOscillator(s, t, value, onended) {
|
||||
const { duration, noise = 0 } = value;
|
||||
const partials = value.partials ?? value.n;
|
||||
let o;
|
||||
|
|
@ -488,7 +486,6 @@ export function getOscillator(s, t, value) {
|
|||
}
|
||||
// set frequency
|
||||
o.frequency.value = getFrequencyFromValue(value);
|
||||
o.start(t);
|
||||
|
||||
let vibratoOscillator = getVibratoOscillator(o.detune, value, t);
|
||||
|
||||
|
|
@ -501,6 +498,13 @@ export function getOscillator(s, t, value) {
|
|||
noiseMix = getNoiseMix(o, noise, t);
|
||||
}
|
||||
|
||||
o.onended = () => {
|
||||
o.disconnect();
|
||||
noiseMix?.node.disconnect();
|
||||
onended();
|
||||
};
|
||||
o.start(t);
|
||||
|
||||
return {
|
||||
node: noiseMix?.node || o,
|
||||
source: o,
|
||||
|
|
|
|||
|
|
@ -12484,54 +12484,54 @@ exports[`runs examples > example "wchooseCycles" example index 0 1`] = `
|
|||
|
||||
exports[`runs examples > example "wchooseCycles" example index 1 1`] = `
|
||||
[
|
||||
"[ 0/1 → 1/12 | s:bd ]",
|
||||
"[ 1/12 → 1/6 | s:bd ]",
|
||||
"[ 1/6 → 1/4 | s:bd ]",
|
||||
"[ 1/4 → 1/3 | s:bd ]",
|
||||
"[ 1/3 → 5/12 | s:bd ]",
|
||||
"[ 5/12 → 1/2 | s:bd ]",
|
||||
"[ 1/2 → 7/12 | s:sd ]",
|
||||
"[ 7/12 → 2/3 | s:sd ]",
|
||||
"[ 2/3 → 3/4 | s:sd ]",
|
||||
"[ 3/4 → 5/6 | s:bd ]",
|
||||
"[ 5/6 → 11/12 | s:bd ]",
|
||||
"[ 11/12 → 1/1 | s:bd ]",
|
||||
"[ 1/1 → 13/12 | s:bd ]",
|
||||
"[ 13/12 → 7/6 | s:bd ]",
|
||||
"[ 7/6 → 5/4 | s:bd ]",
|
||||
"[ 5/4 → 4/3 | s:bd ]",
|
||||
"[ 4/3 → 17/12 | s:bd ]",
|
||||
"[ 17/12 → 3/2 | s:bd ]",
|
||||
"[ 3/2 → 19/12 | s:hh ]",
|
||||
"[ 19/12 → 5/3 | s:hh ]",
|
||||
"[ 5/3 → 7/4 | s:hh ]",
|
||||
"[ 7/4 → 11/6 | s:bd ]",
|
||||
"[ 11/6 → 23/12 | s:bd ]",
|
||||
"[ 23/12 → 2/1 | s:bd ]",
|
||||
"[ 2/1 → 25/12 | s:hh ]",
|
||||
"[ 25/12 → 13/6 | s:hh ]",
|
||||
"[ 13/6 → 9/4 | s:hh ]",
|
||||
"[ 9/4 → 7/3 | s:hh ]",
|
||||
"[ 7/3 → 29/12 | s:hh ]",
|
||||
"[ 29/12 → 5/2 | s:hh ]",
|
||||
"[ 5/2 → 31/12 | s:bd ]",
|
||||
"[ 31/12 → 8/3 | s:bd ]",
|
||||
"[ 8/3 → 11/4 | s:bd ]",
|
||||
"[ 11/4 → 17/6 | s:bd ]",
|
||||
"[ 17/6 → 35/12 | s:bd ]",
|
||||
"[ 35/12 → 3/1 | s:bd ]",
|
||||
"[ 3/1 → 37/12 | s:bd ]",
|
||||
"[ 37/12 → 19/6 | s:bd ]",
|
||||
"[ 19/6 → 13/4 | s:bd ]",
|
||||
"[ 13/4 → 10/3 | s:sd ]",
|
||||
"[ 10/3 → 41/12 | s:sd ]",
|
||||
"[ 41/12 → 7/2 | s:sd ]",
|
||||
"[ 7/2 → 43/12 | s:hh ]",
|
||||
"[ 43/12 → 11/3 | s:hh ]",
|
||||
"[ 11/3 → 15/4 | s:hh ]",
|
||||
"[ 15/4 → 23/6 | s:bd ]",
|
||||
"[ 23/6 → 47/12 | s:bd ]",
|
||||
"[ 47/12 → 4/1 | s:bd ]",
|
||||
"[ 0/1 → 1/12 | note:c ]",
|
||||
"[ 1/12 → 1/6 | note:c ]",
|
||||
"[ 1/6 → 1/4 | note:c ]",
|
||||
"[ 1/4 → 1/3 | note:c ]",
|
||||
"[ 1/3 → 5/12 | note:c ]",
|
||||
"[ 5/12 → 1/2 | note:c ]",
|
||||
"[ 1/2 → 7/12 | note:f ]",
|
||||
"[ 7/12 → 2/3 | note:f ]",
|
||||
"[ 2/3 → 3/4 | note:f ]",
|
||||
"[ 3/4 → 5/6 | note:c ]",
|
||||
"[ 5/6 → 11/12 | note:c ]",
|
||||
"[ 11/12 → 1/1 | note:c ]",
|
||||
"[ 1/1 → 13/12 | note:c ]",
|
||||
"[ 13/12 → 7/6 | note:c ]",
|
||||
"[ 7/6 → 5/4 | note:c ]",
|
||||
"[ 5/4 → 4/3 | note:c ]",
|
||||
"[ 4/3 → 17/12 | note:c ]",
|
||||
"[ 17/12 → 3/2 | note:c ]",
|
||||
"[ 3/2 → 19/12 | note:a ]",
|
||||
"[ 19/12 → 5/3 | note:a ]",
|
||||
"[ 5/3 → 7/4 | note:a ]",
|
||||
"[ 7/4 → 11/6 | note:c ]",
|
||||
"[ 11/6 → 23/12 | note:c ]",
|
||||
"[ 23/12 → 2/1 | note:c ]",
|
||||
"[ 2/1 → 25/12 | note:a ]",
|
||||
"[ 25/12 → 13/6 | note:a ]",
|
||||
"[ 13/6 → 9/4 | note:a ]",
|
||||
"[ 9/4 → 7/3 | note:a ]",
|
||||
"[ 7/3 → 29/12 | note:a ]",
|
||||
"[ 29/12 → 5/2 | note:a ]",
|
||||
"[ 5/2 → 31/12 | note:c ]",
|
||||
"[ 31/12 → 8/3 | note:c ]",
|
||||
"[ 8/3 → 11/4 | note:c ]",
|
||||
"[ 11/4 → 17/6 | note:c ]",
|
||||
"[ 17/6 → 35/12 | note:c ]",
|
||||
"[ 35/12 → 3/1 | note:c ]",
|
||||
"[ 3/1 → 37/12 | note:c ]",
|
||||
"[ 37/12 → 19/6 | note:c ]",
|
||||
"[ 19/6 → 13/4 | note:c ]",
|
||||
"[ 13/4 → 10/3 | note:f ]",
|
||||
"[ 10/3 → 41/12 | note:f ]",
|
||||
"[ 41/12 → 7/2 | note:f ]",
|
||||
"[ 7/2 → 43/12 | note:a ]",
|
||||
"[ 43/12 → 11/3 | note:a ]",
|
||||
"[ 11/3 → 15/4 | note:a ]",
|
||||
"[ 15/4 → 23/6 | note:c ]",
|
||||
"[ 23/6 → 47/12 | note:c ]",
|
||||
"[ 47/12 → 4/1 | note:c ]",
|
||||
]
|
||||
`;
|
||||
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ export function SoundsTab() {
|
|||
try {
|
||||
// Pre-load the sample by calling onTrigger with a future time
|
||||
// This triggers the loading but schedules playback for later
|
||||
const time = ctx.currentTime + 0.5; // Give 500ms for loading
|
||||
const time = ctx.currentTime + 0.05;
|
||||
const ref = await onTrigger(time, params, onended);
|
||||
trigRef.current = ref;
|
||||
if (ref?.node) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue