mattdiamond / Recorderjs

A plugin for recording/exporting the output of Web Audio API nodes
4.16k stars 1.46k forks source link

Recording file is too large, how to make it small? #172

Open Qulei93 opened 7 years ago

octavn commented 6 years ago

Recorder.js records 2 channel by default. You can halve the size by recording mono audio instead. You can do it from the constructor like this:

rec = new Recorder(input,{numChannels:1})

Source

liadbelad commented 3 years ago

Hey I got the same issue I am trying to record a audio/wav in 44.100 mono but I always get stereo

Here's my code snippet:

const audioContext = new (window.AudioContext || window.webkitAudioContext)({ sampleRate: 44100, })

const recorder = new Recorder(audioContext, { numChannels: 1, })

navigator.mediaDevices .getUserMedia({ audio: true }) .then((stream) => { recorder.init(stream) }) .catch((err) => console.log('Uh oh... unable to get stream...', err))