by vdnkh · 10y ago · 0 comments
something like this: http://pastebin.com/UP3F09Wn
[1] https://developer.mozilla.org/en-US/docs/Web/API/ScriptProce...
>An event, implementing the AudioProcessingEvent interface, is sent to the object each time the input buffer contains new data, and the event handler terminates when it has filled the output buffer with data.
Events just fire like mad until you put stuff in the output buffer. Couldn't get it to work like I needed it to.
MediaRecorder works the same way (but for MediaStreamSources, not BufferSources).
the idea is that audio buffers are processed in chunks- an event fires for each chunk that is processed. the act of "recording" is just reassembling these chunks into a single ArrayBuffer.
edit: seems like Recorderjs works exactly this way (but implements features more than just recording, like exporting as WAV).
capturing the chunks: https://github.com/mattdiamond/Recorderjs/blob/master/src/re...
reassembling the chunks: https://github.com/mattdiamond/Recorderjs/blob/master/src/re...
I wonder if instead of encoding as ogg/opus I could switch the string to WAV instead?