Skip to contentSkip to conversation

How to read the sound card ?

DISCUSSION Michaël Todorovic 3 participants 3 messages Jul 30, 2006 – Jul 31, 2006

lore
Share & tools
lore
#0 lore raw

hello,
I want to read the data on the sound card (to do a fft and other things). I have first tried the capture stream with snd_pcm_readi and everything is working. My problem is that I want to read the sound output (pcm or mixer). For example, I want to read the sound that xmms or mplayer is writing on the sound card. If I just change SND_PCM_STREAM_CAPTURE to SND_PCM_STREAM_PLAYBACK in snd_pcm_open, snd_pcm_readi fails.

So my question is : how can I read the sound output with the alsa-lib ?

Thank you

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

#1 lore raw

Hi,

I think the simpler way is to write a plugin for alsa, which will take place in the plugin chain, just before outputing the sound. The last time i did that, you couldn't do it if using softmix (which has to be directly plugged to hw) but maybe it's possible now... There is a doc written on how to write an ALSA plugin, that should help you do that ;)

Regards,

-- Ben

Quoted 13 lines · Michaël Todorovic

hello,
I want to read the data on the sound card (to do a fft and other things). I have first tried the capture stream with snd_pcm_readi and everything is working. My problem is that I want to read the sound output (pcm or mixer). For example, I want to read the sound that xmms or mplayer is writing on the sound card. If I just change SND_PCM_STREAM_CAPTURE to SND_PCM_STREAM_PLAYBACK in snd_pcm_open, snd_pcm_readi fails.

So my question is : how can I read the sound output with the alsa-lib ?

Thank you

Quoted 11 lines

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

#2 lore raw

At Mon, 31 Jul 2006 09:23:14 +0200,

Quoted 7 lines · Benoit Fouet

Hi,

I think the simpler way is to write a plugin for alsa, which will take place in the plugin chain, just before outputing the sound. The last time i did that, you couldn't do it if using softmix (which has to be directly plugged to hw) but maybe it's possible now...

The situation hasn't been changed much. But it's basically doable. For example, using a file plugin, you can achieve like "tee" command, and on one side, you can put a FIFO.

It'd be difficult, though, if you'd like to implement it as a virtual PCM capture device.

Takashi

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV