How to use the standardized-audio-context.AnalyserNode 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 / tuner / tuner.ts View on Github external
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) {
        return;
      }

      this.noteSub$.next(data.note);
    };