[alsa-devel] /usr/share/alsa/alsa.conf :and file extention
Hello,
I'm playing with embedded system without any hardware sound device. I'd like to grab sound from ALSA application, for instance Firefox displaying YouTube clip inside flash plugin and to store output PCM stream into file on local disk. I got an advice to use File extension. So I defined following /usr/share/alsa/alsa.conf
pcm.default{ type file file /tmp/pcm.out }
But when alsa lib still complains about "Unknown PCM plughw:0,0" "Cannot open shared library /usr/lib/alsa-lib/libasound_module_pcm_file.so"
I have a nasty feeling that syntax of my /usr/share/alsa/alsa.conf is broken beyond recognition. I wonder what is the correct way to define my situation: * No real audio devices * All sound is output goes to file as PCM stream
Do you have a clue? Alexander Indenbaum
On 17-03-08 03:57, Alexander Indenbaum wrote:
I'm playing with embedded system without any hardware sound device. I'd like to grab sound from ALSA application, for instance Firefox displaying YouTube clip inside flash plugin and to store output PCM stream into file on local disk. I got an advice to use File extension. So I defined following /usr/share/alsa/alsa.conf
Don't do it there. Use /etc/asound.conf or $HOME/.asoundrc ...
pcm.default{ type file file /tmp/pcm.out }
... and make it
pcm.!default { type file slave { pcm null } file "/tmp/pcm.out" }
Exactly why you need that slave definition I'm not sure either, but it seems you do. Also note that /tmp/pcm.out will be headerless PCM and is recreated for individual opens. I don't believe there's an append mode or anything (and you'd need to make sure that everyone plays the same format) so not toot sure if this is what you need to have a catch all audio-sink...
Rene.
On Mon, Mar 17, 2008 at 5:18 AM, Rene Herman rene.herman@keyaccess.nl wrote:
On 17-03-08 03:57, Alexander Indenbaum wrote:
I'm playing with embedded system without any hardware sound device. I'd
like
to grab sound from ALSA application, for instance Firefox displaying
YouTube
clip inside flash plugin and to store output PCM stream into file on
local
disk. I got an advice to use File extension. So I defined following /usr/share/alsa/alsa.conf
Don't do it there. Use /etc/asound.conf or $HOME/.asoundrc ...
Generally I'd agree with you that $HOME/.asoundrc is way to go if it was my desktop workstation. But this is an embedded system, so I'd like to force it on system level.
pcm.default{ type file file /tmp/pcm.out }
... and make it
pcm.!default { type file slave { pcm null } file "/tmp/pcm.out" }
Still it does not work ( I still use system alsa.conf though ). Now I get: "Unknown PCM null" "Unknown PCM plughw:0,0"
Exactly why you need that slave definition I'm not sure either, but it seems you do. Also note that /tmp/pcm.out will be headerless PCM and is recreated for individual opens. I don't believe there's an append mode or anything (and you'd need to make sure that everyone plays the same format) so not toot sure if this is what you need to have a catch all audio-sink...
You touching here an interesting point. How indeed I could get an PCM header?
Rene.
Thank you for your help, Rene.
On 17-03-08 04:35, Alexander Indenbaum wrote:
On Mon, Mar 17, 2008 at 5:18 AM, Rene Herman <rene.herman@keyaccess.nl
Don't do it there. Use /etc/asound.conf or $HOME/.asoundrc ...
Generally I'd agree with you that $HOME/.asoundrc is way to go if it was my desktop workstation. But this is an embedded system, so I'd like to force it on system level.
As I said, use /etc/asound.conf
Still it does not work ( I still use system alsa.conf though ).
That's the reason.
You touching here an interesting point. How indeed I could get an PCM header?
You don't really need one if you know the format. Ie, with aplay (and foo.wav being CD format):
aplay foo.wav aplay -D hw:0 -f cd /tmp/pcm.out
Rene.
At Mon, 17 Mar 2008 04:18:15 +0100, Rene Herman wrote:
On 17-03-08 03:57, Alexander Indenbaum wrote:
I'm playing with embedded system without any hardware sound device. I'd like to grab sound from ALSA application, for instance Firefox displaying YouTube clip inside flash plugin and to store output PCM stream into file on local disk. I got an advice to use File extension. So I defined following /usr/share/alsa/alsa.conf
Don't do it there. Use /etc/asound.conf or $HOME/.asoundrc ...
Or /etc/asound.conf. It's the additional place for the system-wide definitions.
pcm.default{ type file file /tmp/pcm.out }
... and make it
pcm.!default { type file slave { pcm null } file "/tmp/pcm.out" }
Exactly why you need that slave definition I'm not sure either, but it seems you do.
The file plugin requires the slave for its configuration and as the timing source. Using "null" is just to accept any config and feed the data as fast as possible. If you need to save the data as if it's being played, use the kernel dummy driver as the slave.
Also note that /tmp/pcm.out will be headerless PCM and is recreated for individual opens. I don't believe there's an append mode or anything (and you'd need to make sure that everyone plays the same format) so not toot sure if this is what you need to have a catch all audio-sink...
Recently I added a new option "truncate" to file plugin. As default, it's set to true (for compatibility reason), and the plugin overwrite the existing file if reopened. When it's set to false, a new file is created with a different suffix (up to 1000 files) at each time.
Takashi
On 17-03-08 09:05, Takashi Iwai wrote:
At Mon, 17 Mar 2008 04:18:15 +0100, Rene Herman wrote:
Don't do it there. Use /etc/asound.conf or $HOME/.asoundrc ...
Or /etc/asound.conf. It's the additional place for the system-wide definitions.
That's what I said. What happened? Alexander also completely missed that...
Exactly why you need that slave definition I'm not sure either, but it seems you do.
The file plugin requires the slave for its configuration and as the timing source. Using "null" is just to accept any config and feed the data as fast as possible. If you need to save the data as if it's being played, use the kernel dummy driver as the slave.
I see, thanks.
Also note that /tmp/pcm.out will be headerless PCM and is recreated for individual opens. I don't believe there's an append mode or anything (and you'd need to make sure that everyone plays the same format) so not toot sure if this is what you need to have a catch all audio-sink...
Recently I added a new option "truncate" to file plugin. As default, it's set to true (for compatibility reason), and the plugin overwrite the existing file if reopened. When it's set to false, a new file is created with a different suffix (up to 1000 files) at each time.
That sounds useful...
Rene.
At Mon, 17 Mar 2008 13:34:11 +0100, Rene Herman wrote:
On 17-03-08 09:05, Takashi Iwai wrote:
At Mon, 17 Mar 2008 04:18:15 +0100, Rene Herman wrote:
Don't do it there. Use /etc/asound.conf or $HOME/.asoundrc ...
Or /etc/asound.conf. It's the additional place for the system-wide definitions.
That's what I said.
Ah, I must have been too careless...
Also note that /tmp/pcm.out will be headerless PCM and is recreated for individual opens. I don't believe there's an append mode or anything (and you'd need to make sure that everyone plays the same format) so not toot sure if this is what you need to have a catch all audio-sink...
Recently I added a new option "truncate" to file plugin. As default, it's set to true (for compatibility reason), and the plugin overwrite the existing file if reopened. When it's set to false, a new file is created with a different suffix (up to 1000 files) at each time.
That sounds useful...
And I added another new feature to the file plugin to write WAV files instead of raw files now to HG tree. You can specify the format "wav" instead of "raw" (the default one).
It's a so dumb implmenetation and has no check for over 2GB files. But it might be more useful in many cases than raw outputs.
Takashi
On 17-03-08 16:07, Takashi Iwai wrote:
Recently I added a new option "truncate" to file plugin. As default, it's set to true (for compatibility reason), and the plugin overwrite the existing file if reopened. When it's set to false, a new file is created with a different suffix (up to 1000 files) at each time.
And I added another new feature to the file plugin to write WAV files instead of raw files now to HG tree. You can specify the format "wav" instead of "raw" (the default one).
It's a so dumb implmenetation and has no check for over 2GB files. But it might be more useful in many cases than raw outputs.
Yes. I've used the file plugin occasionally if only for some testing and appreciate this. Many thanks.
Rene.
pcm.!default { type file slave { pcm null } file "/tmp/pcm.out" }
OK - this goes to /etc/alsa.conf
Exactly why you need that slave definition I'm not sure either, but it
seems
you do.
The file plugin requires the slave for its configuration and as the timing source. Using "null" is just to accept any config and feed the data as fast as possible. If you need to save the data as if it's being played, use the kernel dummy driver as the slave.
OK, I compiled alsa-drivers with Dummy as one and only card and loaded it into the kernel: # cat /proc/asound/card0/id Dummy
Still no PCM in /tmp/pcm.out. I get following error messages though: "(snd_determine_driver) could not open control for card 0" "(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory" "(snd_func_concat) error evaluating strings" "(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory" "(snd_func_refer) error evaluating name" "(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory" "(snd_config_expand) Evaluate error: No such file or directory" "(snd_pcm_open_noupdate) Unknown PCM default" "(_snd_pcm_plug_open) Unknown field hint"
Any clues?
Alexander Indenbaum
On Mon, Mar 17, 2008 at 8:27 PM, Alexander Indenbaum alexander.indenbaum@gmail.com wrote:
Still no PCM in /tmp/pcm.out. I get following error messages though: "(snd_determine_driver) could not open control for card 0" "(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory" "(snd_func_concat) error evaluating strings" "(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory" "(snd_func_refer) error evaluating name" "(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory" "(snd_config_expand) Evaluate error: No such file or directory" "(snd_pcm_open_noupdate) Unknown PCM default" "(_snd_pcm_plug_open) Unknown field hint"
Please strace aplay and see what files it's trying to open.
Lee
On Tue, Mar 18, 2008 at 2:45 AM, Lee Revell rlrevell@joe-job.com wrote:
Please strace aplay and see what files it's trying to open.
You're absolutely right. I was missing /dev device files. So my test goes like this: - run snddevices script to create /dev - load snd drivers with Dummy compiled in - open browser on YouTube clip
Now there is no error messages. From other hand I do not see /tmp/pcm.out. I tried to "touch" this file but it stays zero length.
So what next?
Lee
On 18-03-08 01:27, Alexander Indenbaum wrote:
Still no PCM in /tmp/pcm.out. I get following error messages though: "(snd_determine_driver) could not open control for card 0" "(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory" "(snd_func_concat) error evaluating strings" "(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory" "(snd_func_refer) error evaluating name" "(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory" "(snd_config_expand) Evaluate error: No such file or directory" "(snd_pcm_open_noupdate) Unknown PCM default" "(_snd_pcm_plug_open) Unknown field hint"
Any clues?
Yes, aplay would've worked. What you are using is trying to open controls for the card though and non are defined. If you will be using the dummy driver anyway, use:
pcm.!default { type file slave { pcm "hw:0" } file "/tmp/pcm.out" }
with snd-dummy having index 0. I tested this just now with firefox and the flash plugin on youtube and it works for me.
Rene.
On Tue, Mar 18, 2008 at 3:42 AM, Rene Herman rene.herman@keyaccess.nl wrote:
Yes, aplay would've worked. What you are using is trying to open controls for the card though and non are defined. If you will be using the dummy driver anyway, use:
pcm.!default { type file slave { pcm "hw:0" } file "/tmp/pcm.out" }
with snd-dummy having index 0. I tested this just now with firefox and the flash plugin on youtube and it works for me.
I wish I could say it works for me too :) But still there is no data in /tmp/pcm.out in my setup. There is no error messages, as if everything works OK. How can I troubleshoot it more deeply?
Rene.
Alexander Indenbaum
On Tue, Mar 18, 2008 at 4:06 AM, Alexander Indenbaum < alexander.indenbaum@gmail.com> wrote:
On Tue, Mar 18, 2008 at 3:42 AM, Rene Herman rene.herman@keyaccess.nl wrote:
Yes, aplay would've worked. What you are using is trying to open controls for the card though and non are defined. If you will be using the dummy driver anyway, use:
pcm.!default { type file slave { pcm "hw:0" } file "/tmp/pcm.out" }
with snd-dummy having index 0. I tested this just now with firefox and the flash plugin on youtube and it works for me.
OK, it works on Linux 2.6 but silently fails on Linux 2.4. Unfortunately, I need it to work on Linux 2.4 :) So what can be done?
On 18-03-08 05:28, Alexander Indenbaum wrote:
OK, it works on Linux 2.6 but silently fails on Linux 2.4. Unfortunately, I need it to work on Linux 2.4 :) So what can be done?
Sorry, but I just don't care about 2.4. It's obsolete. This was a proof of concept for you -- a final solution might involve something like Jack, so you may want to look into that directly.
Rene.
On Tue, 18 Mar 2008 13:44:59 +0100 Rene Herman rene.herman@keyaccess.nl wrote:
On 18-03-08 05:28, Alexander Indenbaum wrote:
OK, it works on Linux 2.6 but silently fails on Linux 2.4. Unfortunately, I need it to work on Linux 2.4 :) So what can be done?
Sorry, but I just don't care about 2.4. It's obsolete.
It's a very nice way to say that finally Linux kernel has stable ABI.
Regards, Sergei.
On 18-03-08 14:02, Sergei Steshenko wrote:
On Tue, 18 Mar 2008 13:44:59 +0100 Rene Herman rene.herman@keyaccess.nl wrote:
On 18-03-08 05:28, Alexander Indenbaum wrote:
OK, it works on Linux 2.6 but silently fails on Linux 2.4. Unfortunately, I need it to work on Linux 2.4 :) So what can be done?
Sorry, but I just don't care about 2.4. It's obsolete.
It's a very nice way to say that finally Linux kernel has stable ABI.
Every Linux kernel has a stable ABI. If you don't care about progress, feel free to stick with it.
Rene.
At Tue, 18 Mar 2008 06:28:28 +0200, Alexander Indenbaum wrote:
On Tue, Mar 18, 2008 at 4:06 AM, Alexander Indenbaum < alexander.indenbaum@gmail.com> wrote:
On Tue, Mar 18, 2008 at 3:42 AM, Rene Herman <rene.herman@keyaccess.nl> wrote: Yes, aplay would've worked. What you are using is trying to open controls for the card though and non are defined. If you will be using the dummy driver anyway, use: pcm.!default { type file slave { pcm "hw:0" } file "/tmp/pcm.out" } with snd-dummy having index 0. I tested this just now with firefox and the flash plugin on youtube and it works for me.
OK, it works on Linux 2.6 but silently fails on Linux 2.4. Unfortunately, I need it to work on Linux 2.4 :)
It must work (assuming that you are using the same hardware but only different kernels).
So what can be done?
Double-check whether you really set up all the things 100% correctly.
Takashi
participants (5)
-
Alexander Indenbaum
-
Lee Revell
-
Rene Herman
-
Sergei Steshenko
-
Takashi Iwai