Skip to contentSkip to conversation

Alsa plugin unable to be loaded by Pulseaudio

DISCUSSION Ng Oon-Ee 3 participants 10 messages Sep 7, 2009 – Sep 10, 2009

lore
Share & tools
lore

Ng Oon-Ee

author
#0 lore raw

Hello, please find below an issue I had with loading plugins into pulseaudio. The pulse dev has sent this mail on his list concerning alsa's interaction with pulse, indicating that there is something buggy with how it works. Details below. I'd be willing to post something to the bugtracker, if I only knew what the below means...

-------- Forwarded Message --------
From: Lennart Poettering <[email protected]>
Reply-to: General PulseAudio Discussion <[email protected]>
To: [email protected]
Subject: Re: [pulseaudio-discuss] Alsa output devices, able to use alsa plugin?
Date: Fri, 4 Sep 2009 01:20:15 +0200

Quoted 23 lines · Tanu Kaskinen

D: alsa-util.c: Trying test with SND_PCM_NO_AUTO_FORMAT ...
D: alsa-util.c: Managed to open test
D: alsa-util.c: Maximum hw buffer size is 371 ms
I: alsa-util.c: snd_pcm_hw_params_set_periods_near() failed: Tiedostoa tai hakemistoa ei ole
I: alsa-util.c: snd_pcm_hw_params_set_buffer_size_near() failed: Tiedostoa tai hakemistoa ei ole
D: alsa-util.c: Trying test without SND_PCM_NO_AUTO_FORMAT ...
D: alsa-util.c: Managed to open test
D: alsa-util.c: Maximum hw buffer size is 371 ms
I: alsa-util.c: snd_pcm_hw_params_set_periods_near() failed: Tiedostoa tai hakemistoa ei ole
I: alsa-util.c: snd_pcm_hw_params_set_buffer_size_near() failed: Tiedostoa tai hakemistoa ei ole
D: alsa-util.c: Trying plug:test with SND_PCM_NO_AUTO_FORMAT ...
D: alsa-util.c: Managed to open plug:test
D: alsa-util.c: Maximum hw buffer size is 371 ms
I: alsa-util.c: snd_pcm_hw_params_set_periods_near() failed: Tiedostoa tai hakemistoa ei ole
I: alsa-util.c: snd_pcm_hw_params_set_buffer_size_near() failed: Tiedostoa tai hakemistoa ei ole
D: alsa-util.c: Trying plug:test without SND_PCM_NO_AUTO_FORMAT ...
D: alsa-util.c: Managed to open plug:test
D: alsa-util.c: Maximum hw buffer size is 371 ms
I: alsa-util.c: snd_pcm_hw_params_set_periods_near() failed: Tiedostoa tai hakemistoa ei ole
I: alsa-util.c: snd_pcm_hw_params_set_buffer_size_near() failed: Tiedostoa tai hakemistoa ei ole
I: alsa-util.c: Failed to set hardware parameters on plug:test: Tiedostoa tai hakemistoa ei ole
E: module.c: Failed to load module "module-alsa-sink" (argument: "device=test"): initialization failed.

Quoted 8 lines

That "Tiedostoa tai hakemistoa ei ole" error means "No such file or directory". I tried also with device=hw:0,0 and device=plughw:0,0 and the first worked while the latter gave the same errors. Since the failed function calls pertain to buffering, I also tried with tsched=0. It worked. So, maybe this is a bug in the "plug" alsa plugin, ie. it doesn't implement the *_near() functions properly.

Lennart, any insights?

I am pretty sure that ALSA is broken here. We nowadays first try to set the number of periods, and then set the buffer size in the hwparams struct. If this fails we print a warning message (the ones you see above with all the vowels regarding snd_pcm_hw_params_set_periods_near()
resp. snd_pcm_hw_params_set_buffer_size_near()), but we do not consider this fatal.

After doing this we call snd_pcm_hw_params() to activate our settings -- and if this fails then we consider this a fatal problem.

Now the brokeness in ALSA is that after refusing our parameters it still fails to configure our settings, i.e. calling the two functions that fail breaks the hwparams setup: if we wouldn't call them, no breakage happens at all.

The two functions in question should either succeed or fail, but if they fail they should not modify hwparams in a way that it subsequently becomes unusable for snd_pcm_hw_params().

This issue needs to be fixed in ALSA.

Lennart

#1 lore raw

use those functions snd_pcm_hw_params_test_xxxxxx()

2009/9/8 Ng Oon-Ee <[email protected]>

Quoted 89 lines

Hello, please find below an issue I had with loading plugins into pulseaudio. The pulse dev has sent this mail on his list concerning alsa's interaction with pulse, indicating that there is something buggy with how it works. Details below. I'd be willing to post something to the bugtracker, if I only knew what the below means...

-------- Forwarded Message --------
From: Lennart Poettering <[email protected]>
Reply-to: General PulseAudio Discussion <[email protected]>
To: [email protected]
Subject: Re: [pulseaudio-discuss] Alsa output devices, able to use alsa plugin?
Date: Fri, 4 Sep 2009 01:20:15 +0200

Quoted 4 lines · Tanu Kaskinen

D: alsa-util.c: Trying test with SND_PCM_NO_AUTO_FORMAT ...
D: alsa-util.c: Managed to open test
D: alsa-util.c: Maximum hw buffer size is 371 ms
I: alsa-util.c: snd_pcm_hw_params_set_periods_near() failed: Tiedostoa

tai hakemistoa ei ole

Quoted 1 line

I: alsa-util.c: snd_pcm_hw_params_set_buffer_size_near() failed:

Tiedostoa tai hakemistoa ei ole

Quoted 4 lines

D: alsa-util.c: Trying test without SND_PCM_NO_AUTO_FORMAT ...
D: alsa-util.c: Managed to open test
D: alsa-util.c: Maximum hw buffer size is 371 ms
I: alsa-util.c: snd_pcm_hw_params_set_periods_near() failed: Tiedostoa

tai hakemistoa ei ole

Quoted 1 line

I: alsa-util.c: snd_pcm_hw_params_set_buffer_size_near() failed:

Tiedostoa tai hakemistoa ei ole

Quoted 4 lines

D: alsa-util.c: Trying plug:test with SND_PCM_NO_AUTO_FORMAT ...
D: alsa-util.c: Managed to open plug:test
D: alsa-util.c: Maximum hw buffer size is 371 ms
I: alsa-util.c: snd_pcm_hw_params_set_periods_near() failed: Tiedostoa

tai hakemistoa ei ole

Quoted 1 line

I: alsa-util.c: snd_pcm_hw_params_set_buffer_size_near() failed:

Tiedostoa tai hakemistoa ei ole

Quoted 4 lines

D: alsa-util.c: Trying plug:test without SND_PCM_NO_AUTO_FORMAT ...
D: alsa-util.c: Managed to open plug:test
D: alsa-util.c: Maximum hw buffer size is 371 ms
I: alsa-util.c: snd_pcm_hw_params_set_periods_near() failed: Tiedostoa

tai hakemistoa ei ole

Quoted 1 line

I: alsa-util.c: snd_pcm_hw_params_set_buffer_size_near() failed:

Tiedostoa tai hakemistoa ei ole

Quoted 1 line

I: alsa-util.c: Failed to set hardware parameters on plug:test: Tiedostoa

tai hakemistoa ei ole

Quoted 1 line

E: module.c: Failed to load module "module-alsa-sink" (argument:

"device=test"): initialization failed.

Quoted 9 lines

That "Tiedostoa tai hakemistoa ei ole" error means "No such file or directory". I tried also with device=hw:0,0 and device=plughw:0,0 and the first worked while the latter gave the same errors. Since the failed function calls pertain to buffering, I also tried with tsched=0. It worked. So, maybe this is a bug in the "plug" alsa plugin, ie. it doesn't implement the *_near() functions properly.

Lennart, any insights?

