audiocogs / aurora.js

JavaScript audio decoding framework
http://audiocogs.org/codecs
1.26k stars 185 forks source link

Unsupported audio depth on Windows #182

Open Guevara-chan opened 7 years ago

Guevara-chan commented 7 years ago

It seems like winmm, used by node-speaker package here, doesn't really support 32-bit audio well:

Error: specified PCM format is not supported by "win32" backend at Speaker._open (C:\Users\Guevara-chan\AppData\Roaming\npm\node_modules\av\node_modules\speaker\index.js:157:11) at Speaker._write (C:\Users\Guevara-chan\AppData\Roaming\npm\node_modules\av\node_modules\speaker\index.js:242:21) at doWrite (C:\Users\Guevara-chan\AppData\Roaming\npm\node_modules\av\node_modules\readable-stream\lib_stream_writable.js:347:64) at writeOrBuffer (C:\Users\Guevara-chan\AppData\Roaming\npm\node_modules\av\node_modules\readable-stream\lib_stream_writable.js:336:5) at Speaker.Writable.write (C:\Users\Guevara-chan\AppData\Roaming\npm\node_modules\av\node_modules\readable-stream\lib_stream_writable.js:274:11) at Readable.ondata (_stream_readable.js:555:20) at emitOne (events.js:96:13) at Readable.emit (events.js:188:7) at Readable.read (_stream_readable.js:381:10) at flow (_streamreadable.js:761:34) at resume (_stream_readable.js:743:3) at _combinedTickCallback (internal/process/next_tick.js:74:11) at process._tickCallback (internal/process/next_tick.js:98:9)

...not so much of a problem on it's own, since 16 bit is mostly enough, right ? But then, we have this:

@speaker = new Speaker
            channels: @channels
            sampleRate: @sampleRate
            bitDepth: 32 # /!\ hardcoded /!\
            float: true
            signed: true

So, Aurora.js seems to be simply unusable on Windows outside of WebAudio. Any ideas how to fix it back ?