To be fair, it is not a great pleasure to test Petrov's resampler with ALSA. Sometimes you even feel that it is already a kind of "sado-masochism" in terms of Erich Fromm
http://en.wikipedia.org/wiki/Erich_FrommThe problem is that ALSA tends to behave unpredictably, regardless of what is written in ~./asoundrc, especially for sample rates 96kHz and 192kHz with Intel HDA soundcards (e.g. ICH7). ALSA appears to be made "advanced" to such an extend that is already as unpredictable as that famous "strange attractor", a kind of "chaos theory", in other words
http://en.wikipedia.org/wiki/Lorenz_attractorYou get a strange diagnostics on terminal, like this:
Code: Select all
Output: 192000 Hz, 2 ch, 's32_le' (0xa): dummy = 0, period = 4096
Rates: 30080 --> 131072 (jitter = 0.09%)
Output: 96000 Hz, 2 ch, 's32_le' (0xa): dummy = 0, period = 4096
Rates: 30096 --> 65536 (jitter = 0.03%)
and you hear strong harmonic distortions.
It was explained that ALSA has a kind of low quality linear resampler inside, and it tends to resample everything with that evil resampler. It seems to be virtually impossible to disable that evil resampler, and, what is more, ALSA also tends to set wrong values for "buffer sizes", completely ignoring your ~./asoundrc. You can never predict the result (think of quasi-chaotic behaviour of a very complex financial market).
In short, you never know exactly what you actually hear with ALSA. Were those distortions caused by that evil linear resampler of ALSA, or the buffer sizes were already reset? Or it was something else?
It was already designed a special scientific test for ALSA. That magic test tells you not to use sample rates 96kHz and 192kHz with Intel HDA ICH7 soundcard. This simply means that there is not much to test. The sample rates 96kHz and 192kHz are not supported for ALSA for Intel HDA soundcards (perhaps, all of them). But they can be tested with OSS4 (!), at least, with those soundcards, which are supported by OSS4.
Sergey Petrov has already created a magic tool in the form of a standalone resampler/player for OSS4 (you can get a testing version directly from the author). I have already made some simple tests. Not surprisingly, with Petrov's standalone resampler/player and OSS4, "Tabla-Tabla Tarang" sounds much better, much more exact and natural than with ALSA and Petrov's resampler plugin.
Some technical details: "ossplay" has a very nice option:
Code: Select all
-R Disable redirection to virtual mixer engines and sample rate/format
conversions. Should not be used unless absolutely necessary.
You have to know exactly, of course, which formats (e.g. 48kHz 16bit) are supported by your soundcard, if you want to apply such a magic option. And you should be aware of the fact that "by default the application [i.e. ossplay] will try to determine the audio file's format and play audio based on the stored information about sample format, number of channels and sampling rate", see "man ossplay".
The option "-R" does disable resampling in a magic way. It does not change anything in the OSS4 virtual mixer; e.g., production quality remains enabled as before, "vmix0" is not disabled too, and sound quality seems to be exactly the same as if you disable vmix0 in the mixer. It is very convenient not to disable vmix0, because it allows other applications to play sound. In other words, the sound device remains available for all audio applications.
To clarify this fact, I made tests with the special audio file: 10Hz + 20kHz (44100Hz, 16bit) created with Audacity Nyquist tools.
WARNING: Such test files should only be played at a low volume level, even if you hear nothing special! It can be very harmful to equipment and/or your ears. It's strongly recommended to use very cheap (PC) speakers, otherwise you might really ruin your tweeters.
Tests were performed on my ancient computer (of 2001), Arch Linux + OSS4, soundcard:
Code: Select all
00:11.5 Multimedia audio controller: VIA Technologies, Inc. VT8233/A/8235/8237 AC97 Audio Controller (rev 30)
Commands:
Results:1. "direct playback" is better than OSS4 "Fast resampling"
2. "Production quality" is better than "direct playback"
In short:
"Fast" < "High" < "High+" < "direct playback" < "Production quality" < "Petrov's resampler"NOTE: For this particular VIA sound card, the difference is clearly obvious (for anybody) when the test file is played.
Yes! Petrov's exact resampler is much more exact than OSS4 "Production quality".
It is now proved with mathematical exactitude. It is now an objective scientific truth."Production quality" does produce relatively strong harmonic distortions which are clearly audible with the test file. I did hear those distortions from the very beginning, and I was very intrigued to find out whether those distortions were caused by OSS4, or by the VIA soundcard itself, or by Ubuntu, or by something else. Now it is clear. Petrov's resampler/player does not produce such distortions, and the same soundcard is now playing genuine sound with OSS4.
The exact scientific test is easily reproducible.
Requirements:1. Audacity (with which to create the test file)
2. old VIA sound card VT8233/A/8235/8237 AC97 (or any other soundcard of comparable quality)
3. Petrov's standalone resampler/player (it is now available for OSS4).
Intel ICH4 soundcard, for example, might not be optimal for the purpose.
As it was already mentioned, experiments were performed on a very old PC (of 2001).
Processor load seemed to be insignificant (this, of course, should be tested more carefully). All these allow to presume that a kind of "exact audio player" (with Pertrov's resampler inside) might be a practical solution for "non-professional" soundcards which we have in ordinary computers. It is likely to work well on virtually all ordinary PCs, notebooks, and even netbooks with Arch Linux and OSS4 installed.
There are still many things to clarify. What puzzles me immensely is that incomprehensible "scientific knowledge" which Petrov's resampler/player prints on the terminal during resampling. I am very intrigued to find out what it really means.