Skip to content

Instantly share code, notes, and snippets.

@fathonix
Created November 10, 2024 01:47
Show Gist options
  • Save fathonix/05de5398f3f92ccd51006a91a819bbd7 to your computer and use it in GitHub Desktop.
Save fathonix/05de5398f3f92ccd51006a91a819bbd7 to your computer and use it in GitHub Desktop.
Use Android Phone as Microphone w/ Echo Cancellation on Linux with PipeWire + ROC

Use Android Phone as Microphone w/ Echo Cancellation on Linux with PipeWire + ROC

Follow this tutorial first on setting up ROC: https://gavv.net/articles/roc-0.4/

Instead of following the config file provided on the tutorial, use this config to route ROC source to a Loopback device and an Echo Cancel device.

Restart PipeWire afterwards:

systemctl restart --user pipewire.service

Install Roc Droid, switch to the Sender tab, replace the IP address with your Linux device's and change source from apps to microphone. Test the input device on apps such as OBS whether it works.

context.modules = [
{ name = libpipewire-module-roc-source
args = {
local.ip = 0.0.0.0
resampler.profile = medium
fec.code = rs8m
sess.latency.msec = 50
local.source.port = 10001
local.repair.port = 10002
source.name = "Roc Source"
source.props = {
node.name = "roc-source"
node.autoconnect = false
}
}
}
{ name = libpipewire-module-loopback
args = {
node.description = "ROC Input"
capture.props = {
node.name = "capture.ROC_Input"
audio.position = [ FL FR ]
stream.dont-remix = true
target.object = "roc-source"
node.passive = true
}
playback.props = {
node.name = "ROC_Input"
media.class = "Audio/Source"
audio.position = [ FL FR ]
node.autoconnect = false
}
}
}
{ name = libpipewire-module-echo-cancel
args = {
node.description = "ROC Input Echo Cancel"
library.name = "aec/libspa-aec-webrtc"
capture.props = {
node.name = "echo_cancel.ROC_Input"
target.object = "capture.ROC_Input"
}
playback.props = {
node.autoconnect = false
}
}
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment