Linux and 24/96

How can you tell if you're outputting 24 bit or 16 bit from the source side?

I dont' have hardware to tell bits, just sample rate....

I'm using s24le as output but pactl sources list says alsa.resolution_bits = "16"

How do I set this in ALSA? I set this output in pulse/daemon.conf.

locating asound.conf shows nothing.
 
The software writing to the kernel alsa interface sets the sample rate and bit format.
You can check the current setting using the file in the /proc filesystem.
Here is mine at the moment

rex@bugs:~$ cat /proc/asound/card2/pcm0p/sub0/hw_params
access: MMAP_INTERLEAVED
format: S32_LE
subformat: STD
channels: 2
rate: 88200 (88200/1)
period_size: 11025
buffer_size: 44100

Yours will likely be a different card number.

Of course pulseaudio could be doing anything. I always remove as much of it as i can.
 
you can find your alsa card number via:

cat /proc/asound/cards

and while pulseaudio is playing use:

cat /proc/asound/card<YOUR_CARD_NUMBER>/stream0

example output:
Code:
ASUSTeK ASUS XONAR U5 at usb-0000:05:00.4-2, high speed : USB Audio

Playback:
  Status: Running
    Interface = 1
    Altset = 6
    Packet Size = 468
    Momentary freq = 192000 Hz (0x18.0000)
  Interface 1
    Altset 1
    Format: S16_LE
    Channels: 2
    Endpoint: 0x05 (5 OUT) (SYNC)
    Rates: 44100, 48000, 88200, 96000, 192000
    Data packet interval: 125 us
    Bits: 16
    Channel map: FL FR
  Interface 1
    Altset 2
    Format: S24_3LE
    Channels: 2
    Endpoint: 0x05 (5 OUT) (SYNC)
    Rates: 44100, 48000, 88200, 96000, 192000
    Data packet interval: 125 us
    Bits: 24
    Channel map: FL FR
  Interface 1
    Altset 3
    Format: S16_LE
    Channels: 4
    Endpoint: 0x05 (5 OUT) (SYNC)
    Rates: 44100, 48000, 88200, 96000, 192000
    Data packet interval: 125 us
    Bits: 16
    Channel map: FL FR RL RR
  Interface 1
    Altset 4
    Format: S24_3LE
    Channels: 4
    Endpoint: 0x05 (5 OUT) (SYNC)
    Rates: 44100, 48000, 88200, 96000, 192000
    Data packet interval: 125 us
    Bits: 24
    Channel map: FL FR RL RR
  Interface 1
    Altset 5
    Format: S16_LE
    Channels: 6
    Endpoint: 0x05 (5 OUT) (SYNC)
    Rates: 44100, 48000, 88200, 96000, 192000
    Data packet interval: 125 us
    Bits: 16
    Channel map: FL FR FC LFE RL RR
  Interface 1
    Altset 6
    Format: S24_3LE
    Channels: 6
    Endpoint: 0x05 (5 OUT) (SYNC)
    Rates: 44100, 48000, 88200, 96000, 192000
    Data packet interval: 125 us
    Bits: 24
    Channel map: FL FR FC LFE RL RR

You can see that altset 6 is currently in use which corresponds to 6 channels at S24_3LE

In general pulseaudio will always use the highest sample depth it can for any output stream.

contrary to other people I don't have any paranoia when it comes to using pa 🙂
 
Just a note - the stream0 info file is generated by the USB audio module, therefore works only for USB audio devices. The hw_params file is generated by the core alsa module for any alsa device.

I agree that PA is no black box and can be configured to behave as required. On the other hand if its features are not required (stream mixing/routing/processing), it makes sense to disable the given soundcard in PA and output directly via alsa.
 
I get:
cat /proc/asound/card0/pcm1p/sub0/hw_params
access: MMAP_INTERLEAVED
format: S16_LE
subformat: STD
channels: 2
rate: 96000 (96000/1)
period_size: 96000
buffer_size: 192000

Where did you configure the audio.format? Daemon.conf?
Can you show an example of how you set it?
Every setting I try causes the sound cards to stop working.
 
After killing 2 hours working on this, I gave up on Pulseaudio and switched to pipewire.
Now the system is using 32 bit float, 96kHz.
Audacity drops samples on recording on 512 sample or 2048 sample intervals though. Increasing the buffer size didn't help.
Switching from pipewire-media-session-manager with wireplumber made things far worse (instead of a dropped samle, there was a major beat) so I went back to the default client.
Eventually, I switched from ALSA to Jack in the audacity settings (since pipewire makes jack support work out of the box).
Interestingly, arecord from the CLI doesn't drop samples.
The problem seems to stem from the Creative Labs card and it's chipset support.
 
After having pulseaudio cause me no end of problems, it's usually best to remove it. Jack works fine if you need it's complexity.

For the record (!), i use the following command, after deactivating X, to capture audio.

sudo ionice -c 1 -n 0 arecord -D plughw:CARD=USB2496rec,DEV=0 -f S32_LE -c2 -r 96000 | tee GWJ-TheBestIsYetToCome-S2.wav | aplay -D hw:CARD=PCH,DEV=0
 
I followed this quide: https://forum.manjaro.org/t/howto-rip-vinyl-lps-in-manjaro/83300
I can use this command to record, but now that I've got pipewire working, I can use audacity if I want.

I also created a 2GB ramdisk to record to and make a script...
Code:
#!/bin/zsh
arecord --device=hw:0,1 --format=S32_LE --rate=96000 --channels=2 --vumeter=stereo /ramdisk/$1.wav && mv /ramdisk/$1.wav ~

Which will record until you hit CTRL-C and then it will move the file from the ramdisk to the home folder so you can then work it in audacity... 🙂
 
Last edited: