Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
model: string,
protected defaults: MuffSettings,
tunings: MuffTuningOptions
) {
super(context, model);
this.tunings = { ...Muff.defaultTunings, ...tunings };
// Boost stage - pre-filtering + boost gain.
this.boostNode = new GainNode(context, {
gain: dBToGain(this.tunings.boost)
});
const preRange = this.tunings.preFilterRange;
this.preHighpass = new IIRFilterNode(context, {
...onePoleHighpass(preRange[0], context.sampleRate)
});
this.preLowpass = new IIRFilterNode(context, {
...onePoleLowpass(preRange[1], context.sampleRate)
});
// Double clipping stage.
this.waveSharper1Stage = new WaveShaperNode(context, {
oversample: '4x'
});
this.waveSharper2Stage = new WaveShaperNode(context, {
oversample: '4x'
});
const postRange = this.tunings.postFilterRanges;
});
// Double clipping stage.
this.waveSharper1Stage = new WaveShaperNode(context, {
oversample: '4x'
});
this.waveSharper2Stage = new WaveShaperNode(context, {
oversample: '4x'
});
const postRange = this.tunings.postFilterRanges;
this.postLowpass1Stage = new IIRFilterNode(context, {
...onePoleHighpass(postRange[0], context.sampleRate)
});
this.postHighpass1Stage = new IIRFilterNode(context, {
...onePoleLowpass(postRange[1], context.sampleRate)
});
this.postLowpass2Stage = new IIRFilterNode(context, {
...onePoleHighpass(postRange[2], context.sampleRate)
});
this.postHighpass2Stage = new IIRFilterNode(context, {
...onePoleLowpass(postRange[3], context.sampleRate)
});
// Equalization stage.
this.toneNode = new MixedTone(context, this.tunings.toneRange);
// Output stage.
this.levelNode = context.createGain();
super(context, model);
this.tunings = { ...Muff.defaultTunings, ...tunings };
// Boost stage - pre-filtering + boost gain.
this.boostNode = new GainNode(context, {
gain: dBToGain(this.tunings.boost)
});
const preRange = this.tunings.preFilterRange;
this.preHighpass = new IIRFilterNode(context, {
...onePoleHighpass(preRange[0], context.sampleRate)
});
this.preLowpass = new IIRFilterNode(context, {
...onePoleLowpass(preRange[1], context.sampleRate)
});
// Double clipping stage.
this.waveSharper1Stage = new WaveShaperNode(context, {
oversample: '4x'
});
this.waveSharper2Stage = new WaveShaperNode(context, {
oversample: '4x'
});
const postRange = this.tunings.postFilterRanges;
this.postLowpass1Stage = new IIRFilterNode(context, {
...onePoleHighpass(postRange[0], context.sampleRate)
});
oversample: '4x'
});
this.waveSharper2Stage = new WaveShaperNode(context, {
oversample: '4x'
});
const postRange = this.tunings.postFilterRanges;
this.postLowpass1Stage = new IIRFilterNode(context, {
...onePoleHighpass(postRange[0], context.sampleRate)
});
this.postHighpass1Stage = new IIRFilterNode(context, {
...onePoleLowpass(postRange[1], context.sampleRate)
});
this.postLowpass2Stage = new IIRFilterNode(context, {
...onePoleHighpass(postRange[2], context.sampleRate)
});
this.postHighpass2Stage = new IIRFilterNode(context, {
...onePoleLowpass(postRange[3], context.sampleRate)
});
// Equalization stage.
this.toneNode = new MixedTone(context, this.tunings.toneRange);
// Output stage.
this.levelNode = context.createGain();
this.processor = [
this.boostNode,
this.preLowpass,
});
const postRange = this.tunings.postFilterRanges;
this.postLowpass1Stage = new IIRFilterNode(context, {
...onePoleHighpass(postRange[0], context.sampleRate)
});
this.postHighpass1Stage = new IIRFilterNode(context, {
...onePoleLowpass(postRange[1], context.sampleRate)
});
this.postLowpass2Stage = new IIRFilterNode(context, {
...onePoleHighpass(postRange[2], context.sampleRate)
});
this.postHighpass2Stage = new IIRFilterNode(context, {
...onePoleLowpass(postRange[3], context.sampleRate)
});
// Equalization stage.
this.toneNode = new MixedTone(context, this.tunings.toneRange);
// Output stage.
this.levelNode = context.createGain();
this.processor = [
this.boostNode,
this.preLowpass,
this.preHighpass,
this.waveSharper1Stage,
this.postLowpass1Stage,
this.postHighpass1Stage,
});
this.preLowpass = new IIRFilterNode(context, {
...onePoleLowpass(preRange[1], context.sampleRate)
});
// Double clipping stage.
this.waveSharper1Stage = new WaveShaperNode(context, {
oversample: '4x'
});
this.waveSharper2Stage = new WaveShaperNode(context, {
oversample: '4x'
});
const postRange = this.tunings.postFilterRanges;
this.postLowpass1Stage = new IIRFilterNode(context, {
...onePoleHighpass(postRange[0], context.sampleRate)
});
this.postHighpass1Stage = new IIRFilterNode(context, {
...onePoleLowpass(postRange[1], context.sampleRate)
});
this.postLowpass2Stage = new IIRFilterNode(context, {
...onePoleHighpass(postRange[2], context.sampleRate)
});
this.postHighpass2Stage = new IIRFilterNode(context, {
...onePoleLowpass(postRange[3], context.sampleRate)
});
// Equalization stage.
constructor(context: AudioContext, range: [number, number] = [550, 1000]) {
this.splitter = new ChannelSplitterNode(context);
this.lowpassFilter = new IIRFilterNode(context, {
...onePoleLowpass(range[0], context.sampleRate)
});
this.toneLowGain = new GainNode(context);
this.highpassFilter = new IIRFilterNode(context, {
...onePoleHighpass(range[1], context.sampleRate)
});
this.toneHighGain = new GainNode(context);
this.merger = new ChannelMergerNode(context);
this.splitter
.connect(this.highpassFilter)
.connect(this.toneHighGain)
.connect(this.merger, 0, 1);
}
constructor(context: AudioContext, range: [number, number] = [550, 1000]) {
this.splitter = new ChannelSplitterNode(context);
this.lowpassFilter = new IIRFilterNode(context, {
...onePoleLowpass(range[0], context.sampleRate)
});
this.toneLowGain = new GainNode(context);
this.highpassFilter = new IIRFilterNode(context, {
...onePoleHighpass(range[1], context.sampleRate)
});
this.toneHighGain = new GainNode(context);
this.merger = new ChannelMergerNode(context);
this.splitter
.connect(this.highpassFilter)
.connect(this.toneHighGain)
.connect(this.merger, 0, 1);