I am pretty sure that ALSA is broken here. We nowadays first try to set the number of periods, and then set the buffer size in the hwparams struct. If this fails we print a warning message (the ones you see above with all the vowels regarding snd_pcm_hw_params_set_periods_near()
resp. snd_pcm_hw_params_set_buffer_size_near()), but we do not consider this fatal.

After doing this we call snd_pcm_hw_params() to activate our settings -- and if this fails then we consider this a fatal problem.

Now the brokeness in ALSA is that after refusing our parameters it still fails to configure our settings, i.e. calling the two functions that fail breaks the hwparams setup: if we wouldn't call them, no breakage happens at all.

The two functions in question should either succeed or fail, but if they fail they should not modify hwparams in a way that it subsequently becomes unusable for snd_pcm_hw_params().

This issue needs to be fixed in ALSA.

Lennart

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#2 lore raw
Quoted 1 line · Raymond Yau

use those functions snd_pcm_hw_params_test_xxxxxx()

Why?

That sounds like a dirty workaround if that even works.

Lennart

Signature · 3 lines
Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net
http://0pointer.net/lennart/           GnuPG 0x1A015CC4
#3 lore raw
In reply to Ng Oon-Ee

what is the "test" device ?

The slave "plug" plugin usually is "hw" device

Do the following work

aplay -v -Dtest any.wav

aplay -v -M -Dtest any.wav

Why do you need the "plug" plugin ?
do you mean that pulseaudio server cannot use the exact access , format , rate , channels and route which required by the "test" device

aplay -v -Dplug:test any.wav

aplay -v -M -Dplug:test any.wav

2009/9/8 Ng Oon-Ee <[email protected]>

Quoted 89 lines

Hello, please find below an issue I had with loading plugins into pulseaudio. The pulse dev has sent this mail on his list concerning alsa's interaction with pulse, indicating that there is something buggy with how it works. Details below. I'd be willing to post something to the bugtracker, if I only knew what the below means...

-------- Forwarded Message --------
From: Lennart Poettering <[email protected]>
Reply-to: General PulseAudio Discussion <[email protected]>
To: [email protected]
Subject: Re: [pulseaudio-discuss] Alsa output devices, able to use alsa plugin?
Date: Fri, 4 Sep 2009 01:20:15 +0200

Quoted 4 lines · Tanu Kaskinen

D: alsa-util.c: Trying test with SND_PCM_NO_AUTO_FORMAT ...
D: alsa-util.c: Managed to open test
D: alsa-util.c: Maximum hw buffer size is 371 ms
I: alsa-util.c: snd_pcm_hw_params_set_periods_near() failed: Tiedostoa

tai hakemistoa ei ole

Quoted 1 line

I: alsa-util.c: snd_pcm_hw_params_set_buffer_size_near() failed:

Tiedostoa tai hakemistoa ei ole

Quoted 4 lines

D: alsa-util.c: Trying test without SND_PCM_NO_AUTO_FORMAT ...
D: alsa-util.c: Managed to open test
D: alsa-util.c: Maximum hw buffer size is 371 ms
I: alsa-util.c: snd_pcm_hw_params_set_periods_near() failed: Tiedostoa

tai hakemistoa ei ole

Quoted 1 line

I: alsa-util.c: snd_pcm_hw_params_set_buffer_size_near() failed:

Tiedostoa tai hakemistoa ei ole

Quoted 4 lines

D: alsa-util.c: Trying plug:test with SND_PCM_NO_AUTO_FORMAT ...
D: alsa-util.c: Managed to open plug:test
D: alsa-util.c: Maximum hw buffer size is 371 ms
I: alsa-util.c: snd_pcm_hw_params_set_periods_near() failed: Tiedostoa

tai hakemistoa ei ole

Quoted 1 line

I: alsa-util.c: snd_pcm_hw_params_set_buffer_size_near() failed:

Tiedostoa tai hakemistoa ei ole

Quoted 4 lines

