On Fri, Jan 13, 2023 at 01:10:56PM +0100, Jan Stary wrote: > > > > I'd certainly be interested in the ability to play audio in a way > > > > that avoids resampling altogether, > > > > > > If you have a 48kHz file, and your audio device can only do 44100, > > > then you have to resample, no way around it. > > > > > similar to what a user can do on FreeBSD with the > > > > following sysctl tweaks: > > > > # sysctl hw.snd.maxautovchans=0 dev.pcm.0.bitperfect=1 > > > > It's off topis of course, but What is dev.pcm.%d.bitperfect gonna do > > > if the sample rate (or some other characteristics) is not what the device > > > itself supports? As in e.g. $ play -r 12345 -c 3 -n synth 10 > > On Jan 10 09:36:28, a...@caoua.org wrote: > > chown <your_user_id> /dev/audio* > > rcctl stop sndiod > > After doing that, > > $ play -V 48000.wav > play: SoX v14.4.2 > play INFO formats: detected file format type `wav' > > Input File : '48000.wav' > Channels : 2 > Sample Rate : 48000 > Precision : 16-bit > Duration : 00:00:25.00 = 1200000 samples ~ 1875 CDDA sectors > File Size : 4.80M > Bit Rate : 1.54M > Sample Encoding: 16-bit Signed Integer PCM > Endian Type : little > Reverse Nibbles: no > Reverse Bits : no > > > Output File : 'default' (sndio) > Channels : 2 > Sample Rate : 48000 > Precision : 16-bit > Duration : 00:00:25.00 = 1200000 samples ~ 1875 CDDA sectors > Sample Encoding: 16-bit Signed Integer PCM > Endian Type : little > Reverse Nibbles: no > Reverse Bits : no > > play INFO sox: effects chain: input 48000Hz 2 channels > play INFO sox: effects chain: output 48000Hz 2 channels > In:15.4% 00:00:03.84 [00:00:21.16] Out:184kk [ ---=|=--- ] > Clip:0 > > $ play -V 44100.wav > play: SoX v14.4.2 > play INFO formats: detected file format type `wav' > > Input File : '44100.wav' > Channels : 2 > Sample Rate : 44100 > Precision : 16-bit > Duration : 00:00:25.00 = 1102500 samples = 1875 CDDA sectors > File Size : 4.41M > Bit Rate : 1.41M > Sample Encoding: 16-bit Signed Integer PCM > Endian Type : little > Reverse Nibbles: no > Reverse Bits : no > > Output File : 'default' (sndio) > Channels : 2 > Sample Rate : 44100 > Precision : 16-bit > Duration : 00:00:25.00 = 1102500 samples = 1875 CDDA sectors > Sample Encoding: 16-bit Signed Integer PCM > Endian Type : little > Reverse Nibbles: no > Reverse Bits : no > > play INFO sox: effects chain: input 44100Hz 2 channels > play INFO sox: effects chain: output 44100Hz 2 channels > In:25.3% 00:00:06.32 [00:00:18.68] Out:279kk [ =====|===== ] Clip:0 > Aborted. > > $ aucat -i 44100.wav > default: unsupported audio params > > $ aucat -i 48000.wav > default: unsupported audio params > > > It seems sox negotiates either 48000 or 44100 with sndio > (meaning the sndio library, not the non-running sndiod) and sends that, > but aucat errors out. But the device itself can do 48000 (says audioctl), > so is that a bug in aucat? >
It's not related to the sample rate. Internally aucat uses 24-bit samples lsb-aligned in 32-bit words. Then, it assumes the device supports everything and doesn't bother setting up a conversion layer.