Petrov's resampler for ALSA

OSS specific Linux discussion (x86/amd64)

Moderators: hannu, dev, cesium

ossuserr
Known Member
Posts: 272
Joined: Thu Jan 08, 2015 12:01 am
Sound Card: audigy 2 zs platinum, esi juli
OS: gentu riced to bo0st
Location: Earth

Re: Petrov's resampler for ALSA

Postby ossuserr » Wed Jul 01, 2015 12:07 am

i forgot its name. That configurator is called /usr/bin/arateconf and after installation can be found even after upgrade.

nuc
Moderator
Posts: 109
Joined: Fri Aug 03, 2012 10:20 am
Sound Card: PowerColor DEVIL HDX
OS: ArchLinux
Contact:

Re: Petrov's resampler for ALSA

Postby nuc » Sat Jul 04, 2015 8:24 pm

It should be noted that even if ALSA with a better resampler does a much better job, it will still never come to the precision of OSSv4.
Independent of the resampler, OSSv4 uses floating point precision for mixing, (only if enabled during build time though!), while ALSA uses fixed point.

See Hannu's (creator of OSS, and thus the first ever sound system for linux) point on this in his argument with Paul "dawhead" Davis (responsible for jack, Ardour, and kernel dev)
About floating point in kernel: This feature can be disabled when compiling OSS. It's enabled by default because there have not been any problems caused by it during past few years (which IMHO proves that there are no problems). Also the CPU load is exactly the same than without FP.

Believe or not the reason to use floating point in audio computations is precision. This may sound strange since all elementary computer programming books tell that integer computations are precise and floating point is not. You may think that I have misunderstood something important but this is not the case.

The alternative for floating point is fixed point. A common practice is to store a 24 bit sample in 32 bit integer so that the 8 most significant bits are unused (or used as headroom during computations). The problem with fixed point is that there is no footroom at all and the 8 bit headroom (24 dB) is far from enough.

For example if you attenuate a fixed point signal by 30 dB which is not that much. 30 dB attenuation means that the (originally) 24 bit sample is divided by ~1000. Let's select 1024 which is the same than shifting the sample 10 bit positions to right. Now you have only 14 bits of precision left and the least significant bits are lost forever. Even if you amplify the sample by 30 dB the 10 least significant bits will not return back. If the sample value was less than 1024 then the sample will drop to 0 and all information is lost.

Floating point doesn't have this problem. Single precision FP format has 24 bits for the mantissa (which is perfect for audio) and the remaining bits are used as the exponent. If you now divide the sample by 1024 then the actual sample stored in mantissa will not change at all. Just the exponent will change because the bits were shifted "virtually". During computations trhe mantissa will always store 24 most significant bits of the sample. Some information may leak on the floor but the lost information is about 70 dB below the current signal level.



You may find the whole top-level argument very informative while shocking at some points, but definately the best thing to read from http://insanecoding.blogspot.de/2009/06 ... sorry.html It will also teach you why OSS is in the state of acceptance it currently is, and why OSS devs are so discouraged about evolving OSS.
It is shocking to read that two such highly renowned experts on the (linux) sound topic are barely able to agree in one single point.

For everybody caring about OSSv4, and sound on linux in general, this is a must-read IMO. Beware though it took me like 3 hours to read through, even though I mainly evaded comments from others than hannu, dawhead, theodore tso or insanecoder.
Check out my effort on revamping the opensound website => github.com/Nuc1eoN/4Front-Tech-Website
Any feedback greatly appreciated =)

igorzwx
Known Member
Posts: 1256
Joined: Sun Jun 28, 2009 9:31 pm

Re: Petrov's resampler for ALSA

Postby igorzwx » Sun Jul 05, 2015 11:37 pm

nuc wrote:It is shocking to read that two such highly renowned experts on the (linux) sound topic are barely able to agree in one single point.


Human beings will never agree on anything.
A practical solution to this problem seems to be the freedom of choice.

There is a belief that Petrov's plugin may cure deafness.
If it really helps to cure hearing loss, ALSA users may eventually switch to OSS4.

ossuserr
Known Member
Posts: 272
Joined: Thu Jan 08, 2015 12:01 am
Sound Card: audigy 2 zs platinum, esi juli
OS: gentu riced to bo0st
Location: Earth

Re: Petrov's resampler for ALSA

Postby ossuserr » Mon Jul 20, 2015 12:11 am

