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 Nov 15 2006, 15:30
Post #51





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



QUOTE (Gigapod @ Nov 14 2006, 02:43) *
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.
Which distribution? Some are more easy than others to graft new parts onto old systems.

QUOTE (damaki @ Nov 14 2006, 03:04) *
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.
From the documentation included with the source of ALSA plugins 1.0.11:

QUOTE
You can use this rate converter plugin by defining a rate PCM with "converter" parameter, such as:

pcm.my_rate {
type rate
slave.pcm "hw"
converter "samplerate"
}

The plug plugin has also a similar field, "rate_converter".

Or, more easily, define a global variable "defaults.pcm.rate_converter",
which is used as the default converter type by plug and rate plugins:

defaults.pcm.rate_converter "samplerate"

Write the above in your ~/.asoundrc or /etc/asound.conf.

The following converter types are available:

- samplerate_best Use SRC_SINC_BEST_QUALITY
- samplerate_medium Use SRC_SINC_MEDIUM_QUALITY
- samplerate Use SRC_SINC_FASTEST
- samplerate_order Use SRC_ZERO_ORDER_HOLD
- samplerate_linear Use SRC_LINEAR
I agree that modifying the defaults might be a good idea. The problem is finding a default that both those with old hardware and those with strict quality requirements will find acceptable. I think SRC_SINC_FASTEST is about right - but there are a lot of factors to consider.


--------------------
Simulate your radar: http://www.brooker.co.za/fers/
Go to the top of the page
+Quote Post
Gigapod
post Nov 16 2006, 00:18
Post #52





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



QUOTE (cabbagerat @ Nov 15 2006, 15:30) *
Which distribution? Some are more easy than others to graft new parts onto old systems.

Hi cabbagerat,
Thanks for taking the time to help. It's a Mandriva 2005, which I have promised myself to upgrade some day to Debian Etch or Ubuntu, but right now it has to stay that way. sad.gif
What do you recommend?
Go to the top of the page
+Quote Post
cabbagerat
post Nov 16 2006, 06:57
Post #53





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



QUOTE (Gigapod @ Nov 15 2006, 15:18) *
QUOTE (cabbagerat @ Nov 15 2006, 15:30) *

Which distribution? Some are more easy than others to graft new parts onto old systems.

Hi cabbagerat,
Thanks for taking the time to help. It's a Mandriva 2005, which I have promised myself to upgrade some day to Debian Etch or Ubuntu, but right now it has to stay that way. sad.gif
What do you recommend?
Unfortunately I have no experience with Mandriva whatsoever - I haven't used an RPM distro since RedHat 5, so I don't know what to advise. The short answer is that you need to update to ALSA lib 1.0.11 or later - but this might require more complex upgrades. You might successfully build ALSA-lib and ALSA-plugins from source and "make install" them, but I'm not sure.

It would probably be easier (if this is a home PC and not a server or something) to upgrade to Ubuntu 6.10 or the latest Fedora.


--------------------
Simulate your radar: http://www.brooker.co.za/fers/
Go to the top of the page
+Quote Post
wizkid
post Apr 23 2007, 09:49
Post #54





Group: Members
Posts: 49
Joined: 6-February 03
From: Oslo
Member No.: 4880