D: alsa-util.c: Trying plug:test without SND_PCM_NO_AUTO_FORMAT ...
D: alsa-util.c: Managed to open plug:test
D: alsa-util.c: Maximum hw buffer size is 371 ms
I: alsa-util.c: snd_pcm_hw_params_set_periods_near() failed: Tiedostoa

tai hakemistoa ei ole

Quoted 1 line

I: alsa-util.c: snd_pcm_hw_params_set_buffer_size_near() failed:

Tiedostoa tai hakemistoa ei ole

Quoted 1 line

I: alsa-util.c: Failed to set hardware parameters on plug:test: Tiedostoa

tai hakemistoa ei ole

Quoted 1 line

E: module.c: Failed to load module "module-alsa-sink" (argument:

"device=test"): initialization failed.

Quoted 9 lines

That "Tiedostoa tai hakemistoa ei ole" error means "No such file or directory". I tried also with device=hw:0,0 and device=plughw:0,0 and the first worked while the latter gave the same errors. Since the failed function calls pertain to buffering, I also tried with tsched=0. It worked. So, maybe this is a bug in the "plug" alsa plugin, ie. it doesn't implement the *_near() functions properly.

Lennart, any insights?

I am pretty sure that ALSA is broken here. We nowadays first try to set the number of periods, and then set the buffer size in the hwparams struct. If this fails we print a warning message (the ones you see above with all the vowels regarding snd_pcm_hw_params_set_periods_near()
resp. snd_pcm_hw_params_set_buffer_size_near()), but we do not consider this fatal.

After doing this we call snd_pcm_hw_params() to activate our settings -- and if this fails then we consider this a fatal problem.

Now the brokeness in ALSA is that after refusing our parameters it still fails to configure our settings, i.e. calling the two functions that fail breaks the hwparams setup: if we wouldn't call them, no breakage happens at all.

The two functions in question should either succeed or fail, but if they fail they should not modify hwparams in a way that it subsequently becomes unusable for snd_pcm_hw_params().

This issue needs to be fixed in ALSA.

Lennart

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

author
#4 lore raw

Hi, if top-posting is frowned upon here I apologize, please let me know and I won't repeat it.

The "test" device is defined as follows (should have put it in initially).

pcm.test {
type plug
slave { pcm "hw:0,0" }
}

It works with aplay. My issue is that the pulseaudio server cannot load alsa plugins since 1.0.20 (as far as I can tell, ubuntuforums has a thread which suggested as such). When I queried the pulse ML, Lennart posted the below reply, which I've forwarded here to alsa-devel.

Basically, the issue as Lennart sees it is summarized by his last 3 paragraphs (bottom of this mail). He specifies the difference between the way alsa is reacting to pulse and the way it 'should'.

Quoted 114 lines · Raymond Yau

what is the "test" device ?

The slave "plug" plugin usually is "hw" device

Do the following work

aplay -v -Dtest any.wav

aplay -v -M -Dtest any.wav

Why do you need the "plug" plugin ?
do you mean that pulseaudio server cannot use the exact access , format , rate , channels and route which required by the "test" device

aplay -v -Dplug:test any.wav

aplay -v -M -Dplug:test any.wav

2009/9/8 Ng Oon-Ee <[email protected]>

Quoted 81 lines

Hello, please find below an issue I had with loading plugins into pulseaudio. The pulse dev has sent this mail on his list concerning alsa's interaction with pulse, indicating that there is something buggy with how it works. Details below. I'd be willing to post something to the bugtracker, if I only knew what the below means...

-------- Forwarded Message --------
From: Lennart Poettering <[email protected]>
Reply-to: General PulseAudio Discussion <[email protected]>
To: [email protected]
Subject: Re: [pulseaudio-discuss] Alsa output devices, able to use alsa plugin?
Date: Fri, 4 Sep 2009 01:20:15 +0200

Quoted 4 lines · Tanu Kaskinen

D: alsa-util.c: Trying test with SND_PCM_NO_AUTO_FORMAT ...
D: alsa-util.c: Managed to open test
D: alsa-util.c: Maximum hw buffer size is 371 ms
I: alsa-util.c: snd_pcm_hw_params_set_periods_near() failed: Tiedostoa

