Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Boost stage - pre-filtering.
const bandpassParams = calculateBandpass(this.tunings.preFilterRange);
this.preFilter = new BiquadFilterNode(context, {
type: 'bandpass',
Q: bandpassParams.q,
frequency: bandpassParams.fc
});
// Clipping stage.
this.waveSharper = new WaveShaperNode(context, {
oversample: '4x'
});
this.postFilter = new BiquadFilterNode(context, {
type: 'lowpass',
Q: Math.SQRT1_2,
frequency: this.tunings.postFilter
});
// Equalization stage.
if (this.tunings.toneControlType === 'standard') {
this.toneNode = new StandardTone(context, this.tunings.toneRange);
}
if (this.tunings.toneControlType === 'mixed') {
this.toneNode = new MixedTone(context, this.tunings.toneRange);
}
// Output stage.
this.levelNode = new GainNode(context);
constructor(
context: AudioContext,
model: string,
protected defaults: DistortionSettings,
tunings: DistortionTuningOptions
) {
super(context, model);
this.tunings = { ...Distortion.defaultTunings, ...tunings };
// Boost stage - pre-filtering.
const bandpassParams = calculateBandpass(this.tunings.preFilterRange);
this.preFilter = new BiquadFilterNode(context, {
type: 'bandpass',
Q: bandpassParams.q,
frequency: bandpassParams.fc
});
// Clipping stage.
this.waveSharper = new WaveShaperNode(context, {
oversample: '4x'
});
this.postFilter = new BiquadFilterNode(context, {
type: 'lowpass',
Q: Math.SQRT1_2,
frequency: this.tunings.postFilter
});
constructor(
context: AudioContext,
private range: [number, number] = [350, 10000]
) {
this.filter = new BiquadFilterNode(context, {
type: 'lowpass',
Q: Math.SQRT1_2
});
}
this.defaults.gain = gain;
this.bassNode = new BiquadFilterNode(context, {
type: 'lowshelf',
frequency: 320,
gain: 0
});
this.midNode = new BiquadFilterNode(context, {
type: 'peaking',
Q: Math.SQRT1_2,
frequency: 1000,
gain: 0
});
this.trebleNode = new BiquadFilterNode(context, {
type: 'highshelf',
frequency: 3200,
gain: 0
});
buffer$.subscribe(buffer => {
this.convolver.buffer = buffer;
});
this.processor = [
this.convolver,
this.makeUpGain,
this.bassNode,
this.midNode,
this.trebleNode
];
constructor(
context: AudioContext,
model: string,
buffer$: Observable,
gain: number,
private maxGain: number
) {
super(context, model);
this.convolver = new ConvolverNode(context);
this.makeUpGain = new GainNode(context, { gain });
this.defaults.gain = gain;
this.bassNode = new BiquadFilterNode(context, {
type: 'lowshelf',
frequency: 320,
gain: 0
});
this.midNode = new BiquadFilterNode(context, {
type: 'peaking',
Q: Math.SQRT1_2,
frequency: 1000,
gain: 0
});
this.trebleNode = new BiquadFilterNode(context, {
type: 'highshelf',
frequency: 3200,
gain: 0
gain: number,
private maxGain: number
) {
super(context, model);
this.convolver = new ConvolverNode(context);
this.makeUpGain = new GainNode(context, { gain });
this.defaults.gain = gain;
this.bassNode = new BiquadFilterNode(context, {
type: 'lowshelf',
frequency: 320,
gain: 0
});
this.midNode = new BiquadFilterNode(context, {
type: 'peaking',
Q: Math.SQRT1_2,
frequency: 1000,
gain: 0
});
this.trebleNode = new BiquadFilterNode(context, {
type: 'highshelf',
frequency: 3200,
gain: 0
});
buffer$.subscribe(buffer => {
this.convolver.buffer = buffer;
});
constructor(
context: AudioContext,
model: string,
protected defaults: Active
) {
super(context, model);
this.preHPFilter = new BiquadFilterNode(context, {
type: 'highpass',
Q: Math.SQRT1_2,
frequency: 20
});
this.analyserNode = new AnalyserNode(context, {
fftSize: 4096
});
this.processor = [this.preHPFilter, this.analyserNode];
connectNodes(this.processor);
this.applyDefaults();
this.worker = new Worker('./tuner.worker', { type: 'module' });
this.worker.onmessage = ({ data }: TunerResponseMessage) => {
if (this.isBypassEnabled) {