Added documentation for using tuxrecord on PipeWire based systems.
This commit is contained in:
parent
cb2f35f363
commit
e699adfa60
2 changed files with 79 additions and 9 deletions
75
README.md
75
README.md
|
|
@ -5,9 +5,8 @@ Record audio to a WAV file on **Linux** using **ALSA** as the recording source.
|
||||||
`tuxrecord` is the Linux port of the former macOS-only **macrecord** tool. The
|
`tuxrecord` is the Linux port of the former macOS-only **macrecord** tool. The
|
||||||
Swift/AVFoundation code was rewritten in **C99** and now uses the native ALSA
|
Swift/AVFoundation code was rewritten in **C99** and now uses the native ALSA
|
||||||
capture API (`libasound`); it builds with **GCC**.
|
capture API (`libasound`); it builds with **GCC**.
|
||||||
|
macrecord was created by my good friend Armin. You can find his code here:
|
||||||
The port is derived from [macrecord](https://codeberg.org/armin/macrecord)
|
[https://codeberg.org/armin/macrecord](https://codeberg.org/armin/macrecord)
|
||||||
which was created by my good friend armin.
|
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
|
|
@ -32,6 +31,9 @@ tuxrecord -p myrec
|
||||||
|
|
||||||
# Use a specific ALSA capture device
|
# Use a specific ALSA capture device
|
||||||
tuxrecord -D hw:1,0
|
tuxrecord -D hw:1,0
|
||||||
|
|
||||||
|
# Record from PipeWire (the PipeWire sound server)
|
||||||
|
tuxrecord -D pipewire
|
||||||
```
|
```
|
||||||
|
|
||||||
## Options
|
## Options
|
||||||
|
|
@ -41,10 +43,12 @@ tuxrecord -D hw:1,0
|
||||||
| `-o <dir>` | Output directory (default: current directory) |
|
| `-o <dir>` | Output directory (default: current directory) |
|
||||||
| `-d <secs>` | Stop automatically after `<secs>` seconds |
|
| `-d <secs>` | Stop automatically after `<secs>` seconds |
|
||||||
| `-p <prefix>` | Filename prefix instead of `tuxrecord` |
|
| `-p <prefix>` | Filename prefix instead of `tuxrecord` |
|
||||||
| `-D <device>` | ALSA capture device (default: `default`) |
|
| `-D <device>` | ALSA capture device (default: `default`; `pipewire` on PipeWire systems) |
|
||||||
| `-h, --help` | Show help |
|
| `-h, --help` | Show help |
|
||||||
|
|
||||||
Run `arecord -l` to list available ALSA capture devices.
|
Run `arecord -l` to list available ALSA capture devices. On systems with
|
||||||
|
PipeWire, list the PipeWire source nodes with `pactl list short sources`
|
||||||
|
or `wpctl status` (see "Recording from PipeWire" below).
|
||||||
|
|
||||||
## Controls
|
## Controls
|
||||||
|
|
||||||
|
|
@ -80,6 +84,67 @@ through. Point your players at `hw:Loopback,0` (default sink) and record from
|
||||||
kernel version; if one direction is silent, try recording from
|
kernel version; if one direction is silent, try recording from
|
||||||
`hw:Loopback,0` while playing to `hw:Loopback,1`.
|
`hw:Loopback,0` while playing to `hw:Loopback,1`.
|
||||||
|
|
||||||
|
## Recording from PipeWire
|
||||||
|
|
||||||
|
On modern distributions (Fedora 34+, Ubuntu 22.04+, Arch Linux) the **PipeWire**
|
||||||
|
sound server takes over audio handling. PipeWire ships an ALSA compatibility
|
||||||
|
plugin (`pipewire-alsa`) that exposes the server as a normal ALSA capture
|
||||||
|
device named `pipewire`, so `tuxrecord` can record from it with no extra
|
||||||
|
setup:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Record from PipeWire's default source (usually the microphone)
|
||||||
|
tuxrecord -D pipewire
|
||||||
|
|
||||||
|
# Record a fixed duration
|
||||||
|
tuxrecord -D pipewire -d 10
|
||||||
|
```
|
||||||
|
|
||||||
|
### What "pipewire" records
|
||||||
|
|
||||||
|
The pipewire-alsa plugin routes capture to PipeWire's **default source**:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Show the current default source
|
||||||
|
pactl get-default-source # or: wpctl status
|
||||||
|
|
||||||
|
# List all available PipeWire sources
|
||||||
|
wpctl status
|
||||||
|
pactl list short sources
|
||||||
|
```
|
||||||
|
|
||||||
|
### Recording system audio (what you hear)
|
||||||
|
|
||||||
|
To capture everything that is currently playing (system audio), point the
|
||||||
|
default source at the **monitor** of the default sink. This is the PipeWire
|
||||||
|
equivalent of the ALSA loopback approach above but needs no kernel module:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 1. Find the monitor of the default sink
|
||||||
|
pactl set-default-source "$(pactl get-default-sink).monitor"
|
||||||
|
|
||||||
|
# 2. Record it with tuxrecord
|
||||||
|
tuxrecord -D pipewire
|
||||||
|
```
|
||||||
|
|
||||||
|
The `.monitor` source carries exactly what the sink is playing, so anything
|
||||||
|
your players output ends up in the WAV file. Every capture follows the same
|
||||||
|
`<prefix>__<timestamp>.wav` naming and can be stopped with `q` or **Ctrl+C**.
|
||||||
|
The default setting can be restored later with
|
||||||
|
`pactl set-default-source <your-input-source>`.
|
||||||
|
|
||||||
|
### Troubleshooting
|
||||||
|
|
||||||
|
- **"cannot open ALSA capture device 'pipewire'"** — the `pipewire-alsa`
|
||||||
|
plugin is missing. Install it (e.g. `pipewire-alsa` on Debian/Ubuntu/Arch,
|
||||||
|
`pipewire-alsa` on Fedora), or the PipeWire server is not running
|
||||||
|
(`systemctl --user status pipewire`). In that case fall back to a regular
|
||||||
|
ALSA device with `tuxrecord -D hw:0,0`.
|
||||||
|
- Recording from a specific device or virtual node instead of the default
|
||||||
|
source is possible by setting the default source first (see `pactl` /
|
||||||
|
`wpctl` output) or by creating a loopback with `pw-loopback` and recording
|
||||||
|
that node.
|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
|
||||||
13
tuxrecord.c
13
tuxrecord.c
|
|
@ -6,9 +6,8 @@
|
||||||
*
|
*
|
||||||
* A Linux port of the former macOS-only "macrecord" tool, rewritten in C99
|
* A Linux port of the former macOS-only "macrecord" tool, rewritten in C99
|
||||||
* and using the ALSA capture API (libasound) as the recording source.
|
* and using the ALSA capture API (libasound) as the recording source.
|
||||||
*
|
* macrecord was created by my good friend Armin. You can find his code here:
|
||||||
* The port is derived from [macrecord](https://codeberg.org/armin/macrecord)
|
* https://codeberg.org/armin/macrecord
|
||||||
* which was created by my good friend armin.
|
|
||||||
*
|
*
|
||||||
* Copyright 2026 Johannes Findeisen <you@hanez.org>
|
* Copyright 2026 Johannes Findeisen <you@hanez.org>
|
||||||
* Licensed under the terms of the Apache-2.0 license.
|
* Licensed under the terms of the Apache-2.0 license.
|
||||||
|
|
@ -120,7 +119,13 @@ static void usage(void)
|
||||||
"\n"
|
"\n"
|
||||||
"By default the ALSA capture device \"default\" is used, which is usually\n"
|
"By default the ALSA capture device \"default\" is used, which is usually\n"
|
||||||
"the microphone. To record system audio (everything playing on the\n"
|
"the microphone. To record system audio (everything playing on the\n"
|
||||||
"system) see the \"Recording system audio\" section in the README.\n",
|
"system) see the \"Recording system audio\" section in the README.\n"
|
||||||
|
"\n"
|
||||||
|
"PipeWire users: record from the PipeWire default source via the\n"
|
||||||
|
"ALSA compatibility plugin by passing the device name \"pipewire\":\n"
|
||||||
|
" tuxrecord -D pipewire (default source)\n"
|
||||||
|
" pactl set-default-source \"$(pactl get-default-sink).monitor\"\n"
|
||||||
|
" tuxrecord -D pipewire (system audio, uses the sink monitor)\n",
|
||||||
DEFAULT_PREFIX, DEFAULT_PREFIX, DEFAULT_DEVICE);
|
DEFAULT_PREFIX, DEFAULT_PREFIX, DEFAULT_DEVICE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue