How to use the standardized-audio-context.MediaStreamAudioSourceNode 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 / audio-context-manager.service.ts View on Github external
async plugLineIn() {
    try {
      if (!this.lineInSource) {
        const mediaStream = await navigator.mediaDevices.getUserMedia({
          audio: {
            echoCancellation: false,
            autoGainControl: false,
            noiseSuppression: false,
            latency: 0
          }
        });
        this.lineInSource = new MediaStreamAudioSourceNode(this.context, {
          mediaStream
        });

        this.connectInOrder();
      }
    } catch (err) {
      console.error(err);
    }

    if (this.context.state === 'suspended') {
      await this.context.resume();
    }
  }