My laptop’s fan sounds like a disgruntled koala right now, and none of the noise reduction programs I could get my hands on worked well enough to make its microphone usable.
I can’t bother to fix it or buy a microphone so I decided to use my phone’s microphone as my laptop’s microphone.
There is this app AudioRelay but it asked for my soul as payment, and only I am allowed to torture my own soul, so I got to it.
I found this script mic_over_mumble. There’s just one small problem: I’m a noob. I have no clue about pipewire, also what’s mumble?
Anyways I bashed my head against the keyboard for a while, here’s the result:
...
# Enable pipewire.
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;
};
services.pipewire.extraConfig.pipewire."97-null-sink" = {
"context.objects" = [
{
factory = "adapter";
args = {
"factory.name" = "support.null-audio-sink";
"node.name" = "Null-Sink";
"node.description" = "Null Sink";
"media.class" = "Audio/Sink";
"audio.position" = "FL,FR";
};
}
{
factory = "adapter";
args = {
"factory.name" = "support.null-audio-sink";
"node.name" = "Null-Source";
"node.description" = "Null Source";
"media.class" = "Audio/Source";
"audio.position" = "FL,FR";
};
}
];
};
services.pipewire.extraConfig.pipewire."98-virtual-mic" = {
"context.modules" = [
{
name = "libpipewire-module-loopback";
args = {
"audio.position" = "FL,FR";
"node.description" = "Mumble as Microphone";
"capture.props" = {
# Mumble's output node name.
"node.target" = "Mumble";
"node.passive" = true;
};
"playback.props" = {
"node.name" = "Virtual-Mumble-Microphone";
"media.class" = "Audio/Source";
};
};
}
];
};
# Mumble server.
services.murmur = {
enable = true;
bandwidth = 540000;
bonjour = true;
password = "choose_your_own_password";
autobanTime = 0;
};
...
home.packages = with pkgs; [
...
# Mumble client.
mumble
...
];
...
# Open ports in the firewall.
networking.firewall.allowedTCPPorts = [
# Mumble Murmur server port
64738
];
networking.firewall.allowedUDPPorts = [
# Mumble Murmur server port
64738
];
The firewall almost got me, didn’t know it was enabled by default in Nixos.
So here’s how it works:
- Open mumble on PC.
- The configuration wizard can be ignored, or not.
- Add your server with the address 127.0.0.1 (localhost) and your chosen password in nix configuration.
- You should now be connected to the server on the same PC.
- The PC client should be muted but not deafened.
- Go to configure/settings
- In audio input tab choose PulseAudio as system interface and Null Source as its device.
- in audio output tab choose PulseAudio as system interface and Null Sink as its device.
- Connect phone to the same network as PC. I used a USB cable and tethering for least delay.
- Install phone client. On Android it’s called Mumla.
- Add the server using your PC’s local IP address (something like 192.168.xx.xx or 172.16to31.xx.xx or 10.xx.xx.xx) and the chosen password.
- Connect to server on phone.
- Now you should be able to choose “Mumble as Microphone” on your PC on any application that asks for an audio source.
As I said I’m a noob, so forgive any mistake I’ve made.
I hope this helps somebody not waste as much time as I did.