Hi,
I used Emscripten to port libogg and libvorbis to JavaScript. In particular, I am interested in audio encoding. The encoder test example, which takes wav data from stdin and outputs it to stdout works for the most part (using node.js), but -some- characters seem to be corrupted (as viewed from a text editor).
The data in C is being output using fwrite. I think this is an encoding issue? I tried outputting the data with : process['stdout'].write(data,'binary') (in Moduel['print'] callback) but, once again, small parts of data (individual bytes here and there...) do not resemble the proper audio output, as compared to the C program audio output. The Emscripten audio file does not play while C audio file does.
I don't have any special Emscripten handling in my code (no #ifdef EMSCRIPTEN defines).
So, in Module['print'] callback, how can I handle the binary stdout properly, using node.js?
Furthermore, I would like to go further with this and do audio encoding on the browser side (preferably using a webworker). The way that I am thinking right now, I will still use a Module['print'] callback for this, just post a message back to the main script. How do I handle the binary data at that point? In Module['print'], convert the data over to a Blob and send it back (as simple as : new Blob([mydata], { type : 'audio/ogg' }) ?).
Thanks for the help,
Mateusz