padenot / ringbuf.js

Wait-free thread-safe single-consumer single-producer ring buffer using SharedArrayBuffer
https://ringbuf-js.netlify.app/
Mozilla Public License 2.0
201 stars 18 forks source link

Question about streaming from AudioWorkletProcessor #5

Closed tinchoz49 closed 3 years ago

tinchoz49 commented 3 years ago

Hey @padenot, how are you?

I want to get (in the main thread) the raw data of a microphone from a MediaStream. I think I could use your example but as the opposite flow. Does that make sense?

padenot commented 3 years ago

This is how I would do it as well. Make sure to have enough room in the ring buffer to handle the case where setTimeout and other scheduling APIs are throttled because the tab is in the background, and your code will only be called about once a second.

tinchoz49 commented 3 years ago

Thank you