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.
input
process()
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)
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)
Awesome! This works: https://www.jefftk.com/echo-demo-v2 Thanks so much!
Current theme: default
Less Wrong (text)
Less Wrong (link)
Arrow keys: Next/previous image
Escape or click: Hide zoomed image
Space bar: Reset image size & position
Scroll to zoom in/out
(When zoomed in, drag to pan; double-click to close)
Keys shown in yellow (e.g., ]) are accesskeys, and require a browser-specific modifier key (or keys).
]
Keys shown in grey (e.g., ?) do not require any modifier keys.
?
Esc
h
f
a
m
v
c
r
q
t
u
o
,
.
/
s
n
e
;
Enter
[
\
k
i
l
=
-
0
′
1
2
3
4
5
6
7
8
9
→
↓
←
↑
Space
x
z
`
g
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 ofprocess()
in the worklet scope.Awesome! This works: https://www.jefftk.com/echo-demo-v2 Thanks so much!