It is now an objective scientific truth. You can safely believe that Petrov's resampler is exact in an absolute sense, for it is exact much more than enough for the purpose.

Thus, there are two things to discuss:1. clear-cut empirical tests,2. subjective perception of sound.

To summarize: the problem of sound quality in Linux is simply a problem of conversion from one audio format to another.

The solution is obvious: you should have a good converter and you should know how to disable PulseAudio and other unwanted resamplers which distort sound.

There are three practical solutions to this problem:1. You can buy an expensive souncard which has a good converter inside. It should be a sundcard supported by OSS4, because OSS4 allows to disable unwanted resamplers (you have to study the list of supported soundcards before you buy anything). 2. You can use Petrov's exact converter.2. You can make such converter yourself following the example of Sergey Petrov.

hiro wrote:Yeah, I did something compareable, I'm using libsamplerate for 44,1 to 48 kHz conversion and never had/heard any problems.

If I understood you correctly, you state that you are not able to perceive strong distortions produced by libsamplerate. Right?

However, if you look at Audacity spectrograms, you may easily notice a huge difference between the original file (44.1kHz) and the converted file (libsamplerate → 48kHz). The difference in high frequencies is dramatic.

This dramatic difference is clearly audible for flute recordings, such as Händel's Sonatas for Flute, if you are able to hear certain frequencies.

It seems that "Production quality" is also doing something wrong with high frequencies. They are, in a way, suppressed and distorted. This is clearly audible with the same Händel's Sonatas for Flute and the test file 10Hz + 20kHz.

In reality, it is likely to be a non-linear mix of distortions rather than a linear sum. When aggregate distortions (amplified and new ones) achieve a critical level, there will be a qualitative change in perception of sound, and a person may not agree to tolerate a sound quality produced by Ubuntu Linux on his computer. The effect of Ubuntu, as a rule, depends on hardware. The removal of PulseAudio usually improves sound quality, simply because PulseAudio is a source of additional distortions (which tend to be amplified non-linearly).

Soundcards are, in essence, non-linear things, they do have a kind of non-linear singularities which amplify distortions. Since soundcards are different in quality, it is possible to design "clear-cut empirical tests" for certain soundcards. If you have a better soundcard, distortions might not be so obvious, but they might be still audible for audiophiles.

It turned out that it is not always possible to disable resampling in OSS4. However, if an audio file is already converted to 48kHz sample rate with Petrov's exact converter, "Production quality" is not likely to produce audible distortions, and you may notice a significant improvement in sound quality. This might be, of course, very subjective, but I did notice an essential improvement in sound quality for Intel HDA ICH6. An unexpected reaction of women and children confirmed my subjective opinion, they were really charmed by the exact sound of Carlo Farina's Le Sonate.

Yes, that's true, I can hear 20kHz, but libsamplerate doesn't create any audible distortions for me. Perhaps I have to practice this a little more?

Well, I did practice and test some more and I learned something at least. I compared these 4 configurations: - qmmp->jack->alsa->good external firewire soundcard- mpg123->oss->spdif out from a cheap intel hd soundchip to good dac - mpg123->alsa->the analog output of the roland sh-201 synthesizer- last and least: mpg123->oss->intel hd analog audio output

The first two sounded exactly the same when I had their loudnesses balanced. But that sh-201 sound stood out a lot in that comparison. Lack of dynamics in both sh-201's and intel hd's analog output and even distortions in the latter (probably my fault: but ossmix had to much options for me to bother).

Alsa is probably doing linear resampling again, this could also explain the big differences. I was careful to use the same sample rates though...

In contrast to these easily audible differences libsamplerate didn't create any differences.

For me the case is simple: For playing music I will use my firewire soundcard with jack in 44.1 kHz, so that quality's bottleneck is in the source. I guess I will have to create my own music in 24bit if I want more dynamics.

How high are your observed frequencies and how much over the noise floor did they really get?

hiro wrote:Yes, that's true, I can hear 20kHz, but libsamplerate doesn't create any audible distortions for me. Perhaps I have to practice this a little more?

Well, I did practice and test some more and I learned something at least. I compared these 4 configurations: - qmmp->jack->alsa->good external firewire soundcard- mpg123->oss->spdif out from a cheap intel hd soundchip to good dac - mpg123->alsa->the analog output of the roland sh-201 synthesizer- last and least: mpg123->oss->intel hd analog audio output

The first two sounded exactly the same when I had their loudnesses balanced. But that sh-201 sound stood out a lot in that comparison. Lack of dynamics in both sh-201's and intel hd's analog output and even distortions in the latter (probably my fault: but ossmix had to much options for me to bother).

Alsa is probably doing linear resampling again, this could also explain the big differences. I was careful to use the same sample rates though...

In contrast to these easily audible differences libsamplerate didn't create any differences.

For me the case is simple: For playing music I will use my firewire soundcard with jack in 44.1 kHz, so that quality's bottleneck is in the source. I guess I will have to create my own music in 24bit if I want more dynamics.

How high are your observed frequencies and how much over the noise floor did they really get?

