You can pipe a microphone directly to AudioWorklet, using MediaStreamAudioSourceNode. Do the following in the main scope, then you can access the mic input as the input
parameter of process()
in the worklet scope.
const audioCtx =
new
(window.AudioContext || window.webkitAudioContext)()
const micStream = await navigator.mediaDevices.getUserMedia({ audio: true })
const micNode = new MediaStreamAudioSourceNode(audioCtx, { mediaStream: micStream })
micNode.connect(yourAudioWorkletNode)
yourAudioWorkletNode.connect(audioCtx.destination)
I’d recommend Brave (
brew install brave-browser
) over Chrome if you care about privacy at all. It’s a Chromium based browser so has feature parity with Chrome, but it doesn’t send your personal information to the Google hivemind. Built-in ad-blocker too, and per-site noscript making it convenient to only run JS on sites you trust.