Has anyone gotten this to work on Fedora Core 6? I have alsa version 1.0.14rc (i think, i'm not at home right now) but i do not have the samplerate files in my /usr/lib/alsa-lib. Either Fedora puts them somewhere else, or they don't include them at all. Any ideas?
Go to the top of the page
+Quote Post
wizkid
post Apr 26 2007, 18:13
Post #55





Group: Members
Posts: 49
Joined: 6-February 03
From: Oslo
Member No.: 4880



Scratch that, i got it working in Ubunty 7.04 biggrin.gif ... now if i could only find a way to kill this insane popping/crackling on trackchange...
Go to the top of the page
+Quote Post
askoff
post Apr 26 2007, 18:37
Post #56





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



QUOTE (wizkid @ Apr 26 2007, 19:13) *
Scratch that, i got it working in Ubunty 7.04 biggrin.gif ... now if i could only find a way to kill this insane popping/crackling on trackchange...

Yes. That's very anoying issue. I hope it gets resolved soon.
Go to the top of the page
+Quote Post
wizkid
post Apr 26 2007, 23:04
Post #57





Group: Members
Posts: 49
Joined: 6-February 03
From: Oslo
Member No.: 4880



QUOTE (askoff @ Apr 26 2007, 09:37) *
QUOTE (wizkid @ Apr 26 2007, 19:13) *

Scratch that, i got it working in Ubunty 7.04 biggrin.gif ... now if i could only find a way to kill this insane popping/crackling on trackchange...

Yes. That's very anoying issue. I hope it gets resolved soon.


Seems to be alsa related too, since it happends no matter what player i'm using. Tried changing buffers and some other settings but to no avail... dry.gif
Go to the top of the page
+Quote Post
seeker010
post May 7 2007, 06:56
Post #58





Group: Members
Posts: 8
Joined: 22-June 04
Member No.: 14828



QUOTE (wizkid @ Apr 23 2007, 00:49) *
Has anyone gotten this to work on Fedora Core 6? I have alsa version 1.0.14rc (i think, i'm not at home right now) but i do not have the samplerate files in my /usr/lib/alsa-lib. Either Fedora puts them somewhere else, or they don't include them at all. Any ideas?

yes. this is quite a good thread, I'm glad I found it!

for those that care
CODE
yum install libsamplerate-devel

then download alsa-plugins-1.0.14rc1a.tar.bz2
go to downloaded directory and do
CODE
tar -jxvf alsa-plugins-1.0.14rc1a.tar.bz2
cd alsa-plugins-1.0.14rc1
./configure --prefix=/usr
make
make install


This post has been edited by seeker010: May 7 2007, 06:56
Go to the top of the page
+Quote Post
samtek
post May 27 2008, 11:39
Post #59





Group: Members
Posts: 11
Joined: 2-November 07
Member No.: 48422



I'm resurrecting an old thread (again) but I wanted to add something important. Amarok by default does not seem to obey .asoundrc or resamples by itself or something..... Either way it makes the udial sample sound terrible whereas mplayer (using alsa) and aplay sound fine. I have spent hours trying to fix this and I have finally succeeded. I am using arch linux. Here are my steps:

1. Install libsamplerate and alsa-plugins
2. Put "defaults.pcm.rate_converter "samplerate_best"" in .asoundrc (without the first and last "s)
3. Go to the amarok configuration, Engine tab, select alsa as the output plugin.
4. (This is the one that took me hours to figure out) Under 'ALSA Device Configuration' in the 'Mono' and 'Stereo' boxes put "hw:0" (again without the "s). This made the udial sample sound the same as with mplayer and I'm sure my music sounds more crisp biggrin.gif
Go to the top of the page
+Quote Post
cabbagerat
post May 27 2008, 12:50
Post #60





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



QUOTE (samtek @ May 27 2008, 02:39) *
I'm resurrecting an old thread (again) but I wanted to add something important. Amarok by default does not seem to obey .asoundrc or resamples by itself or something..... Either way it makes the udial sample sound terrible whereas mplayer (using alsa) and aplay sound fine. I have spent hours trying to fix this and I have finally succeeded. I am using arch linux. Here are my steps:

1. Install libsamplerate and alsa-plugins
2. Put "defaults.pcm.rate_converter "samplerate_best"" in .asoundrc (without the first and last "s)
3. Go to the amarok configuration, Engine tab, select alsa as the output plugin.
4. (This is the one that took me hours to figure out) Under 'ALSA Device Configuration' in the 'Mono' and 'Stereo' boxes put "hw:0" (again without the "s). This made the udial sample sound the same as with mplayer and I'm sure my music sounds more crisp biggrin.gif
On most ALSA configurations, using the "hw:0" devices bypasses dmix and resampling. I don't know what ArchLinux does, but I think the reason you don't hear the problem is that your card is playing udial at the native 44100Hz. What sound card do you have?

For the record, resampling to 48000 using samplerate_medium and samplerate_best with the newest libsamplerate sound absolutely perfect on udial.


--------------------
Simulate your radar: http://www.brooker.co.za/fers/
Go to the top of the page
+Quote Post
samtek
post May 27 2008, 12:59
Post #61





Group: Members
Posts: 11
Joined: 2-November 07
Member No.: 48422



Interesting. I think you might be right about it bypassing dmix. Any ideas what I could change to get it to resample properly and go through my alsa settings? My CPU usage is lower when I use amarok than with mplayer which suggests it isn't using the samplerate_best setting I set. Why on earth do the default settings for alsa in amarok not use my .asoundrc?

I am using the onboard sound (AD1988 Chip) on my Asus P5B. I have no idea if it can play at 44100 but I would have thought that it doesn't.

edit: So...using "aplay -D plug:pcm.48khq *.wav" I get:
QUOTE
Playing WAVE 'udial.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
ALSA lib pcm_rate.c:1369:(snd_pcm_rate_open) Cannot find rate converter
Segmentation fault


I was using this .asoundrc:
QUOTE
pcm.48khq {
type plug
slave {
pcm "hw:0,0"
rate 48000
}
rate_converter "samplerate_best"
}


However if I use "defaults.pcm.rate_converter "samplerate_best"" in .asoundrc I get higher cpu usage than with no .asoundrc so the rate_converter is working. This is great (when using mplayer or aplay) but when I try to play flash videos in firefox, flash crashes with something like:
QUOTE
npviewer.bin[26668]: segfault at 0 ip f49fac14 sp ffab39d0 error 4 in libasound.so.2.0.0[f49ad000+c1000]


Forgetting my flash woes for a moment. If I set amarok alsa output to front (rather than hw:0) it also works with no distortion. Is this also bypassing dmix or something?

This post has been edited by samtek: May 27 2008, 14:03
Go to the top of the page
+Quote Post
cabbagerat
post May 27 2008, 14:49
Post #62





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



While ALSA device is your mplayer using?

It seems that by default the front device has "softvol" enabled but not dmix. Only the "default" device seems to have dmix enabled out of the box. If you use this device for everything, everything should get resampled and mixed with the default rate converter. If you set that to samplerate_whatever it should use that.

You might need to ask these questions on one of the ALSA mailing lists to get a sensible answer.

This post has been edited by cabbagerat: May 27 2008, 17:56


--------------------
Simulate your radar: http://www.brooker.co.za/fers/
Go to the top of the page
+Quote Post
samtek
post May 27 2008, 14:51
Post #63





Group: Members
Posts: 11
Joined: 2-November 07
Member No.: 48422



Thanks. I have no idea what device mplayer is using...it's just using -ao alsa. I shall post on the alsa list.

This post has been edited by samtek: May 27 2008, 14:52
Go to the top of the page
+Quote Post
gkmeyer
post Jun 8 2008, 16:30
Post #64





Group: Members
Posts: 47
Joined: 9-May 04
Member No.: 13985



I had this whole thing figured out a while back when I was trying to get my old Chaintech AV-710 working with no resampling in software. I don't have time this minute, but I'll go back into my notes and settings to see if I can help.

I'm on Arch too btw.
Go to the top of the page
+Quote Post
Samizdat
post Sep 4 2008, 16:25
Post #65





Group: Members
Posts: 15
Joined: 2-August 08
From: Reno, NV
Member No.: 56587



I'm running Ubuntu Hardy 8.04 on a 32-bit Athlon and an A7N8XE mobo. My sound software is ALSA and the sound card ID follows:
00:05.0 Multimedia audio controller: nVidia Corporation nForce Audio Processing Unit (rev a2)
00:06.0 Multimedia audio controller: nVidia Corporation nForce2 AC97 Audio Controler (MCP) (rev a1)
Subsystem: ASUSTeK Computer Inc. nForce2 AC97 Audio Controler (MCP)

Can anyone help me with the following Internet Archive show: Brahms - Tragic Overture in D Minor, Op. 81

The original FLAC file has a sample rate of 48 KHz, which file I will temporarily keep in the show till I resolve the problem: the playback speed is too fast.

As you can see, the solution I have applied is to resample the performance at 44.1 KHz.

First of all, is my diagnosis of too-fast playback correct, or is there something wrong with my hardware and/or software?

Secondly, if resampling is not the solution, what is?
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: 24th April 2014 - 10:53