Hi hiro!

I do not think that it is a good idea to mix everything together, for it may lead to a further confusion.

1. ALSA is incomprehensible. If a linear resampler is involved, it may play "bad clipping" with Risset Bell. However, if you hear "bad clipping" with ALSA, it might be caused by many other factors.

2. All your players do not seem to be reliable, they may distort sound themselves http://4front-tech.com/hannublog/?page_id=34MPlayer, for example, has an own resampler inside (it is not so easy to disable it with ALSA). Other players may have a resampler as well.There is a resampler inside "libav", which is said to be impossible to disable without "esoteric techniques". Edit: Your players may also contain filters, equalizers, and other things, which may distort sound.

4. For testing sound quality, I use ossplay and Petrov's standalone player (pcm_play).

5. Different soundcards emphasize distortions in different way.

6. "Fast" resampler of OSS4 produces "bad clipping" with Risset Bell. It may also produce "noise" and anything else, and other OSS4 resamplers may also produce a kind of noise. Why not?

7. To understand something, we have to create special "laboratory conditions" by removing all unwanted sources of distortions and uncertainty.

Let us try a simple experiment.

1. You may take a lossless recording, something like Carlo Farina's Le Sonate, or Le Chant des Templiers (Ensemble Organum), or something else of the sort.

2. You may convert them with different resamplers (libsamplerate, Petrov's coverter, etc.), and play them with "ossplay -R" and/or ossplay with "Production quality" (44100 → 48000).

3. You may play them with ordinary Intel HDA soundcard (ensure that resampling is disabled, if necessary).

4. You may try to notice "nuances".

You see, the algorithms in questions are based on different principles, they are essentially different, especially in processing "nuances".

NOTE: Petrov's resampler can also convert 16bit → 32bit, it may make a difference for Intel HDA. It can also convert stereo → surround.In any case, run "ossinfo -a -v9" first, it will tell you which formats are supported.

------------------Edit: You should not forget, however, that the ancient algorithm of resampling (e.g. libsamplerate, "Production quality", etc.) involves a kind of filtering (sic!) The filter might be more or less exact, but, in any case, your sound is already filtered, sterilized, it is, in fact, a kind of ersatz sound. If you have an ideal soundcard, you may believe that sound is "natural", but it cannot be natural, by definition. Is it possible to produce "natural coffee" from acorns? If sound is already processed with libsamplerate, it can hardly by made natural by the most expensive soundcard.

The information theory is still valid, and it tells you something like this:

In practice, neither of the two statements of the sampling theorem described above can be completely satisfied, and neither can the reconstruction formula be precisely implemented. The reconstruction process that involves scaled and delayed sinc functions can be described as ideal. It cannot be realized in practice...

If to translate all these into an ordinary human language, the ancient resampling algorithm is not suitable for resampling "lossless audio", simply because it transforms "lossless" into "lossy". It was a CD, or FLAC, and now you have a kind of ogg, or mp3, and you seem to be ready to believe that everything is O.K. If your soundcard has an internal HW resampler inside, it is likely to be of the same sort. And what about high frequencies? It depends on how that "low pass filter" was designed.

igorzwx wrote:I do not think that it is a good idea to mix everything together, for it may lead to a further confusion.

Yeah, the complexity of the sound systems and our hearing makes it very difficult to decide where to start when you want to improve that sound system. Without a lot of experience or knowledge at least.You have to make a lot of compromises and get no perfection.I think my speakers for example aren't good enough to justify deeper tests at the moment. Also I seem to need quite some time to get used to a specific sound and only afterwards I can hear differences. I will have to train my ears some more before I go on...

1. ALSA is incomprehensible. If a linear resampler is involved, it may play "bad clipping" with Risset Bell. However, if you hear "bad clipping" with ALSA, it might be caused by many other factors.

I don't have any dropouts... and if I understand correctly that's what they are talking about, right?

MPlayer, for example, has an own resampler inside (it is not so easy to disable it with ALSA). Other players may have a resampler as well.

mpg123 is simple and has no such problems, with qmmp I don't know for sure, but seeing it's cpu usage I think not.

There is a resampler inside "libav", which is said to be impossible to disable without "esoteric techniques". Edit: Your players may also contain filters, equalizers, and other things, which may distort sound.

igorzwx wrote:I do not think that it is a good idea to mix everything together, for it may lead to a further confusion.

Yeah, the complexity of the sound systems and our hearing makes it very difficult to decide where to start when you want to improve that sound system. Without a lot of experience or knowledge at least.You have to make a lot of compromises and get no perfection.I think my speakers for example aren't good enough to justify deeper tests at the moment. Also I seem to need quite some time to get used to a specific sound and only afterwards I can hear differences. I will have to train my ears some more before I go on...

1. ALSA is incomprehensible. If a linear resampler is involved, it may play "bad clipping" with Risset Bell. However, if you hear "bad clipping" with ALSA, it might be caused by many other factors.

I don't have any dropouts... and if I understand correctly that's what they are talking about, right?

MPlayer, for example, has an own resampler inside (it is not so easy to disable it with ALSA). Other players may have a resampler as well.

mpg123 is simple and has no such problems, with qmmp I don't know for sure, but seeing it's cpu usage I think not.

There is a resampler inside "libav", which is said to be impossible to disable without "esoteric techniques". Edit: Your players may also contain filters, equalizers, and other things, which may distort sound.

7. To understand something, we have to create special "laboratory conditions" by removing all unwanted sources of distortions and uncertainty.

If I had enough money I would try that, too

I do not think that money may help in this particular case. On the contrary, the more money one has, the more exotic experiments he may design. To be able to make a correct physical experiment one may need a certain knowledge and discipline of thinking rather than expensive equipment. It is affordable in our day to reproduce certain exact experiments of Galileo and Newton, and this is what children can make in a school in Russia, in Africa, and elsewhere.

Hey, I haven't tried the "exact resampler", because I don't know what it is. Also, not hearing any difference between the original and it's (libsamplerate) resampled version, I doubt my ears are of any value in this test (assuming the exact resampler would be of higher quality)...

hiro wrote:Hey, I haven't tried the "exact resampler", because I don't know what it is. Also, not hearing any difference between the original and it's (libsamplerate) resampled version, I doubt my ears are of any value in this test (assuming the exact resampler would be of higher quality)...

O.K. You do not want to try Petrov's resampler for this or that reason. Perhaps, you do not need it.What remains unclear is how you compare "the original and it's (libsamplerate) resampled version".Which equipment is used to play "the original"?And what is that original? What kind of music is it?

EDIT: The definition of "original" is missing, and the procedure of comparison is unclear.How do you know what is the exact sound of the original?

The sort of music does matter. If it is a natural sound of natural instruments with natural ambience, it is one thing.

am·bi·ence /ˈambēəns/ Noun1. The character and atmosphere of a place.2. Background noise added to a musical recording to give the impression that it was recorded

am·bi·ence - The mix of background noise and other reflected sounds that make up a room's acoustic character. More recently, a generic description of new age music. http://www.fpny.org/theater_glossary.htm

I tried pianos and strings, but also some electronic music. And I use 320kbit mp3s.I did semi-random blind ab tests and counted my misses.Having done all that, I'm quite satisfied and when I want to improve my system I will have to buy new speakers before anything else. Because I'm quite sure they are the weakest point. Although I've also learned that a good soundcard can make a great difference...

hiro wrote:I tried pianos and strings, but also some electronic music. And I use 320kbit mp3s.I did semi-random blind ab tests and counted my misses.Having done all that, I'm quite satisfied and when I want to improve my system I will have to buy new speakers before anything else. Because I'm quite sure they are the weakest point. Although I've also learned that a good soundcard can make a great difference...

Do you mean that the "original" is a kind of lossy mp3 file?In this case, our discussion about sound quality does not make much sense, especially, if those mp3s were encoded with LAME.

You may ask PulseAudio experts on Ubuntu forum which soundcards and speakers are suitable for such mp3s.

Strange. If I remember correctly the last src version with any significant distortion was 0.1.2. See: http://src.infinitewave.ca/images/Tone/SRC_BestSinc.pngI also use 0.17 and should thus hear exactly the same as you do. Can you show me your bad audacity results perhaps? I don't believe they can be *that* bad...

Or are you actually able to hear over 20kHz?

Give me a break, all my classical stuff is in flac.And what gear are you using? 1000$ dac, 500$ headphone preamp,... ? (For some people this comes near perfection, for some it's better than perfection when I recall correctly;)

hiro wrote:Strange. If I remember correctly the last src version with any significant distortion was 0.1.2. See: http://src.infinitewave.ca/images/Tone/SRC_BestSinc.pngI also use 0.17 and should thus hear exactly the same as you do. Can you show me your bad audacity results perhaps? I don't believe they can be *that* bad...

Or are you actually able to hear over 20kHz?

Give me a break, all my classical stuff is in flac.And what gear are you using? 1000$ dac, 500$ headphone preamp,... ? (For some people this comes near perfection, for some it's better than perfection when I recall correctly;)

It seems that we have a nice discussion. Everyone is speaking with himself.As far as I know, the Russian kids do not use such mp3s for any sort of music.There are also Linux users who are perfectly happy with PulseAudio and lossy formats.

hiro wrote:Well, all my russian friends like my mp3s. Although some don't, in which case they created them

I like sharing what I've heard, (it seems to fit into my theoretical understanding of the subject, but I'd still like to verify it).

So, what about my question and my request of a screenshot? I'd really like to understand why you hear distortions with libsamplerate. (Because I don't follow your reasoning)

Yes. Agreement cannot be achieved through the help of reasoning, screenshots and mathematical formulae, if something else is missing. The history of economic science proves this point (see Arjo Klamer, Conversations with Economists). There are many schools of economic thought which cannot reach agreement. Many attempts had been made to solve this problem. Eventually, consensus was achieved with something like this: "We have agreement that we have no agreement". This seems to be a "universal solution" for any discussion of the sort.