chrisguttandin / extendable-media-recorder-wav-encoder

A Wave file encoder for the extendable-media-recorder package.
MIT License
34 stars 4 forks source link

Allow downmixing to mono #410

Open maxkrieger opened 1 month ago

maxkrieger commented 1 month ago

It would be great to have an option for channel count that downmixes to mono. Otherwise behavior across safari/chrome is inconsistent; chrome outputs mono .wav and safari outputs stereo.

Unfortunately it doesn't seem possible to downmix upstream by piping through an audio context. I tried splitting/merging, gain, etc. but I suspect that this library sticks to the maximal channels available in the system somehow? The only method I found that works is postprocessing the .wav blob with a big for-loop.

If there is a way to downmix Safari with vanilla WebAudio and this library, it would be lovely to have an example. Thanks!

chrisguttandin commented 1 month ago

I think this similar to #396. Safari doesn't yet implemented getSettings() for a MediaStreamTrack coming from the Web Audio API. But you can patch the channelCount if you know it. The value should then get picked up correctly.

If not I would be happy to take a look at a test case to reproduce the issue. But it's hard to know what exactly the problem is without it.