Skip to contentSkip to conversation

/usr/share/alsa/alsa.conf :and file extention

DISCUSSION Alexander Indenbaum 5 participants 18 messages Mar 17, 2008 – Mar 18, 2008

lore
Share & tools
lore
#0 lore raw

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

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________
Alsa-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-user

#1 lore raw
Quoted 5 lines · Alexander Indenbaum

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 ...

Quoted 6 lines

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.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

#2 lore raw
Quoted 4 lines · Rene Herman
Quoted 1 line · Alexander Indenbaum

I'm playing with embedded system without any hardware sound device. I'd

like

Quoted 9 lines
Quoted 1 line

to grab sound from ALSA application, for instance Firefox displaying

YouTube

Quoted 1 line

clip inside flash plugin and to store output PCM stream into file on

local

Quoted 2 lines

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.

Quoted 9 lines
Quoted 6 lines

pcm.default{
type
file
file
/tmp/pcm.out
}

... and make it

Quoted 8 lines
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"

Quoted 7 lines

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?

Quoted 4 lines

Rene.

Thank you for your help, Rene.

Signature · 1 line
Alexander Indenbaum
#3 lore raw
Quoted 8 lines · Alexander Indenbaum

On Mon, Mar 17, 2008 at 5:18 AM, Rene Herman <[email protected]

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

Quoted 1 line

Still it does not work ( I still use system alsa.conf though ).

That's the reason.

Quoted 2 lines

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.

#4 lore raw
In reply to Rene Herman

At Mon, 17 Mar 2008 04:18:15 +0100,

Quoted 10 lines · Rene Herman
Quoted 5 lines · Alexander Indenbaum

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.

Quoted 17 lines
Quoted 6 lines

pcm.default{
type
file
file
/tmp/pcm.out
}

... and make it

pcm.!default {
         type    file
         slave   {
                 pcm     null
         }
         file    "/tmp/pcm.out"
}
Quoted 2 lines

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.

Quoted 4 lines

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

#5 lore raw
Quoted 7 lines · Takashi Iwai

At Mon, 17 Mar 2008 04:18:15 +0100,

Quoted 1 line · Rene Herman

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...

Quoted 7 lines
Quoted 2 lines

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.

Quoted 9 lines
Quoted 4 lines

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.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

#6 lore raw

At Mon, 17 Mar 2008 13:34:11 +0100,

Quoted 11 lines · Rene Herman
Quoted 7 lines · Takashi Iwai

At Mon, 17 Mar 2008 04:18:15 +0100,

Quoted 1 line · Rene Herman

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...

Quoted 11 lines
Quoted 9 lines
Quoted 4 lines

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

#7 lore raw
Quoted 11 lines · Takashi Iwai
Quoted 4 lines
Quoted 4 lines

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.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

#8 lore raw
In reply to Takashi Iwai
Quoted 9 lines
Quoted 8 lines
pcm.!default {
         type    file
         slave   {
                 pcm     null
         }
         file    "/tmp/pcm.out"
}

OK - this goes to /etc/alsa.conf

Quoted 10 lines
Quoted 3 lines

Exactly why you need that slave definition I'm not sure either, but it

seems

Quoted 1 line

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

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________
Alsa-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-user

#9 lore raw
Quoted 5 lines · Alexander Indenbaum

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"

Quoted 8 lines

"(_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

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

#10 lore raw
Quoted 3 lines · Lee Revell

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?

Quoted 2 lines

Lee

Signature · 1 line
Alexander Indenbaum

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________
Alsa-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-user

#11 lore raw
In reply to Alexander Indenbaum
Quoted 14 lines · Alexander Indenbaum

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"

Quoted 1 line

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.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

#12 lore raw
Quoted 13 lines · Rene Herman

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"
}
Quoted 3 lines

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?

Quoted 3 lines

Rene.

Alexander Indenbaum

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________
Alsa-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-user

#13 lore raw
Quoted 17 lines · Alexander Indenbaum
Quoted 14 lines · Rene Herman

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"
}
Quoted 5 lines
Quoted 4 lines

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?

Signature · 1 line
Alexander Indenbaum

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________
Alsa-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-user

#14 lore raw
Quoted 3 lines · Alexander Indenbaum

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.

#15 lore raw
Quoted 7 lines · On Tue, 18 Mar 2008 13:44:59 +0100 Rene Herman <[email protected]> wrote:
Quoted 3 lines · Alexander Indenbaum

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.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

#16 lore raw
Quoted 11 lines · Sergei Steshenko
Quoted 6 lines · On Tue, 18 Mar 2008 13:44:59 +0100 Rene Herman <[email protected]> wrote:
Quoted 3 lines · Alexander Indenbaum

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.

#17 lore raw
In reply to Alexander Indenbaum

At Tue, 18 Mar 2008 06:28:28 +0200,

Quoted 24 lines · Alexander Indenbaum

On Tue, Mar 18, 2008 at 4:06 AM, Alexander Indenbaum < [email protected]> wrote:

    On Tue, Mar 18, 2008 at 3:42 AM, Rene Herman <[email protected]>
    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.
Quoted 2 lines

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).

Quoted 1 line

So what can be done?

Double-check whether you really set up all the things 100% correctly.

Takashi

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/