How to use the standardized-audio-context.WaveShaperNode function in standardized-audio-context

To help you get started, we’ve selected a few standardized-audio-context examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vitaliy-bobrov / js-rocks / src / app / audio / effects / distortion.ts View on Github external
) {
    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
    });

    // 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);
github vitaliy-bobrov / js-rocks / src / app / audio / effects / muff.ts View on Github external
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)
    });

    this.postHighpass1Stage = new IIRFilterNode(context, {
      ...onePoleLowpass(postRange[1], context.sampleRate)
    });

    this.postLowpass2Stage = new IIRFilterNode(context, {
github vitaliy-bobrov / js-rocks / src / app / audio / effects / muff.ts View on Github external
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)
    });

    this.postHighpass1Stage = new IIRFilterNode(context, {
      ...onePoleLowpass(postRange[1], context.sampleRate)
    });

    this.postLowpass2Stage = new IIRFilterNode(context, {
      ...onePoleHighpass(postRange[2], context.sampleRate)
    });