On Jan 09 13:10:09, euryd...@riseup.net wrote: > > > aucat(1) currently says > > > > > > BUGS > > > Resampling is low quality. > > > > > > Is this still considered to be the case? > > > > IMO, it doesn't deserve the BUGS section anymore, I'll remove this > > sentence. Objections? > > Although I need to finalize the Perl script I was using to do this (life gets > busy), in practice I was able to distinguish between samples created by > audio/sox and aucat(1) in informal AB/X testing on my 7th generation X1 Carbon > with HiFiMan Sundara headphones plugged in. To describe the circumstances + > outcome briefly: 9 out of 10 correct in 10 trials; randomly sampling from an > array containing the givens A and B to get an unknown X; comparing 15 seconds > of > audio; audio/sox as the playback software. In the future, I would do >=16 > trials, and perhaps conduct the tests from my desktop instead since it has a > discrete amp and DAC. > > In offline resampling from 48kHz to 44.1kHz, the highs were most affected and > that's what I was able to use to distinguish between samples. The percussion, > especially the cymbals, sounded different in particular because the clip > resampled by aucat had cymbal crashes that seemed to 'shimmer' much less (the > decay was more rapid). The spectrograms seemed to confirm that the highs were > most affected. > > Whether that means "low quality resampling" or merely that the results of the > two commands can be differentiated is something I'm uncertain of. Either way, > I > don't know enough about C or sndio internals to be useful in that domain yet. > As > an aside, I did find this to be a useful resource for learning about digital > audio resampling, and they recommend audio/sox there. > > https://ccrma.stanford.edu/~jos/resample/ > > I hadn't said anything about this earlier because I wanted to take the time to > finish + document the script, reproduce my results with a royalty free sample > at > a greater trial count, and then post. Given that I haven't done so yet, I can > at > least post the commands used to resample the audio for those that are > interested. > > > # This was originally an opus file downloaded with www/yt-dlp. > # Converting to WAV so both SoX and aucat can work with it. > $ opusdec input.{opus,wav}
Can you please point to the specific opus file, so that I can reproduce exactly what you have done? > # Resample 16-bit 48kHz WAV file to 44.1kHz using both SoX and aucat(1). > # > # If I recall correctly, I converted to FLAC here because the WAV headers > # generated by aucat and SoX differed, and so SoX would refuse to play WAV > files > # created by aucat. That would be a bug in itself. How exactly does SoX refuse to play the WAVs created by aucat? > $ sox -G input.wav -t wav - rate -v 44100 | flac - -o output-sox.flac > $ aucat -i input.wav -h wav -r 44100 -e s16 -o - | flac - -o output-aucat.flac sox dithers by default; can you try with sox -D to see of the results are more similar? > # Generate spectrograms for later inspection/comparison. > $ sox output-sox.flac -n spectrogram -o spectrogram-sox.png > $ sox output-aucat.flac -n spectrogram -o spectrogram-aucat.png > > 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 > > https://www.freebsd.org/cgi/man.cgi?query=sound&manpath=FreeBSD+13.1-RELEASE&format=html 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