Re: [pulseaudio-discuss] How to be sure about the quality of the audio?

2023-02-05 Thread Sean Greenslade
On Fri, Feb 03, 2023 at 08:25:53PM -0300, MilS Lion wrote:
> HI.
> Im having this issue:
> I subscribed to Qobuz (an Hi-res audio quality).
> 
> I was using ALSA directly and with alsa, i just put this:
> sudo cat /proc/asound/IQaudIODAC/pcm0p/sub0/hw_params
> 
> if it is a 16bit 44000Khz audio i get:
> access: MMAP_INTERLEAVED
> format: S16_LE
> subformat: STD
> channels: 2
> rate: 44000 (44000/1)
> period_size: 2160
> buffer_size: 8640
> 
> if it is a 24bit, 192Khz i get the adequate values.
> 
> But with PulseAudio how to be sure about the quality of the audio?
> if i put the same parameter (sudo cat
> /proc/asound/IQaudIODAC/pcm0p/sub0/hw_params ) i always just get the sample
> rate and format that i config in the daemon.conf... it is not relevant if
> the audio is actually 16bit or 24 and the Khz are 44000 or 192000 or
> whatever.
> 
> So... there is a command to know exactly the quality that is really playing?

Yes, there is. To see what the ALSA card is actually being sent, you can
use the command "pactl list sinks". For example:

> $ pactl list sinks
> ...
> Sink #2
>   State: IDLE
>   Name: alsa_output.usb-Focusrite_Scarlett_Solo_USB-00.analog-stereo
>   Description: Scarlett Solo USB Analog Stereo
>   Driver: module-alsa-card.c
>   Sample Specification: s32le 2ch 44100Hz
^^^ This shows the current bit depth 
and sample rate.
>   Channel Map: front-left,front-right
> ...

If you want to see what your media player is supplying to pulseaudio,
and what resampler (if any) is in use, the command "pactl list sink-inputs"
will show this:

> $ pactl list sink-inputs
> Sink Input #356
>   Driver: protocol-native.c
>   Owner Module: 9
>   Client: 347
>   Sink: 2
>   Sample Specification: float32le 2ch 48000Hz
^^^ This shows the player's bit 
depth and sample rate.
>   Channel Map: front-left,front-right
>   Format: pcm, format.sample_format = "\"float32le\""  format.rate = 
> "48000"  format.channels = "2"  format.channel_map = 
> "\"front-left,front-right\""
>   Corked: no
>   Mute: no
>   Volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% 
> / 0.00 dB
>   balance 0.00
>   Buffer Latency: 84341 usec
>   Sink Latency: 48686 usec
>   Resample method: speex-float-1
^^ This shows the resampler in use.
>   Properties:
>   media.icon_name = "SMPlayer"

There are a couple of settings you can adjust in daemon.conf if you are
concerned about resampling. First is the "avoid-resampling" setting.
Turning this on will tell pulse to attempt to reconfigure an ALSA device
to use the same sample rate and bit depth as the playback source if
there is only one source active (and the card supports the target sample
rate, bit depth, and sample format, and supports live reconfiguration).

Second is the choice of resampler. This is configured by the
"resample-method" setting. See the man pages for more info about the
possible choices and their trade-offs:

https://man.archlinux.org/man/pulse-daemon.conf.5#resample_method=

--Sean



Re: [pulseaudio-discuss] How to be sure about the quality of the audio?

2023-02-04 Thread Sergei Steshenko
Start from 
https://manpages.ubuntu.com/manpages/focal/man5/pulse-daemon.conf.5.html 
, paying special attention to "*DEFAULT**DEVICE**SETTINGS*".


If you upsample, say,16 bits up to 24 bits, you do not lose quality. In 
fact, if several channels are mixed, e.g. two channels from two 
different programs: sum = k1 * c1 + k2 * c2 , you gain quality because 
of smaller rounding errors.


Anyway, define quality first. And realize that if channels being 
simultaneously played have different sample rates, at least one of them 
has to be resampled WRT sample frequency.


--Sergei.

On 04/02/2023 1:25, MilS Lion wrote:

HI.
Im having this issue:
I subscribed to Qobuz (an Hi-res audio quality).

I was using ALSA directly and with alsa, i just put this:
sudo cat /proc/asound/IQaudIODAC/pcm0p/sub0/hw_params

if it is a 16bit 44000Khz audio i get:
access: MMAP_INTERLEAVED
format: S16_LE
subformat: STD
channels: 2
rate: 44000 (44000/1)
period_size: 2160
buffer_size: 8640

if it is a 24bit, 192Khz i get the adequate values.

But with PulseAudio how to be sure about the quality of the audio?
if i put the same parameter (sudo cat 
/proc/asound/IQaudIODAC/pcm0p/sub0/hw_params ) i always just get the 
sample rate and format that i config in the daemon.conf... it is not 
relevant if the audio is actually 16bit or 24 and the Khz are 44000 or 
192000 or whatever.


So... there is a command to know exactly the quality that is really 
playing?