tai hakemistoa ei ole

Quoted 1 line

I: alsa-util.c: snd_pcm_hw_params_set_buffer_size_near() failed:

Tiedostoa tai hakemistoa ei ole

Quoted 4 lines

D: alsa-util.c: Trying test without SND_PCM_NO_AUTO_FORMAT ...
D: alsa-util.c: Managed to open test
D: alsa-util.c: Maximum hw buffer size is 371 ms
I: alsa-util.c: snd_pcm_hw_params_set_periods_near() failed: Tiedostoa

tai hakemistoa ei ole

Quoted 1 line

I: alsa-util.c: snd_pcm_hw_params_set_buffer_size_near() failed:

Tiedostoa tai hakemistoa ei ole

Quoted 4 lines

D: alsa-util.c: Trying plug:test with SND_PCM_NO_AUTO_FORMAT ...
D: alsa-util.c: Managed to open plug:test
D: alsa-util.c: Maximum hw buffer size is 371 ms
I: alsa-util.c: snd_pcm_hw_params_set_periods_near() failed: Tiedostoa

tai hakemistoa ei ole

Quoted 1 line

I: alsa-util.c: snd_pcm_hw_params_set_buffer_size_near() failed:

Tiedostoa tai hakemistoa ei ole

Quoted 4 lines

D: alsa-util.c: Trying plug:test without SND_PCM_NO_AUTO_FORMAT ...
D: alsa-util.c: Managed to open plug:test
D: alsa-util.c: Maximum hw buffer size is 371 ms
I: alsa-util.c: snd_pcm_hw_params_set_periods_near() failed: Tiedostoa

tai hakemistoa ei ole

Quoted 1 line

I: alsa-util.c: snd_pcm_hw_params_set_buffer_size_near() failed:

Tiedostoa tai hakemistoa ei ole

Quoted 1 line

I: alsa-util.c: Failed to set hardware parameters on plug:test: Tiedostoa

tai hakemistoa ei ole

Quoted 1 line

E: module.c: Failed to load module "module-alsa-sink" (argument:

"device=test"): initialization failed.

Quoted 9 lines

That "Tiedostoa tai hakemistoa ei ole" error means "No such file or directory". I tried also with device=hw:0,0 and device=plughw:0,0 and the first worked while the latter gave the same errors. Since the failed function calls pertain to buffering, I also tried with tsched=0. It worked. So, maybe this is a bug in the "plug" alsa plugin, ie. it doesn't implement the *_near() functions properly.

Lennart, any insights?

I am pretty sure that ALSA is broken here. We nowadays first try to set the number of periods, and then set the buffer size in the hwparams struct. If this fails we print a warning message (the ones you see above with all the vowels regarding snd_pcm_hw_params_set_periods_near()
resp. snd_pcm_hw_params_set_buffer_size_near()), but we do not consider this fatal.

After doing this we call snd_pcm_hw_params() to activate our settings -- and if this fails then we consider this a fatal problem.

Now the brokeness in ALSA is that after refusing our parameters it still fails to configure our settings, i.e. calling the two functions that fail breaks the hwparams setup: if we wouldn't call them, no breakage happens at all.

The two functions in question should either succeed or fail, but if they fail they should not modify hwparams in a way that it subsequently becomes unusable for snd_pcm_hw_params().

This issue needs to be fixed in ALSA.

Quoted 8 lines

Lennart

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#5 lore raw
Quoted 8 lines · Ng Oon-Ee

The "test" device is defined as follows (should have put it in initially).

pcm.test {
type plug
slave { pcm "hw:0,0" }
}

Quoted 8 lines

It works with aplay. My issue is that the pulseaudio server cannot load alsa plugins since 1.0.20 (as far as I can tell, ubuntuforums has a thread which suggested as such). When I queried the pulse ML, Lennart posted the below reply, which I've forwarded here to alsa-devel.