I and my relatives have noticed that OSS driver gives amazing sound even on 5$ plastic speakers with ALC889 intergrated soundcard. I personally did not hear myself when speaking to microphone because the sound was as much same as my voice. I hope that OSS will have revival. People must undertand that alsa fools them by its low quality. Why they do not make float-point or change libsamplerate by a good resampler it's because they think that low quality is enough for us, because they regard us as a kind of "the cattle" and not humans. By the way some religions even justify such attitude to people. And another idea is that they are paid by corporations to provide low quality to make people by expensive hardware. I remember how linux was developing in 2000-2008. It was blooming. Now it stalls. Maybe because people use those smartphones and plastic ear plugs and listen to some crappy shit like rap and other shit.

ossuserr
Known Member
Posts: 272
Joined: Thu Jan 08, 2015 12:01 am
Sound Card: audigy 2 zs platinum, esi juli
OS: gentu riced to bo0st
Location: Earth

Re: Petrov's resampler for ALSA

Postby ossuserr » Sat Jul 25, 2015 7:48 pm

@nuc

You wrote "It should be noted that even if ALSA with a better resampler does a much better job, it will still never come to the precision of OSSv4.
Independent of the resampler, OSSv4 uses floating point precision for mixing, (only if enabled during build time though!), while ALSA uses fixed point.
See Hannu's (creator of OSS, and thus the first ever sound system for linux) point on this in his argument with Paul "dawhead" Davis (responsible for jack, Ardour, and kernel dev)"

Alsa developers have given the following answer to this:

"That link says "ALSA uses fixed point", but has no proofs of that, instead it just explains some theory about floating point format, which is correct, but has nothing to do about alsa. The truth is much easier: Alsa supports MANY formats (see the list above), not just one of them, and uses the format supported by the hardware.
So if e.g. hardware supports 32-bit integers only (some cards do) - alsa would use 32-bit format. If OSSv4 uses floating point - it actually looses precision, because 32-bit float format has 23 bits of precision, by converting from 32-bit integer flac into float and back you turn 32-bit sound into 23-bit. "

ossuserr
Known Member
Posts: 272
Joined: Thu Jan 08, 2015 12:01 am
Sound Card: audigy 2 zs platinum, esi juli
OS: gentu riced to bo0st
Location: Earth

Re: Petrov's resampler for ALSA

Postby ossuserr » Sat Jul 25, 2015 7:51 pm

Full list of formats supported by alsa "type plug" autoconversion module: S8 U8 S16_LE S16_BE U16_LE U16_BE S24_LE S24_BE U24_LE U24_BE S32_LE S32_BE U32_LE U32_BE FLOAT_LE FLOAT_BE FLOAT64_LE FLOAT64_BE MU_LAW A_LAW IMA_ADPCM S24_3LE S24_3BE U24_3LE U24_3BE S20_3LE S20_3BE U20_3LE U20_3BE S18_3LE S18_3BE U18_3LE U18_3BE

PS And still OSS4 sounds better... WHere is the secret???????????

igorzwx
Known Member
Posts: 1256
Joined: Sun Jun 28, 2009 9:31 pm

Re: Petrov's resampler for ALSA

Postby igorzwx » Sat Jul 25, 2015 11:09 pm

ossuserr wrote:And still OSS4 sounds better... WHere is the secret???????????


There is no secret here. Both ALSA and OSS4 are "open source".

Perhaps, ALSA developers do not hear the difference. This might be a problem rather than a secret.

ossuserr
Known Member
Posts: 272
Joined: Thu Jan 08, 2015 12:01 am
Sound Card: audigy 2 zs platinum, esi juli
OS: gentu riced to bo0st
Location: Earth

Re: Petrov's resampler for ALSA

Postby ossuserr » Sun Jul 26, 2015 10:11 am

igorzwx wrote:
ossuserr wrote:And still OSS4 sounds better... WHere is the secret???????????


There is no secret here. Both ALSA and OSS4 are "open source".

Perhaps, ALSA developers do not hear the difference. This might be a problem rather than a secret.


This is not the technical answer but the answer from the category "We are good and they are bad". Namely what is interesting is what spoils sound in alsa or what makes it better on OSS. I can't find the answer anywhere. I suppose since the ultimate product of all software is electrical impulses, those electrical currents of OSS4 somehow magically better match the hardware. By the way alsa developers do not say 'We are good and they are bad' but try to answer technically as you may notice. Also it may be that they are not guilty that alsa sounds worse. It's just that sound quality behaves in the unpredictable way and not always 100% responsive to the software. Somewhere was claimed that OSS is more titghly integrated with the kernel but this is kind of vague explanation.

igorzwx
Known Member
Posts: 1256
Joined: Sun Jun 28, 2009 9:31 pm

