A collection of scripts for managing audio routing between devices using PulseAudio/PipeWire.
audio_router.sh- Main audio routing script with full functionalityaudio_quick.sh- Quick shortcuts for common tasksREADME.md- This documentation
# List all audio devices
./audio_quick.sh list
# Route SPDIF to Model 12 (normal latency)
./audio_quick.sh stm
# Route SPDIF to Model 12 (low latency)
./audio_quick.sh stml
# Stop all audio routing
./audio_quick.sh reset# Route multiple inputs to multiple outputs
./audio_router.sh -i spdif -i usb -o model -o hdmi
# Custom latency settings
./audio_router.sh -i spdif -o model --latency 25
# Verbose output for troubleshooting
./audio_router.sh -i spdif -o model --verbose-i, --input DEVICE- Input device (can be used multiple times)-o, --output DEVICE- Output device (can be used multiple times)-l, --list- List all available devices-r, --reset- Reset all audio routing--low-latency- Enable low latency mode (10ms)--high-latency- Use normal latency mode (50ms)--latency MS- Set custom latency in milliseconds-v, --verbose- Enable verbose output-h, --help- Show help
Device names are matched as case-insensitive substrings:
spdifmatches devices containing "spdif"modelmatches devices containing "model"usbmatches devices containing "usb"hdmimatches devices containing "hdmi"
You can also use full device names for exact matching.
# Route SPDIF input to Model 12 output
./audio_router.sh -i spdif -o model
# Same with low latency
./audio_router.sh -i spdif -o model --low-latency# Route SPDIF to both Model 12 and HDMI
./audio_router.sh -i spdif -o model -o hdmi
# Route both SPDIF and USB input to Model 12
./audio_router.sh -i spdif -i usb -o model# Low latency (10ms) - good for real-time monitoring
./audio_router.sh -i spdif -o model --low-latency
# Custom latency (25ms) - balance between latency and stability
./audio_router.sh -i spdif -o model --latency 25
# High latency (50ms) - most stable, default
./audio_router.sh -i spdif -o model --high-latency# List devices to see what's available
./audio_router.sh --list
# Use verbose mode to see what's happening
./audio_router.sh -i spdif -o model --verbose
# Reset everything if something goes wrong
./audio_router.sh --reset- PulseAudio or PipeWire with PulseAudio compatibility
pactlcommand available- Bash shell
- The script creates loopback modules that persist until reset or system restart
- Multiple routes can be active simultaneously
- Lower latency settings may cause audio dropouts on slower systems
- Use
--resetto clean up all routing before creating new routes - Monitor sources (ending in
.monitor) are automatically filtered out
- Try higher latency:
--latency 100 - Check system load and close unnecessary applications
- Ensure audio devices are properly connected
- Use
--listto see available devices - Check device name spelling and try partial matches
- Ensure the device is connected and recognized by the system
- Check volume levels on both input and output devices
- Verify the correct devices are being used with
--verbose - Try
--resetand recreate the routing
- Ensure you're in the
audiogroup:groups $USER - Check that PulseAudio/PipeWire is running for your user session