Basically, the issue as Lennart sees it is summarized by his last 3 paragraphs (bottom of this mail). He specifies the difference between the way alsa is reacting to pulse and the way it 'should'.

After the discussion we had on alsa-devel about the ordering how buffer size and period size are initialized i have now changed PA git to try harder to initialize those values. Would be good if you could check if that actually makes your problem go away.

Lennart

Signature · 3 lines
Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net
http://0pointer.net/lennart/           GnuPG 0x1A015CC4
author
#6 lore raw
Quoted 19 lines · Lennart Poettering
Quoted 8 lines · Ng Oon-Ee

The "test" device is defined as follows (should have put it in initially).

pcm.test {
type plug
slave { pcm "hw:0,0" }
}

Quoted 8 lines

It works with aplay. My issue is that the pulseaudio server cannot load alsa plugins since 1.0.20 (as far as I can tell, ubuntuforums has a thread which suggested as such). When I queried the pulse ML, Lennart posted the below reply, which I've forwarded here to alsa-devel.

Basically, the issue as Lennart sees it is summarized by his last 3 paragraphs (bottom of this mail). He specifies the difference between the way alsa is reacting to pulse and the way it 'should'.

Quoted 7 lines

After the discussion we had on alsa-devel about the ordering how buffer size and period size are initialized i have now changed PA git to try harder to initialize those values. Would be good if you could check if that actually makes your problem go away.

Lennart

Thanks Lennart. Gonna try it out now.

author
#7 lore raw
Quoted 25 lines · Ng Oon-Ee
Quoted 24 lines · Lennart Poettering
Quoted 8 lines · Ng Oon-Ee

The "test" device is defined as follows (should have put it in initially).

pcm.test {
type plug
slave { pcm "hw:0,0" }
}

Quoted 8 lines

It works with aplay. My issue is that the pulseaudio server cannot load alsa plugins since 1.0.20 (as far as I can tell, ubuntuforums has a thread which suggested as such). When I queried the pulse ML, Lennart posted the below reply, which I've forwarded here to alsa-devel.

Basically, the issue as Lennart sees it is summarized by his last 3 paragraphs (bottom of this mail). He specifies the difference between the way alsa is reacting to pulse and the way it 'should'.

After the discussion we had on alsa-devel about the ordering how buffer size and period size are initialized i have now changed PA git to try harder to initialize those values. Would be good if you could check if that actually makes your problem go away.

Quoted 5 lines
Quoted 2 lines

Lennart

Thanks Lennart. Gonna try it out now.

Ah, the git download was quicker than I expected. I've tested it out, and the 'test' case shown above does work now, thanks.

Unfortunately the main root of my question was to use the 'alsaequal' plugin from http://www.thedigitalmachine.net/alsaequal.html which still does not work. Same error as previously.

#8 lore raw

Post the output of

aplay -v -Dplug:plugequal any.wav

AFAIK , ladspa plugin use float as Input and output

2009/9/9 Ng Oon-Ee <[email protected]>

Quoted 9 lines

Ah, the git download was quicker than I expected. I've tested it out, and the 'test' case shown above does work now, thanks.

Unfortunately the main root of my question was to use the 'alsaequal' plugin from http://www.thedigitalmachine.net/alsaequal.html which still does not work. Same error as previously.

author
#9 lore raw

Hi Raymond,

Thanks for your assistance. I have mentioned previously that aplay works fine with alsaequal, my problem all along was getting it to load in Pulseaudio. Lennart took this discussion off-list, when a solution is forthcoming, or more info requirements, we'll bring it back here.

Quoted 17 lines · Raymond Yau

Post the output of

aplay -v -Dplug:plugequal any.wav

AFAIK , ladspa plugin use float as Input and output

2009/9/9 Ng Oon-Ee <[email protected]>

Quoted 8 lines

Ah, the git download was quicker than I expected. I've tested it out, and the 'test' case shown above does work now, thanks.

Unfortunately the main root of my question was to use the 'alsaequal' plugin from http://www.thedigitalmachine.net/alsaequal.html which still does not work. Same error as previously.