rserota / wad

Web Audio DAW. Use the Web Audio API for dynamic sound synthesis. It's like jQuery for your ears.
MIT License
1.88k stars 160 forks source link

Low quality mic recording / MediaStreamConstraints #146

Closed Kris-rmw closed 1 year ago

Kris-rmw commented 1 year ago

In both Chrome and firefox I get a low / barely audible mic recording.

Using the same setup/mic and getUserMedia() API, there are no quality issues - example code: https://web.dev/patterns/media/microphone-record/

My test code:

  let voice = new Wad({source: 'mic'})
  let polywad = new Wad.Poly({
    recorder: {
      options: { mimeType : 'audio/webm' },
      onstop: function(event) {
        let blob = new Blob(this.recorder.chunks, { 'type' : 'audio/webm;codecs=opus' });
        window.open(URL.createObjectURL(blob));
      }
    }
  })
  polywad.add(voice)
  voice.play()
  polywad.recorder.start()
  // make some noise

  setTimeout(function(){
    polywad.recorder.stop() // a new window should open, where you can download the file you just created
  }, 4000);

I have a hunch this might be causing the issue: https://stackoverflow.com/questions/67682297/i-developed-the-recording-using-the-javascript-web-audio-api-but-the-sound-qual

But I don't know how to apply the suggested solution (MediaStreamConstraints) to WAD.

Kris-rmw commented 1 year ago

Update: I rebooted my laptop and it fixed the issue. Keep up the great work 👊

rserota commented 1 year ago

I'm glad you were able to find a solution. I hope you're enjoying WadJS.