GithubHelp home page GithubHelp logo

Comments (1)

muaz-khan avatar muaz-khan commented on June 3, 2024
  1. Chrome currently unable to capture microphone with stereo channels. Mono is the only format captured by chrome. Chrome uses custom wrappers to convert mono audio into stereo format i.e. dual channels. This is one of the biggest factors in the audio latency.
  2. If you explorer chromium code; you'll see that some APIs can only be successfully called for WAV files with stereo audio. Stereo audio is only supported for WAV files.

Though we can convert stereo back into mono; however we can't encode mono audio into WAV container. We need to choose mp3 or other formats.

Chrome is still missing native mp3 encoders. You need to be using Empcrypten/etc. implementation in JavaScript.

Both MediaStreamRecorder.js and RecordRTC.js are using bufferSize=4096. Buffer-size is passed as 1st argument over createScriptProcessor.

if (context.createJavaScriptNode) {
    __stereoAudioRecorderJavacriptNode = context.createJavaScriptNode(bufferSize, 2, 2);
} else if (context.createScriptProcessor) {
    __stereoAudioRecorderJavacriptNode = context.createScriptProcessor(bufferSize, 2, 2);
} else {
    throw 'WebAudio API has no support on this browser.';
}

Possible values for Buffer-size are:

[256, 512, 1024, 2048, 4096, 8192, 16384]

From the spec: This value controls how frequently the audioprocess event is
dispatched and how many sample-frames need to be processed each call.
Lower values for buffer size will result in a lower (better) latency.
Higher values will be necessary to avoid audio breakup and glitches

The size of the buffer (in sample-frames) which needs to
be processed each time onprocessaudio is called.

You can reduce WAV file's size using low-bufferSize however it'll result in audio quality lost.

from mediastreamrecorder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.