You are not logged in.

#1 2022-04-05 17:12:47

EdeWolf
Member
Registered: 2016-01-06
Posts: 79

pipewire "bitperfect" recording

Hello,

I have managed to get pipewire to play back in the files native frequency, but what would be the proper way to record without resampling? So far it seems, by default it records anything in 48kHz, no matter what samplerate the soundcard is actually delivering. Now, I would like to find out the capabilities of the soundcard and need a way to actually see, what samplerate the AD converter is currently using. In fact it is not really about recording, but, as mentioned, about seeing, what the AD converter is doing at the moment and what it's limits are.
Preferably with pw-top, if I can get it to. So it is not about me changing the samplerate, but the system figuring out what is actually being delivered to it and telling me.

Anyway to accomplish that? The " default.clock.allowed-rates" in pipewire.conf seems to only be valid for playback and pw-record wants a samplerate or it uses the default, but it has no "native" setting.

Thanks for any insight

Offline

#2 2022-04-05 17:42:45

Maniaxx
Member
Registered: 2014-05-14
Posts: 732

Re: pipewire "bitperfect" recording

Maybe take a look at the 'pro-audio' profile.

Pro Audio card profile support. You can now select the
Pro Audio profile and have raw device access with the
maximum number of channels and no mixer controls. This is
the usual setup for managing high end Pro Audio cards.
https://gitlab.freedesktop.org/pipewire … ses/0.3.22


sys2064

Offline

#3 2022-04-05 18:26:30

EdeWolf
Member
Registered: 2016-01-06
Posts: 79

Re: pipewire "bitperfect" recording

Thanks very much for your fast reply, but this does not seem to work. I do see the channels in Pro Audio, but the input sampling rate pw-top shows, is still fixed. However, according to the manual, the card should support a range to samplingrates. Unless of course, something is broken.

Offline

#4 2022-04-05 18:42:36

Maniaxx
Member
Registered: 2014-05-14
Posts: 732

Re: pipewire "bitperfect" recording

What soundcard/chip to you have?
The pro-audio profile has the same samplerate (48kHz)? I would rather expect the highest possible.
Edit: On the other hand. How do you record exactly?

Last edited by Maniaxx (2022-04-05 18:43:43)


sys2064

Offline

#5 2022-04-05 19:10:58

EdeWolf
Member
Registered: 2016-01-06
Posts: 79

Re: pipewire "bitperfect" recording

Thanks again for getting back to me. Indeed it seems, I have a different problem. I am trying to feed an analog signal, converted by a RME ADI-2 ADC via toslink into an ESI DrDAC, which in turn should convert the toslink signal into USB. As there are practically no USB->toslink Soundcards available (as in toslink -> USB, other way round is no problem).

pw-top shows an input of 44.1 kHz, however, when I then run pw-record without any arguments, it switches to the default 48kHz. And after stopping pw-record pw-top only switches back to 44.1kHz as soon as I open the mixer (plasma-pa, does again not happen with pulsemixer, though). Just opening it is enough, no  need to change any settings. Somewhat spooky. 

However, for my principle problem: Actually looking at the pw-record file, it is empty, so somehow so signal arrives at all. Audacity confirms no level, but I never got along with that program, so that may just be me. Anyway, I guess, I need to sort this out first, even though I am not yet sure where to start.

Analog to USB on the DrDAC works and as fas as I understand the manual, SPDIF (coax & optical) ->USB should work as well. So far it doesn't. Should have checked that earlier, but was fixed on the pw-top infos.

Thanks again, I will see, what I can do and get back with more information. If there are any

Offline

#6 2022-04-05 19:13:42

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,427

Re: pipewire "bitperfect" recording

Try to arecord on the actual HW device with an insane rate, it will give you error output telling you what's the max it sees.

Offline

#7 2022-04-05 20:01:16

EdeWolf
Member
Registered: 2016-01-06
Posts: 79

Re: pipewire "bitperfect" recording

When connecting the analog signal directly to the USB card, arecord records fine at 44.1, 48 and 96 kHz, as expected. 96kHz not in S24_3LE, though, but that's fine. However, when using the digital input, with arecord there also is no signal being recorded. But it is not, that the signal does not arrive at the usb soundcard, as the speakers are connected to its line out and have been playing back fine all the time. That is, why I never had a look into the recorded files. It does seem though, the signal does not arrive at the USB port. 

