Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function createPingPongDelay(audioCtx, tuna = new Tuna(audioCtx)) {
// Tuna is optional
return new EffectUnit({
...pingPongDelayData,
effectChain: {
pingpong: () => new tuna.PingPongDelay({
wetLevel: 0.5, // 0 to 1
feedback: 0.3, // 0 to 1
delayTimeLeft: 150, // 1 to 10000 (milliseconds)
delayTimeRight: 200 // 1 to 10000 (milliseconds)
})
}
},
audioCtx);
}
export default function createCompressor(audioCtx, tuna = new Tuna(audioCtx)) {
// Tuna is optional
return new EffectUnit({
...compressorData,
effectChain: {
compressor: () => new tuna.Compressor({
threshold: DEFAULT_THRESHOLD, // -100 to 0
makeupGain: DEFAULT_MAKEUPGAIN, // 0 and up
attack: DEFAULT_ATTACK, // 0 to 1000
release: DEFAULT_RELEASE, // 0 to 3000
ratio: DEFAULT_RATIO, // 1 to 20
knee: DEFAULT_KNEE, // 0 to 40
automakeup: DEFAULT_AUTOMAKEUP // true/false
})
}
},
export default function createDelay(audioCtx, tuna = new Tuna(audioCtx)) {
// Tuna is optional
return new EffectUnit({
...delayData,
effectChain: {
delay: () => new tuna.Delay({
feedback: DEFAULT_FEEDBACK, // 0 to 1+
delayTime: DEFAULT_DELAYTIME, // 1 to 10000 milliseconds
wetLevel: DEFAULT_WETLEVEL, // 0 to 1+
dryLevel: DEFAULT_DRYLEVEL, // 0 to 1+
cutoff: DEFAULT_CUTOFF // cutoff frequency of the built in lowpass-filter. 20 to 22050
})
}
},
audioCtx);
}
export default function createMoog(audioCtx, tuna = new Tuna(audioCtx)) {
// Tuna is optional
return new EffectUnit({
...moogData,
effectChain: {
moog: () => new tuna.MoogFilter({
cutoff: 0.065, // 0 to 1
resonance: 3.5, // 0 to 4
bufferSize: 4096 // 256 to 16384, NOT INCLUDED AS EDITABLE!
})
}
},
audioCtx);
}
export default function createWahWah(audioCtx, tuna = new Tuna(audioCtx)) {
// Tuna is optional
return new EffectUnit({
...wahWahData,
effectChain: {
wahwah: () => new tuna.WahWah({
automode: DEFAULT_AUTOMODE, // true/false
baseFrequency: DEFAULT_BASEFREQUENCY, // 0 to 1
excursionOctaves: DEFAULT_EXCURSIONOCTAVES, // 1 to 6
sweep: DEFAULT_SWEEP, // 0 to 1
resonance: DEFAULT_RESONANCE, // 1 to 100
sensitivity: DEFAULT_SENSITIVITY // -1 to 1
})
}
},
audioCtx);
export default function createWahWah(audioCtx, tuna = new Tuna(audioCtx)) {
// Tuna is optional
return new EffectUnit({
...wahWahData,
effectChain: {
wahwah: () => new tuna.WahWah({
automode: DEFAULT_AUTOMODE, // true/false
baseFrequency: DEFAULT_BASEFREQUENCY, // 0 to 1
excursionOctaves: DEFAULT_EXCURSIONOCTAVES, // 1 to 6
sweep: DEFAULT_SWEEP, // 0 to 1
resonance: DEFAULT_RESONANCE, // 1 to 100
sensitivity: DEFAULT_SENSITIVITY // -1 to 1
})
}
},
audioCtx);
export default function createBitcrusher(audioCtx, tuna = new Tuna(audioCtx)) {
// Tuna is optional
return new EffectUnit({
...bitcrusherData,
effectChain: {
bitcrusher: () => new tuna.Bitcrusher({
bits: 4, // 1 to 16
normfreq: 0.1, // 0 to 1
bufferSize: 4096 // 256 to 16384, NOT INCLUDED AS EDITABLE!
})
}
},
audioCtx);
}
export default function createEffectCollection(audioCtx) {
const tuna = new Tuna(audioCtx);
return {
gain: createGain(audioCtx),
lowpass: createLowpass(audioCtx),
highpass: createHighpass(audioCtx),
dubDelay: createDubDelay(audioCtx),
reverb: createReverb(audioCtx),
chorus: createChorus(audioCtx, tuna),
delay: createDelay(audioCtx, tuna),
phaser: createPhaser(audioCtx, tuna),
compressor: createCompressor(audioCtx, tuna),
tremolo: createTremolo(audioCtx, tuna),
wahwah: createWahWah(audioCtx, tuna),
bitcrusher: createBitcrusher(audioCtx, tuna),
moog: createMoog(audioCtx, tuna),
pingPongDelay: createPingPongDelay(audioCtx, tuna)
constructor(props: Props, context: Context) {
super(props);
const tuna = new Tuna(context.audioContext);
this.connectNode = new tuna.MoogFilter({
cutoff: props.cutoff,
resonance: props.resonance,
bufferSize: props.bufferSize,
});
this.connectNode.connect(context.connectNode);
}
getChildContext(): Object {
constructor(props: Props, context: Context) {
super(props);
const tuna = new Tuna(context.audioContext);
this.connectNode = new tuna.Convolver({
highCut: props.highCut,
lowCut: props.lowCut,
dryLevel: props.dryLevel,
wetLevel: props.wetLevel,
level: props.level,
impulse: props.impulse,
bypass: props.bypass,
});
this.connectNode.connect(context.connectNode);
}
getChildContext(): Object {