mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-15 23:58:33 +00:00
Fix noise parameter and FM parameters compatibility
This commit is contained in:
parent
389c7be264
commit
bb7b8c2fab
@ -59,7 +59,7 @@ export function registerSynthSounds() {
|
|||||||
}
|
}
|
||||||
// maybe pull out the above frequency resolution?? (there is also getFrequency but it has no default)
|
// maybe pull out the above frequency resolution?? (there is also getFrequency but it has no default)
|
||||||
// make oscillator
|
// make oscillator
|
||||||
const { node: o, stop } = getOscillator({
|
const { node: o, stop, dry_node = null } = getOscillator({
|
||||||
t,
|
t,
|
||||||
s: wave,
|
s: wave,
|
||||||
freq,
|
freq,
|
||||||
@ -71,10 +71,10 @@ export function registerSynthSounds() {
|
|||||||
// FM + FM envelope
|
// FM + FM envelope
|
||||||
let stopFm, fmEnvelope;
|
let stopFm, fmEnvelope;
|
||||||
if (fmModulationIndex) {
|
if (fmModulationIndex) {
|
||||||
const { node: modulator, stop } = fm(o, fmHarmonicity, fmModulationIndex, fmWaveform);
|
const { node: modulator, stop } = fm(dry_node !== null ? dry_node : o, fmHarmonicity, fmModulationIndex, fmWaveform);
|
||||||
if (![fmAttack, fmDecay, fmSustain, fmRelease, fmVelocity].find((v) => v !== undefined)) {
|
if (![fmAttack, fmDecay, fmSustain, fmRelease, fmVelocity].find((v) => v !== undefined)) {
|
||||||
// no envelope by default
|
// no envelope by default
|
||||||
modulator.connect(o.frequency);
|
modulator.connect(dry_node !== null ? dry_node.frequency : o.frequency);
|
||||||
} else {
|
} else {
|
||||||
fmAttack = fmAttack ?? 0.001;
|
fmAttack = fmAttack ?? 0.001;
|
||||||
fmDecay = fmDecay ?? 0.001;
|
fmDecay = fmDecay ?? 0.001;
|
||||||
@ -88,7 +88,7 @@ export function registerSynthSounds() {
|
|||||||
fmEnvelope.node.minValue = 0.00001;
|
fmEnvelope.node.minValue = 0.00001;
|
||||||
}
|
}
|
||||||
modulator.connect(fmEnvelope.node);
|
modulator.connect(fmEnvelope.node);
|
||||||
fmEnvelope.node.connect(o.frequency);
|
fmEnvelope.node.connect(dry_node !== null ? dry_node.frequency : o.frequency);
|
||||||
}
|
}
|
||||||
stopFm = stop;
|
stopFm = stop;
|
||||||
}
|
}
|
||||||
@ -243,6 +243,7 @@ export function getOscillator({ s, freq, t, vib, vibmod, partials, noise }) {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
node: mix_gain,
|
node: mix_gain,
|
||||||
|
dry_node: o,
|
||||||
stop: (time) => {
|
stop: (time) => {
|
||||||
vibrato_oscillator?.stop(time);
|
vibrato_oscillator?.stop(time);
|
||||||
o.stop(time);
|
o.stop(time);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user