So far it seems there is either an issue with the usb card,  or me understanding its manual.

Still unclear, wether pw-record, when a (supported) sample rate is set, wil resample or use it natively, as arecord does. Or wether there is at least any indication either of which it is currently doing. And wether there is a way to find out the soundcards capabilities without trial and error. But that may be another issue.

Offline

#8 2022-04-05 20:35:01

Maniaxx
Member
Registered: 2014-05-14
Posts: 732

Re: pipewire "bitperfect" recording


sys2064

Offline

#9 2022-04-05 20:54:12

EdeWolf
Member
Registered: 2016-01-06
Posts: 79

Re: pipewire "bitperfect" recording

Partial success. I now can record, I just needed to change the soundcard back to "analog stereo" and then back to "pro audio" in  pa-mixer. Probably with all that switching and plugging something got stuck.
So now I can record, even from the digital input, unfortunately, with arecord I still can record in any of the 3 supported samplingrates, which are not (neccessarily) those set for the ADC.

So the USB card does seem to do samplerate conversion internally. My hope has been, using the digital input, it would be a slave to the incoming clock, set by the ADC. Apparently it is however not and that is now beyond my control. Did not expect it to be so hard to get a SPDIF signal unaltered into a computer in 2022.

Thanks for your assistance and alsacap seems what I have been looking for. Will probalby give it a go motorrow, it's rather late here. Still open, how can I determine for pipewire, wether it will use resampling or native samplerate for recording? Any ideas left on that?

Offline

#10 2022-04-05 21:18:12

Maniaxx
Member
Registered: 2014-05-14
Posts: 732

Re: pipewire "bitperfect" recording

EdeWolf wrote:

how can I determine for pipewire, wether it will use resampling or native samplerate for recording?

Maybe 'pw-mon' shows something useful. Its a realtime logger.


sys2064

Offline

#11 2022-04-06 14:20:49

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,427

Re: pipewire "bitperfect" recording

Not entirely certain what you mean with "determine for pipewire". What comes as the input is defined by the application starting the recording. If this can be handled natively it should be using that, granted you configured the relevant "allow list": https://wiki.archlinux.org/title/PipeWi … le_rate(s)

As for knowing what applications ultimately request, I'm not all too familiar with the pw tools yet I'm afraid but e.g. pactl list sources and list source-outputs respectively contain fields that tell you what input sample from a given application and which input sample the DAC is actually opened with.

Last edited by V1del (2022-04-06 14:25:59)

Offline

#12 2022-04-24 14:25:50

EdeWolf
Member
Registered: 2016-01-06
Posts: 79

Re: pipewire "bitperfect" recording

I am a bit late back to the party, sorry, but I have been busy and to honest, I've forgotten about this. Anyway, for future reference:

Maybe 'pw-mon' shows something useful. Its a realtime logger.

Had a look into this, so far it is not really practical. Or maybe I've missed something.

What comes as the input is defined by the application starting the recording

I am not entirely sure, that is the full story. I'd rather suspect, the application makes a request for a given samplerate, and pipewire then brokers between what actually comes in (if it is a direct digital input where the AD converter sets the clock) or tries to set the samplerate accordingly (if it is an anlog input or some digital/digital converters).  If both do not match, pipewire will resample to satisfy the application.  But will most likely not tell you. And for most use cases that transparency is perfectly fine.

However, what I have been looking for is a way to tell pipewire not to resample, so if the application request a samplerate that is not available, because the stream is coming in with a different samplerate, to report an (unsupported) error to the application.

To name  jackd, that by design is running with a fixed samplerate, and the applcation cannot change this*. And so far, the detection of the samplerate required by jack has been working fine. So there certainly seem to exist  some mechanisms to  forcing an application into a specific sample rate. And that I wish to be able to configure with pipewire as well.

Btw. Currently I am not even shure, wether the "default.clock.allowed-rates" setting is also applicable to recording. 
 
*Unless of course some resampling is bridged in between. Exactly, what I would like to being able to avoid for certain use cases.

Offline

Board footer

Powered by FluxBB