// manage tone.js
const effects = {
chorus: undefined,
distortion: undefined,
reverb: undefined,
tremolo: undefined,
}
const preload = () => {
effects.reverb = new Tone.Reverb({
wet: 1,
});
effects.tremolo = new Tone.Tremolo({
wet: 1,
});
effects.chorus = new Tone.Chorus({
frequency: 2.5,
delayTime: 0.5,
depth: 1,
feedback: 0.3,
wet: 1,
});
effects.distortion = new Tone.Distortion({
distortion: 1,
wet: 1,
});
// ...
}
const selectedEffects = ['chorus', 'tremolo'] // to respect the order to chain the effects
export const updateEffects = (effectType, effectKey, newVal) => {
const effect = effects[effectType]; // get effect to be updated
effect[effectKey] = newVal; // update the value
};
// user interface
const updateReverbDecay = (val) => {
updateEffects('reverb', 'decay', val); // works as fine
};
const updateTremoloDepth = (val) => {
updateEffects('tremolo', 'depth', val); // FIXME: depth is read-only
};
Expected behavior
Tremolo depth will accept a value that is between [0, 1]
Tremolo frequency will accept a value
What I've tried
Updating other effects with the same method like: chorus and delayTime, chorus and depth, distortion and distortion, reverb and decay works as expected.
Describe the bug
Updating the tremolo effect throws:
and
To Reproduce
I have something like this:
Expected behavior Tremolo depth will accept a value that is between [0, 1]
Tremolo frequency will accept a value
What I've tried Updating other effects with the same method like:
chorus and delayTime
,chorus and depth
,distortion and distortion
,reverb and decay
works as expected.