While you're here, please consider supporting GamingOnLinux on:
Reward Tiers: Patreon. Plain Donations: PayPal.
This ensures all of our main content remains totally free for everyone! Patreon supporters can also remove all adverts and sponsors! Supporting us helps bring good, fresh content. Without your continued support, we simply could not continue!
You can find even more ways to support us on this dedicated page any time. If you already are, thank you!
Reward Tiers: Patreon. Plain Donations: PayPal.
This ensures all of our main content remains totally free for everyone! Patreon supporters can also remove all adverts and sponsors! Supporting us helps bring good, fresh content. Without your continued support, we simply could not continue!
You can find even more ways to support us on this dedicated page any time. If you already are, thank you!
Login / Register
- GOG launch their Preservation Program to make games live forever with a hundred classics being 're-released'
- Valve dev details more on the work behind making Steam for Linux more stable
- NVIDIA detail upcoming Linux driver features for Wayland and explain current support
- Half-Life 2 free to keep until November 18th, Episodes One & Two now included with a huge update
- Direct3D to Vulkan translation layer DXVK v2.5 released with rewritten memory management
- > See more over 30 days here
-
Half-Life 2 free to keep until November 18th, Episodes …
- Ehvis -
Hybrid gaming controller MoveMaster has a new website, …
- furaxhornyx -
Half-Life 2 free to keep until November 18th, Episodes …
- tuxmuppet -
Half-Life 2 free to keep until November 18th, Episodes …
- Tuxee -
Inspired by SSX, arcade snowboarding game Tricky Madnes…
- based - > See more comments
- New Desktop Screenshot Thread
- Vortex_Acherontic - Types of programs that are irritating
- dvd - What do you want to see on GamingOnLinux?
- Linas - Weekend Players' Club 11/15/2024
- StoneColdSpider - Our own anti-cheat list
- Xpander - See more posts
View PC info
You can see your Pulse sinks like this:
pactl list short sinks
49 alsa_output.pci-0000_0f_00.1.hdmi-stereo-extra4 PipeWire s32le 2ch 48000Hz SUSPENDED
50 alsa_output.pci-0000_11_00.4.iec958-stereo PipeWire s32le 2ch 48000Hz RUNNING
Firstly, I'm using my digital output for audio already.
In my case it's alsa_output.pci-0000_11_00.4.iec958-stereo (S/PDIF output). s32le means audio format is signed 32-bit little endian. 2ch means it has two channels and 48000 Hz is the sample rate.
Now you can simply capture it using parec like this (note .monitor suffix for it):
parec --device='alsa_output.pci-0000_11_00.4.iec958-stereo.monitor' \
--rate=48000 \
--file-format=flac > theme.flac
By default parec records in 44100 Hz, 16 bit depth and native endianness. I suppose to avoid resampling, you can match sample rate to the native sink one (48000 Hz in my case). FLAC only supports 16 and 20 bit depth, and parec's default 16 is perfectly enough, so no need to change that.
That's all :)
Once I recorded the theme I had to trim it a bit in Audacity to make it loopable.
Last edited by Shmerl on 21 April 2022 at 5:52 pm UTC
View PC info
Get the list of targets first:
pw-record --list-targets
Available targets ("*" denotes default): alsa_input.usb-046d_C922_Pro_Stream_Webcam_D7C1577F-02.analog-stereo
* 47: source description="C922 Pro Stream Webcam Analog Stereo" prio=2009
34: monitor description="Starship/Matisse HD Audio Controller Digital Stereo (IEC958)" prio=736
48: monitor description="Navi 21 HDMI Audio [Radeon RX 6800/6800 XT / 6900 XT] Digital Stereo (HDMI 5)" prio=584
81: stream description="mpv" prio=-1
You can also get some more info with:
pw-cli list-objects Node
Get currently used format of the sink, which in my case is 34 for digitial S/PDIF output. You can get a better idea which is which from pw-cli list-objects Node.
pw-cli enum-params 34 Format
Object: size 160, type Spa:Pod:Object:Param:Format (262147), id Spa:Enum:ParamId:Format (4)
Prop: key Spa:Pod:Object:Param:Format:mediaType (1), flags 00000000
Id 1 (Spa:Enum:MediaType:audio)
Prop: key Spa:Pod:Object:Param:Format:mediaSubtype (2), flags 00000000
Id 1 (Spa:Enum:MediaSubtype:raw)
Prop: key Spa:Pod:Object:Param:Format:Audio:format (65537), flags 00000000
Id 267 (Spa:Enum:AudioFormat:S32LE)
Prop: key Spa:Pod:Object:Param:Format:Audio:rate (65539), flags 00000000
Int 48000
Prop: key Spa:Pod:Object:Param:Format:Audio:channels (65540), flags 00000000
Int 2
Prop: key Spa:Pod:Object:Param:Format:Audio:position (65541), flags 00000000
Array: child.size 4, child.type Spa:Id
Id 3 (Spa:Enum:AudioChannel:FL)
Id 4 (Spa:Enum:AudioChannel:FR)
Note S32LE, 48000 and 2 channels. Same info we got from pactl before.
Just for the reference, to list all supported formats of the sink, you can use:
pw-cli enum-params 34 EnumFormat
Then you can actually record:
pw-record --target 34 --rate=48000 --format=s16 --channels=2 audio.wav
This can be simplified, since 48000 Hz, s16 and 2 channels are defaults:
pw-record --target 34 audio.wav
Currently it only supports recording a WAV file.
Last edited by Shmerl on 24 April 2022 at 8:28 am UTC