IPB

Welcome Guest ( Log In | Register )

3 Pages V  < 1 2 3 >  
Reply to this topicStart new topic
ALSA sample rate conversion, ALSA uses a poor-quality linear interpolator
cabbagerat
post Aug 24 2006, 09:07
Post #26





Group: Members
Posts: 1018
Joined: 27-September 03
From: Cape Town
Member No.: 9042



QUOTE (CyberFoxx @ Aug 23 2006, 13:34) *
We started out with a simple comparing of samplerate and samplerate_order. Out of the 5 he sent me, I got 5 correct. Was pretty simple considering that samplerate_order is pretty bad. We just did this one to make sure my ears were working. happy.gif

Indeed - samplerate_order is truly awful. samplerate_linear is much better, but still not much good.
QUOTE (CyberFoxx @ Aug 23 2006, 13:34) *
Comparing samplerate and samplerate_best managed to embarrass me though. Out of 10, I got 1 right, 2 wrong, and 7 unsure. And honestly, I think the one I got right was a guess.
This one is very easy with udial.wav, and possible the chenoa sample with headphones(search for them if you don't have them). I failed with everything else though.
QUOTE (iGold @ Aug 23 2006, 21:52) *
Can anyone give link to good test sample for checking resampling quality? I know about dial.wav but maybe better test sample exists?
You could try chenoa (search for it) - that's always treated me well for resampling tests. As far as I remember, the Live 24 can't resample in hardware at all, it's been a while since I read the specs but the lack of the EMU10k processor suggests that it lacks this capability.


--------------------
Simulate your radar: http://www.brooker.co.za/fers/
Go to the top of the page
+Quote Post
CyberFoxx
post Aug 24 2006, 10:11
Post #27





Group: Members
Posts: 62
Joined: 15-August 02
Member No.: 3062



Well, I just did a quick test of udial, before I get around to ABXng with it. Man, playing that through hw is havoc with my SB Live!, there's a weird sweeping noise that starts after the third tone. And, I'm getting the same sound with the default device as well. Using samplerate_linear and dmix the sound is quite a bit different, more smoother I guess.

... OK, samplerate_order sounds exactly the same as hw, just the weird noise is a tiny bit louder.

And, I can tell right away that samplerate sounds better on udial than samplerate_best. samplerate_best has some added freqs on the last four tones. Same with samplerate_medium. What I find odd is that the default device is supposed to use dmix, or so that's what the ALSA docs have been saying. But clearly by the sounds of it, it's just be an alias to hw. Maybe the ALSA setup under Gentoo is different, not sure...


--------------------
"It's the panties fault! The panties made me a pervert!"
Go to the top of the page
+Quote Post
cabbagerat
post Aug 24 2006, 10:46
Post #28





Group: Members
Posts: 1018
Joined: 27-September 03
From: Cape Town
Member No.: 9042



QUOTE (CyberFoxx @ Aug 24 2006, 01:11) *
And, I can tell right away that samplerate sounds better on udial than samplerate_best. samplerate_best has some added freqs on the last four tones. Same with samplerate_medium. What I find odd is that the default device is supposed to use dmix, or so that's what the ALSA docs have been saying. But clearly by the sounds of it, it's just be an alias to hw. Maybe the ALSA setup under Gentoo is different, not sure...
default definately goes through dmix on my machine (Ubuntu 6.06), but it is possible that Gentoo is different. To me, udial sounds best on samplerate_medium - but it is a very artificial sample so i'm not too worried about optimising that one.


--------------------
Simulate your radar: http://www.brooker.co.za/fers/
Go to the top of the page
+Quote Post
iGold
post Aug 24 2006, 10:48
Post #29





Group: Members
Posts: 139
Joined: 23-December 05
Member No.: 26599



Now I also have tested different samplerate_* modes (not on my home Live! 24bit, but on work's integrated VIA 8235 with VT1616i). Sound from direct hw:0 output and dmix with samplerate_linear are the same. samplerate_order just terrible wink.gif but samplerate (SRC_SINC_FASTEST) gives best, clear sound. medium and best variants give sound worse then samplerate but more better linear.
Strange sample! It makes fast to best and best to non best! laugh.gif
Go to the top of the page
+Quote Post
Matyas
post Aug 24 2006, 11:05
Post #30





Group: Members
Posts: 158
Joined: 8-August 03
From: Bratislava
Member No.: 8242



Sorry guys for this Off-topic, but does have anyone an idea (or has tested) the same on windows? Does it have the same low-quality mixer or converter? If yes, what are the possibilities to make it better?

If this is dependent on the hardware you use, I am mostly interested in the HDA built-in audio chips in notebooks (for example SoundMAX AD1986A)
Go to the top of the page
+Quote Post
CyberFoxx
post Aug 24 2006, 11:45
Post #31





Group: Members
Posts: 62
Joined: 15-August 02
Member No.: 3062



QUOTE (cabbagerat @ Aug 24 2006, 04:46) *
default definately goes through dmix on my machine (Ubuntu 6.06), but it is possible that Gentoo is different. To me, udial sounds best on samplerate_medium - but it is a very artificial sample so i'm not too worried about optimising that one.


Well, looking at the confs in /usr/share/alsa/cards, EMU10K1.conf does not use dmix for default. Almost all the other card's conf uses dmix, but the emu10k1 doesn't. I even checked the ALSA CVS, no dmix for the emu10k1. So, because of this, ALSA just uses plughw instead for default. So I guess only certain cards have been updated to use dmix. Even the conf for my on-board sound, VIA8237, doesn't use dmix as default.

Aha! According to http://alsa.opensrc.org/index.php?page=DmixPlugin:
NOTE: For ALSA 1.0.9rc2 and higher you don't need to setup dmix. Dmix is enabled as default for soundcards which don't support hw mixing.

Thats why dmix isn't enabled for my SB Live! 5.1, it supports hardware mixing.


--------------------
"It's the panties fault! The panties made me a pervert!"
Go to the top of the page
+Quote Post
iGold
post Aug 24 2006, 11:49
Post #32





Group: Members
Posts: 139
Joined: 23-December 05
Member No.: 26599



As I know at least Live! 24bit on windows has the same problem with resampling and recommended way for sound/music playback is using software resample plugins for the player, but this solution is not system wide and will not work for every other applications.
So now ALSA with rate plugin gives better way to solve resampling issue then player based solutions for windows. It's nice.
Go to the top of the page
+Quote Post
cabbagerat
post Aug 24 2006, 12:02
Post #33





Group: Members
Posts: 1018
Joined: 27-September 03
From: Cape Town
Member No.: 9042



QUOTE (CyberFoxx @ Aug 24 2006, 02:45) *
Well, looking at the confs in /usr/share/alsa/cards, EMU10K1.conf does not use dmix for default. Almost all the other card's conf uses dmix, but the emu10k1 doesn't. I even checked the ALSA CVS, no dmix for the emu10k1. So, because of this, ALSA just uses plughw instead for default. So I guess only certain cards have been updated to use dmix. Even the conf for my on-board sound, VIA8237, doesn't use dmix as default.
According to the docs, dmix is enabled by default for cvards that don't support hardware mixing. Emu10k1 cards do - so they default to plughw.


--------------------
Simulate your radar: http://www.brooker.co.za/fers/
Go to the top of the page
+Quote Post
askoff
post Aug 24 2006, 21:23
Post #34





Group: Members
Posts: 445
Joined: 23-December 02
Member No.: 4214



QUOTE (Matyas @ Aug 24 2006, 13:05) *
Sorry guys for this Off-topic, but does have anyone an idea (or has tested) the same on windows? Does it have the same low-quality mixer or converter? If yes, what are the possibilities to make it better?

If this is dependent on the hardware you use, I am mostly interested in the HDA built-in audio chips in notebooks (for example SoundMAX AD1986A)

The resampling problem is very usual with low cost soundcards also in Windows. My solution in Windows has been foobar2000 with resampler. There are few quite good resamplers for foobar2000 and the default PPHS resampler is quite good. You can test your audio hardware resampling with it. Use the problem sample mentioned earlier in this thread and test the resampler 48 kHz on and off. Check which setting sounds best with your hardware.
Go to the top of the page
+Quote Post
iGold
post Aug 25 2006, 04:28
Post #35





Group: Members
Posts: 139
Joined: 23-December 05
Member No.: 26599



Today I had a quick try to compile alsa-lib 1.0.11 from ubuntu repository at my amd64 box but got strange errors and at the end got strange package. aplay <sample.wav> gives me errors about absence of dmix, etc. But it's no problem, I'll try later.
The good thing I got was the interesting behavior. When I play udial.wav directly to card with 'aplay -D hw:1 udial.wav' it gave me warning about "requested 44100 Hz, got 48000 Hz" and played absolutely clear but a bit higher and quicker. So it just played 44.1kHz sample at frequency 48kHz w/o any resampling at all.
As conclusion: ALSA hardware driver (from kernel) doesn't resample anything, it is work for ALSA library. And resampling works only with correct config for given soundcard.
Go to the top of the page
+Quote Post
cabbagerat
post Aug 25 2006, 08:02
Post #36





Group: Members
Posts: 1018
Joined: 27-September 03
From: Cape Town
Member No.: 9042



QUOTE (iGold @ Aug 24 2006, 19:28) *
As conclusion: ALSA hardware driver (from kernel) doesn't resample anything, it is work for ALSA library. And resampling works only with correct config for given soundcard.
Indeed it doesn't. The hw devices are completely raw - they don't do any SRC, they don't change the bit depth and they seem to be fairly low latency. It's like kernel streaming for Linux.


--------------------
Simulate your radar: http://www.brooker.co.za/fers/
Go to the top of the page
+Quote Post
iGold
post Aug 25 2006, 15:36
Post #37





Group: Members
Posts: 139
Joined: 23-December 05
Member No.: 26599



After successful upgrade of alsa{-driver,lib,util,plugins} on my amd64 box I checked different samlerate variants on Live! 24bit and there is no difference between "samplerate", "samplerate_medium" and "samplerate_best" with udial.wav - it sounds perfect anyway.

So "samplerate" is a winner for me! smile.gif Minimal CPU usage with a good quality.

BTW: alsa 1.0.12 released recently.
Go to the top of the page
+Quote Post
Matyas
post Aug 26 2006, 02:37
Post #38





Group: Members
Posts: 158
Joined: 8-August 03
From: Bratislava
Member No.: 8242



QUOTE (askoff @ Aug 24 2006, 21:23) *
The resampling problem is very usual with low cost soundcards also in Windows. My solution in Windows has been foobar2000 with resampler. There are few quite good resamplers for foobar2000 and the default PPHS resampler is quite good. You can test your audio hardware resampling with it. Use the problem sample mentioned earlier in this thread and test the resampler 48 kHz on and off. Check which setting sounds best with your hardware.


Checked udial.ape with my KOSS Porta Pro & SoundMAX AD1986A. No EQ, no SRS, just the sound & the PPHS resampler on and off. I could not hear ABSOLUTELY any difference. If I enabled ultra mode, i could hear some pops, but not otherwise. Does that mean, that windows' mixer (or my hardware mixer - if it exists at all) does a good job?
I could not find the chenoa sample though.
Go to the top of the page
+Quote Post
iGold
post Aug 26 2006, 09:46
Post #39





Group: Members
Posts: 139
Joined: 23-December 05
Member No.: 26599



Maybe your card support 44100 Hz natively and no resampling ever needed for it?
Go to the top of the page
+Quote Post
Matyas
post Aug 26 2006, 10:25
Post #40





Group: Members
Posts: 158
Joined: 8-August 03
From: Bratislava
Member No.: 8242



This is what the data sheet says:
Front DAC PCM Rate Register [15:0] (Sample Rate):
Function:
The sampling [24bit] frequency range is from 7 kHz (0x01B58) to 48 kHz (0xBB80) in 1 Hz increments. If 0 is written to VRA, then the
sample rates are reset to 48 kHz.

+ there is a doule-rate DAC for 96kHz. This probably means that iGold was right.
Further reading revealed that it had a hardware equalizer, analogue 5.1 downmixing to 2 channels, and several analogue summars for mixing inputs.

So if its DAC can handle any sample rate, the question arises, what would happen, if I used two different audio players, one at 44.1kHz and the other at 48kHz. It this case DirectSound would have to do the resampling, correct?

Update:
It's now clear.
The Windows mixer has also several levels of quality. It is accessble under: Control Panel/Sound Devices/Speaker Settings/Advanced/Performance.
I could clearly hear the problem with the lowest quality evel, but the mid and highest was already artefact-free with udial. Which also means that my sound card does NOT support 44.kHz by default, only with resampling.

The good news is, that I could not spot any increased CPU activity with the highest resampling quality level. This was the case regardless of the hardware acceleration level.

This post has been edited by Matyas: Aug 26 2006, 22:15
Go to the top of the page
+Quote Post
iGold
post Sep 11 2006, 15:46
Post #41





Group: Members
Posts: 139
Joined: 23-December 05
Member No.: 26599



QUOTE (cabbagerat @ Aug 21 2006, 18:03) *
I am also posting a bug report against the equivalent Debian package.

New version (1.0.12-1) libasound2-plugins in Debian fixes bug #384029 - it includes rate (and others) plugin now.
Go to the top of the page
+Quote Post
KikeG
post Sep 11 2006, 16:07
Post #42


WinABX developer


Group: Developer
Posts: 1578
Joined: 1-October 01
Member No.: 137



http://www.kikeg.arrakis.es/lowpass/Chenoa_16KHz.ape

A similar one:

http://www.kikeg.arrakis.es/lowpass/Androgyny_16KHz.ape

They are Monkey's Audio, so I think you'll need Windows to decode them, sorry.

udial.wav is a more extreme case, it should expose flaws more easily. But beware of listening to it at high levels, it can fry your tweeters and even your power amp.

This post has been edited by KikeG: Sep 11 2006, 16:07
Go to the top of the page
+Quote Post
cheuschober
post Sep 13 2006, 00:06
Post #43





Group: Members
Posts: 13
Joined: 1-April 06
Member No.: 29069



QUOTE (Matyas @ Aug 24 2006, 04:05) *
Sorry guys for this Off-topic, but does have anyone an idea (or has tested) the same on windows? Does it have the same low-quality mixer or converter? If yes, what are the possibilities to make it better?

If this is dependent on the hardware you use, I am mostly interested in the HDA built-in audio chips in notebooks (for example SoundMAX AD1986A)


kmixer, which is part of windows, is generally known for doing a terrible job with audio. There are several solutions for playback which often involve either the creation of virtual asio devices or as-is the case with foobar2000 kernel streaming (which bypasses kmixer altogether).

Of course, if you're doing this with anything other than some form of digital-out to a dac you're unlikely to notice the difference because the electromagnetics inside a pc case seriously degrade the quality of any analog in/out. Similarly so if you're listening to audio on laptop speakers.

~Chad
Go to the top of the page
+Quote Post
KikeG
post Sep 13 2006, 07:52
Post #44


WinABX developer


Group: Developer
Posts: 1578
Joined: 1-October 01
Member No.: 137



kmixer doesn't do that bad at the default setting of best quality of sample rate conversion.

See kmixer resampling measurements at http://www.kikeg.arrakis.es/measurements/

Edit: as to the need of outboard DACs for noise free audio, see the analog measurements. They are performed with and unexpensive, non-balanced internal card. Balanced internal soundcards usually offer even better noise performance. One of the best soundcards I know of (if not the best), the Lynx Two, is internal.

This post has been edited by KikeG: Sep 13 2006, 08:16
Go to the top of the page
+Quote Post
cabbagerat
post Sep 13 2006, 08:46
Post #45





Group: Members
Posts: 1018
Joined: 27-September 03
From: Cape Town
Member No.: 9042



QUOTE (KikeG @ Sep 12 2006, 22:52) *
See kmixer resampling measurements at http://www.kikeg.arrakis.es/measurements/
Kmixer does pretty well, and the CPU load is fairly low, too. Does anybody know what algorithm is used?

QUOTE (KikeG @ Sep 12 2006, 22:52) *
Edit: as to the need of outboard DACs for noise free audio, see the analog measurements. They are performed with and unexpensive, non-balanced internal card. Balanced internal soundcards usually offer even better noise performance. One of the best soundcards I know of (if not the best), the Lynx Two, is internal.
Sound card designs have come a long way - they perform amazingly well in what is a fairly harsh environment with loads of noise and pretty ugly power. It constantly amazes me how well good cards (like the Lynx Two) do in such a bad environment.


--------------------
Simulate your radar: http://www.brooker.co.za/fers/
Go to the top of the page
+Quote Post
towolf
post Sep 13 2006, 14:22
Post #46





Group: Members
Posts: 61
Joined: 2-April 03
Member No.: 5795



I tried to build kasound on Ubuntu Edgy and it asks for "KDE headers". Which package contains those? Or, do you have a package? (a Dapper one might work, too)

This post has been edited by towolf: Sep 13 2006, 14:50
Go to the top of the page
+Quote Post
askoff
post Nov 10 2006, 23:35
Post #47





Group: Members
Posts: 445
Joined: 23-December 02
Member No.: 4214



does anyone know if the sample perioid issue has been resolved in ALSA 1.0.13 ? I just got the libsamplerate plugin to work with ALSA and it sounds very good.
Go to the top of the page
+Quote Post
Gigapod
post Nov 14 2006, 11:43
Post #48





Group: Members
Posts: 152
Joined: 2-November 06
From: Yvelines, France
Member No.: 37080



Hi cabbagerat,

Thanks for starting this excellent thread and your serious investigation.

Can you help me? I am using an old Linux distribution that only has ALSA 1.0.8, and i don't really want to upgrade this machine for the moment. The sound card is the onboard nvidia AC97 with an ALC850 codec, which I have connected using SPDIF to my A/V receiver. This sound card cannot output 44.1kHz to the SPDIF, so everything gets upsampled to 48kHz. And the default upsampling in ALSA 1.0.8 is the horrible linear interpolator - I can quite literally hear the artifacts (mostly aliasing) caused by the ALSA resampling. crying.gif

I am using Amarok with Xine as the audio engine, and ALSA as the driver. I am not really feeling up to the task of trying to integrate the latest ALSA drivers, libraries and utilities to my heavily patched 2.6.11 kernel and relatively old Linux distribution.

Do you have any suggestions?

This post has been edited by Gigapod: Nov 14 2006, 11:44
Go to the top of the page
+Quote Post
damaki
post Nov 14 2006, 12:04
Post #49





Group: Members
Posts: 143
Joined: 13-July 03
From: Paris, France
Member No.: 7740



I have just read the piece of news about the debian update; this is great.
I am trying to figure out how I could alter /usr/share/alsa/pcm/dmix.conf so that it would use the samplerate_best plugin. It would probably the best way to modify the debian package, because the default configurations in /usr/share/alsa/cards/ would all be affected.

This post has been edited by damaki: Nov 14 2006, 12:07


--------------------
Stupidity is root of all evil.
Go to the top of the page
+Quote Post
profoX
post Nov 14 2006, 12:47
Post #50





Group: Members
Posts: 10
Joined: 10-November 06
Member No.: 37401



This is a bit offtopic maybe, but do you guys know how JACK Audio Connection Kit handles resampling? I always use JACK for Audio work on linux. (JACK backend driver is ALSA)

Settings I use are:
Realtime, 64 Frames/Period, 48000 Sample Rate, 2 Periods/Buffer, Forced 16 bit
Latency in this configuration, without realtime kernel patches, seems to be ~2.67ms according to qjackctl?

Anyway... I'm no expert in audio in linux. I hope someone knows more smile.gif

This post has been edited by profoX: Nov 15 2006, 00:19
Go to the top of the page
+Quote Post

3 Pages V  < 1 2 3 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 16th April 2014 - 08:39