Re: Petrov's resampler for ALSA

Postby igorzwx » Sun Jul 26, 2015 2:23 pm

ossuserr wrote:And still OSS4 sounds better... WHere is the secret???????????


igorzwx wrote:There is no secret here. Both ALSA and OSS4 are "open source".
Perhaps, ALSA developers do not hear the difference. This might be a problem rather than a secret.


ossuserr wrote:This is not the technical answer but the answer from the category "We are good and they are bad".


You are right. It is not a technical answer, if "technical answer" is supposed to mean "the true secret of something", e.g. "the true secret of sound quality".

I did try to explain "a special technique" by which sound quality might be improved.
This ancient technique tends to be called "the method of trial and error".
This method, however, may not help ALSA developers to improve sound quality, if they do not hear the difference.

Do you believe that there is a "true secret of sound quality"?
You have to believe, if you suffer from "conspiratorial thinking".

Our brothers in Vanuatu also believe that there is a "true secret of Cargo".
They do use the method of trial and error to get the Cargo they want.
If a particular ritual fails to produce the much desired Cargo, they try another one.
The British anthropologists created several "scientific theories" which explain why Cargo cults fail to produce the expected results. For example:

When a European attempts to explain to a Kanaka the 'truth about cargo' he is merely explaining to himself how he thinks European goods are made; and the Kanaka is satisfied that the European has a special technique whereby he gains access to cargo...
The more administrative officers tried to explain to Yali the 'truth about cargo' the more he would feel... that white men had a 'secret' which they were holding back from Kanakas.
Kenelm Burridge, Mambu (1960).
_https://en.wikipedia.org/wiki/Kenelm_Burridge


You may try to ask Hannu. He may know the "true secret of OSS4".
However, if he tries to explain how he thinks his sound system produces "magic sound", you may feel that he has a 'secret' which he is holding back from Linux users.

This thread is about Petrov's "scientific resampler". Right?
Sergey Petrov also tried to explain "the true secret of his resampler".
If I am not mistaken, it was something like this:
His resampler is using FFT. The problem is the so-called "Gibbs phenomenon"
_http://en.wikipedia.org/wiki/Gibbs_phenomenon
Since the nature cannot be fooled, you have to apply "the method of trial and error" to find "optimal settings".
This is exactly what Sergey Petrov did. He tried different settings and played the results.
His "optimal settings" are simply those, which produce the best results (from his subjective point of view).
ALSA developers, of course, may choose other settings, which may produce another sort of sound.

Notice, however, that a sound system might be a much more complex thing than just a resampler.
It might be very difficult (if not impossible) to explain the true secret of OSS4.

ossuserr
Known Member
Posts: 272
Joined: Thu Jan 08, 2015 12:01 am
Sound Card: audigy 2 zs platinum, esi juli
OS: gentu riced to bo0st
Location: Earth

Re: Petrov's resampler for ALSA

Postby ossuserr » Tue Jul 28, 2015 11:48 am

Well, i know a lot about J and freemasons. I also know people who are members of mason lodges. And it's not a secret. See the movie by Stanley Kubrick "Eyes wide shut" which brought him death. And it's not the only movie about them. But i agree that you are not oblidged to believe that they exist. Actually it's more convenient and less dangerous to believe that they do not exist. But their baphomet symbols are everywhere. They try to put them into each product in an obvious or a hidden way. And you can't stop them. If they want your oss4 to be dead it will be dead. If they want to shut down this site, they will do it. But this does not mean we should not resist them.
That're good words about 'you can't fool nature'. I quite agree that pleasant sound can be achieved only via ways of testing and experiments because any theories we have are just simplified representation of the reality. Also i think that the so-called quite linear correctness does not always mean 'more pleasant'. For example we are tend to hear better in the middle ranges. That's why sound engineers often employ the curve raising lows and highs.
Concerning your comparance of me, the white man, with some papua natives, i think it's kind of silly, because papua won't ever use oss4 or even alsa. They don't need it. They need sex and food and some drum beats. Also you are free to think that we are the only rational beings in the universe, and there are no other planets suitable for life and in other egocentric staff. It's your choice. But to my mind it limits your outlook.

igorzwx
Known Member
Posts: 1256
Joined: Sun Jun 28, 2009 9:31 pm

Re: Petrov's resampler for ALSA

Postby igorzwx » Tue Jul 28, 2015 1:11 pm

ossuserr wrote:I quite agree that pleasant sound can be achieved only via ways of testing and experiments


If you agree, you may try to imagine a "semi-deaf Linux developer", who is writing drivers for sound cards and testing the results by playing music through them.

Perhaps, we may better discuss the Anthropology of Linux, instead of "conspiracy theories"
(preferably on the "General Discussion" forum _http://www.opensound.com/forum/viewforum.php?f=16 )

The basic ideas of the British Anthropology are very simple:
1. human beings are everywhere the same;
2. the white men are also Cargo cultists.

These "scientific ideas" were derived from the obvious facts and "scientific observations". For example, you may compare the ritual of jipari (Francis E. Williams. Orokaiva Magic, 1928) with the ritual of collective jerking (the Scotch-Irish Revival in Kentucky in 1800):

Next to the 'falling' exercise the most notable and characteristic Kentucky phenomenon was the 'jerks'. The unhappy victim shook in every joint. Sometimes the head was thrown from side to side with great rapidity. Again the feet were affected, and the subject would hop like a frog... Peter Cartwright declares that he had seen more than five hundred persons jerking at once in his congregation.
Frederick M. Davenport, Primitive Traits in Religious Revivals (1905).


Swoons and convulsive fallings have not been without precedent, but what is known as the jerks was altogether unprecedented in Christian lands. The person was instantaneously seized with spasms or convulsions in every muscle, nerve, and tendon. The head was jerked and thrown from side to side with such rapidity that it was impossible to distinguish the visage, and the most lively fears were awakened lest the neck be dislocated or the brains dashed out... The barks frequently accompanied the jerks, though of later origin. The exercise consisted of an individual taking the position of a dog, moving about on all fours, snapping the teeth, and barking, with such exactness of imitation to deceive any one whose eyes were not directed to the spot. The persons frequently affected were the most cultivated and refined. Those affected by trances and who saw visions were innumerable.
_http://www.pbministries.org/History/John%20T.%20Christian/vol2/history2_part3_04.htm


jerk – Wiktionary _http://en.wiktionary.org/wiki/jerk#Noun
jerk – Urban Dictionary _http://www.urbandictionary.com/define.php?term=Jerk&defid=1365784
libjerk – see: _http://linuxhaters.blogspot.de/2008/08/one-bug-report-to-rule-them-all.html

In essence, such "very strange cults" are the cults of Knowledge. To be affected by the jipari, a person should be sufficiently "cultivated and refined". As it was explained by the natives themselves, the heads of the "possessed" were "soft" (saurapa). The natives, who had been educated in missionary schools, were, as a rule, strongly "possessed", since "the schoolboys who learnt readily were those with the soft heads" (Francis E. Williams. Orokaiva Magic, 1928).

One may presume, therefore, that many Linux users (and, especially, Linux developers) may also have "soft heads". They may also suffer from "Cargo Thinking".
This may result in very strange cults, such as the cult of PulseAudio and the like.

To summarize: One may not need "conspiracy theories", since Anthropology can explain "everything".

ossuserr
Known Member
Posts: 272
Joined: Thu Jan 08, 2015 12:01 am
Sound Card: audigy 2 zs platinum, esi juli
OS: gentu riced to bo0st
Location: Earth

Re: Petrov's resampler for ALSA

Postby ossuserr » Sun Aug 02, 2015 12:10 am

I don't want to discuss racial questions here but if you like science so much you must know the fact that average iq of the blacks is lowest among races. Also there are no great scientists among them and generally any great thinkers. But this refers not only to the blacks but some other hominides as well... I will stick to my point of view. Native must go a long way to be equal to the whites, this concerns also the semites. Unfortunately due to efforts of the dark forces genetical pool of the white race was much spoiled during last 5500 years when semites tool dominating position on the planet. ecological crisis we observe is due to their greediness and mass anticulture. I am not going to quote talmud here, you should have access to it.

Let's better return to linux. I have noticed that the so called plugin host Carla spoils sound, to be more specific, linuxsampler plays samples much more pleasantly. I feel that that carla cuts some harmonics from the soundfonts, especially in the highs. Can you check this to confirm my feelings? Load the same sondfonts into carla and record, then into LS and record and listen both tracks. I also observe this phenomenon just by playing any soundfont. Tries several versions of carla - same result...
Tried truepianos. The sound is too bright, too artificial. Does it mean we can suspect that 4front devs are deaf? However pianoteq demo produced even worse impression...

igorzwx
Known Member
Posts: 1256
Joined: Sun Jun 28, 2009 9:31 pm

Re: Petrov's resampler for ALSA

Postby igorzwx » Sun Aug 02, 2015 1:29 pm

ossuserr wrote:I have noticed that the so called plugin host Carla spoils sound, to be more specific, linuxsampler plays samples much more pleasantly. I feel that that carla cuts some harmonics from the soundfonts, especially in the highs. Can you check this to confirm my feelings? Load the same sondfonts into carla and record, then into LS and record and listen both tracks. I also observe this phenomenon just by playing any soundfont. Tries several versions of carla - same result...
Tried truepianos. The sound is too bright, too artificial. Does it mean we can suspect that 4front devs are deaf? However pianoteq demo produced even worse impression...


I can agree that one sort of "digital crap" may sound "more artificial" than another one, but I would not agree to listen to it.
If you want to discuss such things, you may start a new topic on the "General Discussion" forum _http://www.opensound.com/forum/viewforum.php?f=16

ossuserr wrote:Does it mean we can suspect that 4front devs are deaf?


What is really strange is that the Fast resampler is enabled by default in OSS4.
If you disable all resamplers in VMIX, the Fast resampler will be automatically enabled by the "secret cooked mode"
_http://manuals.opensound.com/developer/SNDCTL_DSP_COOKEDMODE.html
See also: _http://www.opensound.com/forum/viewtopic.php?f=3&t=3543&start=90#p19477

Nevertheless, OSS4 with the Fast resampler may still sound much better than ALSA.
Perhaps, you may try to compare different resamplers of OSS4 and report you "feelings" on the "General Discussion" forum
_http://www.opensound.com/forum/viewforum.php?f=16

igorzwx
Known Member
Posts: 1256
Joined: Sun Jun 28, 2009 9:31 pm

Re: Petrov's resampler for ALSA

Postby igorzwx » Mon Aug 03, 2015 4:23 pm

Re: The true secret of sound quality

It does not make much sense to discuss the quality of ALSA drivers, if you do not know how to disable all the "virtual crap of ALSA" to get a direct access to ALSA drivers in "exclusive mode". However, to solve this problem you may need, perhaps, a kind of "secret documentation" of ALSA.

The OSS4 documentation is "open source", and it is not difficult to enable the so-called "exclusive mode" in OSS4.
Both the "evil cooked mode" and the crappy VMIX can be disabled in /usr/lib/oss/conf/osscore.conf (then you have to reload OSS).
To check, whether the "secret resampler" is disabled, you may try to play an audio file of an exotic sample rate (which is not supported by your soundcard, see: "ossinfo -v9").

There is also a more comfortable way to use the "exclusive mode" of OSS4. You can simply run ossplay in "exclusive mode", e.g., "ossplay -R".

NOTE: If you want to verify the "exclusive mode" of OSS4 by "tracing", you may need a special sort of "strace", that is, "strace for OSS4". This "secret tool" was compiled by Cesium, and it is available on this forum.

Code: Select all

$ ./strace -e trace=ioctl,open ossplay *.wav -R


The code of ossplay is "open source". It contains a "magic code", which provides an "exclusive mode".
Therefore, it was not difficult to realize a similar solution in Petrov's tools for OSS4, such as pcm_play and Petrov's plugin for DeadBeef player.

Petrov's plugin for ALSA does not provide any "exclusive mode".
Petrov does claim that his plugin disables ALSA resamplers, but he does not claim that it disables the "software mixer" of ALSA.
The reason is simple. Petrov's plugin for ALSA is a plugin for the "software mixer" of ALSA.

It is very probable that the "crappy software mixer" of ALSA might be the main source of sound distortions, although, of course, ALSA drivers might be crappy as well.

If you really want to localize the main source of sound distortions in ALSA, you have to disable the "software mixer" of ALSA, and you have to ensure that this crappy thing is really disabled. It should verified with a truly exact method, it should be true beyond a shade of doubt.

However, if you want to fool yourself, you do not need to verify anything. It might be enough to create a "credible theory" about sound quality. It is not difficult to find proper "facts" for any theory to make it look "credible".

In short, if you have an access to the "secret documentation" of ALSA, you may find out how to disable the "software mixer" of ALSA and enable the much desired "exclusive mode".
Perhaps, you may also need a tool with which to verify such "exclusive mode". You may try a kind of "strace" _https://en.wikipedia.org/wiki/Strace

The ALSA developers are supposed to use the "exclusive mode" of ALSA to test the quality of their drivers.
If there is not any such "exclusive mode", the ALSA developers cannot test the quality of their drivers.
However, if sound quality does not matter, they can simply create a sort of crap to get money for it.


Return to “Linux”

Who is online

Users browsing this forum: No registered users and 2 guests