Route your microphone data over the intranet or internet.
I wanted to use my Phone's microphone as my laptop's, so here I am. The android-client uses Flutter and has a rough and simple UI. The Android app's audio capture and UDP streaming logic are written in C++ to lower latency, with the former using Google's Oboe Library. View audio_router.cpp if you are interested in the implementation.
Fetch your laptop's LAN IP:
$ hostname -IEnter this IP and a port in the app, then press the microphone icon to start streaming, like the example shown below:
Verify that the UDP data is arriving via netcat:
$ nc -ul -p <port> | xxdIf nothing shows up, allow the port in your firewall:
$ sudo firewall-cmd --add-port=<port>/udpCreate a virtual microphone device (requires PipeWire):
$ pw-loopback \
--name="Virtual_Mic" \
--capture-props="media.class=Audio/Sink node.name=Virtual_Mic_In node.description='Virtual Mic Input'" \
--playback-props="media.class=Audio/Source node.name=Virtual_Mic node.description='Virtual_Mic'"Feed the UDP stream into the virtual mic using GStreamer:
$ gst-launch-1.0 udpsrc port=5000 ! \
"audio/x-raw,format=F32LE,rate=48000,channels=1,layout=interleaved" ! \
audioconvert ! audioresample ! \
pipewiresink target-object="Virtual_Mic_In"Your apps can now select "Virtual_Mic" as an audio input source.
- Flutter SDK
- Android NDK + CMake
git clone https://github.com/nullptr0x/MicrophoneRouter.git
cd MicrophoneRouter/microphone_router
flutter pub get
flutter run