Add microphone process pattern#9198
Conversation
✅ Deploy Preview for web-dev-staging ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
cb950e5 to
8850c3d
Compare
This comment was marked as off-topic.
This comment was marked as off-topic.
| class WorkletProcessor extends AudioWorkletProcessor { | ||
| process([input], [output]) { | ||
| // Copy inputs to outputs. | ||
| input[0].forEach((sample, i) => output[0][i] = sample); |
There was a problem hiding this comment.
I think Float32Array.set() is much faster than this iteration - which is sort of the best practice for audio. What do you think?
There was a problem hiding this comment.
I also noticed that this doesn't store/copy the audio stream into something else. (e.g. recording) Is this pattern only to demonstrate access to raw audio data via AudioWorklet?
There was a problem hiding this comment.
I think Float32Array.set() is much faster than this iteration - which is sort of the best practice for audio. What do you think?
Much better indeed. It is fixed in ecabb69. Thanks!
I also noticed that this doesn't store/copy the audio stream into something else. (e.g. recording) Is this pattern only to demonstrate access to raw audio data via AudioWorklet?
This pattern is specifically about processing yes. We do https://web.dev/patterns/media/microphone-record/ for recording. I wonder now if we should have another pattern for processing & recording via AudioWorklet.
This PR is ready for review.
Live previews: