# vmic Create and manage PipeWire virtual microphones easily, from the command line. ## What it does A vmic is two chained loopback stages: ``` apps -> vmic_X_sink =(stage 1)=> vmic_X_mid -> vmic_X_mix =(stage 2)=> vmic_X_mic -> recorders ^ hardware mic joins here (route -s) ``` Point an app's output device at `vmic_X_sink`, and a recording app's input device at `vmic_X_mic`. Optionally mix in a real microphone downstream, and optionally hear your own output via a self-monitor loopback (which never carries the mixed-in mic). ## Requirements - PipeWire + pipewire-pulse (`pactl`, `pw-loopback`, `pw-link` on `PATH`) - Rust (edition 2021) ## Build ``` cargo build --release ``` If the build fails inside `libspa-sys` (e.g. `no field 'data' on type 'spa_pod_builder'`), your system clang is newer than the pinned `bindgen` version supports. Point `LIBCLANG_PATH` at an older libclang - a quick fix is a pip-vendored one: ``` python3 -m venv ~/.local/share/vmic-build/libclang-venv ~/.local/share/vmic-build/libclang-venv/bin/pip install libclang ``` then add to `.cargo/config.toml`: ```toml [env] LIBCLANG_PATH = "/home//.local/share/vmic-build/libclang-venv/lib/python3.*/site-packages/clang/native" ``` ## Usage ``` vmic create [-l] # create a vmic, optionally with self-monitor vmic route -i # move an app's playback into the vmic vmic route -o # move an app's recording off the vmic vmic route -s # mix a hardware mic in, or remove it vmic edit -l # toggle the self-monitor loopback vmic edit -v <0.8|80> # self-monitor loopback volume vmic edit -sv <0.8|80> # mixed-in source volume vmic delete # tear down one vmic vmic list # show all vmics and their status vmic wipe # tear down every vmic, tracked or not ``` Aliases: `create` = `mk`/`make`, `delete` = `rm`/`remove`, `list` = `ls`, `wipe` = `reset`. Shell completions: `vmic completions `. ## Example ``` vmic create podcast -l # set your app's output device to vmic_podcast_sink # set your recorder's input device to vmic_podcast_mic vmic route podcast -s "USB Microphone" ``` ## State Tracked in a SQLite database at `~/.config/vmic/vmic.db` (override the directory with `VMIC_STATE_DIR_OVERRIDE`). ## License APGL-3