LinuxCommandLibrary

pw-cat

Play audio streams from the command line

TLDR

Play a WAV file over the default target

$ pw-cat [[-p|--playback]] [path/to/file.wav]
copy

Play a WAV file with a specified resampler quality (4 by default)
$ pw-cat [[-q|--quality]] [0..15] [[-p|--playback]] [path/to/file.wav]
copy

Record a sample recording at a volume level of 125%
$ pw-cat [[-r|--record]] --volume [1.25] [path/to/file.wav]
copy

Record a sample recording using a different sample rate
$ pw-cat [[-r|--record]] --rate [6000] [path/to/file.wav]
copy

Display help
$ pw-cat [[-h|--help]]
copy

SYNOPSIS

pw-cat [options] [file]

PARAMETERS

-h
    Show help options.

-r
    Record audio from the default source.

-p
    Play audio to the default sink.

-c
    Set the number of channels.

-n
    Set the number of buffers.

-f
    Set the sample format (e.g., s16le, f32). Use pw-dump to list available formats.

-R
    Set the sample rate.

-b
    Set the buffer size.

[file]
    The audio file to play or record. If omitted when playing, pw-cat reads from standard input; if omitted when recording, pw-cat writes to standard output.

DESCRIPTION

pw-cat is a command-line utility provided by PipeWire for playing and recording audio files. It functions like a simple audio player or recorder, allowing users to easily interact with audio streams using PipeWire. It can read from and write to various audio file formats.

pw-cat leverages PipeWire's graph-based processing model, enabling seamless integration with other PipeWire modules and applications. This allows for flexible audio routing and manipulation. The command's simplicity makes it useful for quick audio testing, simple playback tasks, and basic audio recording scenarios. It is often used to debug and test PipeWire setups, verify audio stream configurations and capture output.

CAVEATS

pw-cat is a relatively basic tool and might not support advanced audio features. It relies on PipeWire's configuration and setup, so issues can arise if PipeWire is not configured correctly. Error messages can sometimes be cryptic, requiring familiarity with PipeWire's architecture for debugging.

EXAMPLES

Playing a WAV file:
pw-cat audio.wav

Recording audio to a WAV file:
pw-cat -r record.wav

Playing standard input:
cat audio.raw | pw-cat

Recording to standard output:
pw-cat -r > record.raw

HISTORY

pw-cat was developed as part of the PipeWire project. It's designed to be a simple and effective way to interact with audio streams in the PipeWire ecosystem. It builds upon the concepts of other similar command-line tools for audio processing, but leverages PipeWire's modularity and graph-based architecture to provide more flexible control over audio routing and processing.

SEE ALSO

pw-dump(1), pw-cli(1)

Copied to clipboard