Skip to content

Instantly share code, notes, and snippets.

@fathonix
Created November 10, 2024 06:01
Show Gist options
  • Save fathonix/aa399867333cae8458a4fbf6d08bf155 to your computer and use it in GitHub Desktop.
Save fathonix/aa399867333cae8458a4fbf6d08bf155 to your computer and use it in GitHub Desktop.
Android as Microphone w/ Echo Cancellation on Linux with PipeWire + ROC + RNNoise
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-filter-chain
args = {
node.description = "ROC Input Echo Cancel"
filter.graph = {
nodes = [
{
type = ladspa
name = rnnoise
plugin = /usr/local/lib/ladspa/librnnoise_ladspa.so
label = noise_suppressor_mono
control = {
"VAD Threshold (%)" = 90.0
"VAD Grace Period (ms)" = 200
"Retroactive VAD Grace (ms)" = 0
}
}
]
}
capture.props = {
node.name = "capture.ROC_Input_Echo_Cancel"
audio.position = [ MONO ]
target.object = "capture.ROC_Input"
node.passive = true
}
playback.props = {
node.name = "ROC_Input_Echo_Cancel"
media.class = "Audio/Source"
audio.position = [ MONO ]
node.autoconnect = false
}
}
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment