Re: Virtual sound card

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At Wed, 02 Aug 2006 23:34:30 +0400,
Krivenok Dmitry wrote:
> 
> 
> 
> -----Original Message-----
> From: Takashi Iwai <tiwai@xxxxxxx>
> To: Krivenok Dmitry <_asr_@xxxxxxxx>
> Date: Wed, 02 Aug 2006 20:26:28 +0200
> Subject: Re: Re[4]:  Virtual sound card
> 
> > 
> > At Wed, 02 Aug 2006 21:57:52 +0400,
> > Krivenok Dmitry wrote:
> > > 
> > > 
> > > 
> > > -----Original Message-----
> > > From: Takashi Iwai <tiwai@xxxxxxx>
> > > To: Krivenok Dmitry <_asr_@xxxxxxxx>
> > > Date: Wed, 02 Aug 2006 19:37:46 +0200
> > > Subject: Re: Re[2]:  Virtual sound card
> > > 
> > > > 
> > > > At Wed, 02 Aug 2006 21:31:18 +0400,
> > > > Krivenok Dmitry wrote:
> > > > > 
> > > > > 
> > > > > 
> > > > > -----Original Message-----
> > > > > From: Takashi Iwai <tiwai@xxxxxxx>
> > > > > To: Krivenok Dmitry <_asr_@xxxxxxxx>
> > > > > Date: Wed, 02 Aug 2006 18:26:52 +0200
> > > > > Subject: Re:  Virtual sound card
> > > > > 
> > > > > > 
> > > > > > At Wed, 02 Aug 2006 16:16:03 +0400,
> > > > > > Krivenok Dmitry wrote:
> > > > > > > 
> > > > > > > Hello All!
> > > > > > >  
> > > > > > > What is the simplest way to implement virtual sound card?
> > > > > > > Special kernel module, which represents virtual device driver? Special plugin? 
> > > > > > > Or something else?
> > > > > > 
> > > > > > How about JACK?
> > > > > > 
> > > > > > We have already some alsa-lib plugins, such as file plugin.
> > > > > > You can record a PCM stream to a file while using another real
> > > > > > device.
> > > > > > 
> > > > > 
> > > > > Yes, I know about file plugin. 
> > > > > It works fine with commands like this:
> > > > > aplay -D file myfile.wav
> > > > > 
> > > > > Unfortunately, I don't know how to use it with Skype (new version, which supports ALSA).
> > > > > Skype supports real cards (e.g. my VIA8233) and virtual cards (e.g. dummy), i.e.
> > > > > devices with ALSA interface.
> > > > > But "file" isn't ALSA-device.
> > > > 
> > > > So, skype checks only the devices of kernel drivers?  And no way to
> > > > edit it manually?
> > > > 
> > > > Sigh, we really have to provide a good API for the device
> > > > enumeration.
> > > > 
> > > > > How to combine file plugin with alsa-device? Is it possible at all?
> > > > 
> > > > It's hackish but possible.  You can override "hw" and/or "plughw"
> > > > definition as you like, such as
> > > > 
> > > > pcm.!hw {
> > > > 	type file
> > > > 	slave.pcm {
> > > > 		type hw
> > > > 		card 0
> > > > 	}
> > > > 	file "foo.out"
> > > > }
> > > > 
> > > 
> > > This is my asoundrc:
> > > 
> > > krivenok-home linux # cat ~/.asoundrc
> > > pcm.!hw {
> > >         type file
> > >         slave.pcm {
> > >                         type hw
> > >                         card 0
> > >         }
> > >         file "foo.out"
> > > }
> > > 
> > > Attempt to play the file:
> > > 
> > > krivenok-home linux # aplay /tmp/pcm.raw
> > > ALSA lib confmisc.c:670:(snd_func_card_driver) cannot find card '0'
> > > ALSA lib conf.c:3479:(_snd_config_evaluate) function snd_func_card_driver returned error: No such device
> > > ALSA lib confmisc.c:391:(snd_func_concat) error evaluating strings
> > > ALSA lib conf.c:3479:(_snd_config_evaluate) function snd_func_concat returned error: No such device
> > > ALSA lib confmisc.c:1070:(snd_func_refer) error evaluating name
> > > ALSA lib conf.c:3479:(_snd_config_evaluate) function snd_func_refer returned error: No such device
> > > ALSA lib conf.c:3947:(snd_config_expand) Evaluate error: No such device
> > > ALSA lib pcm.c:2146:(snd_pcm_open_noupdate) Unknown PCM default
> > > aplay: main:547: audio open error: No such device
> > > 
> > > What is wrong?
> > 
> > It should work if you pass '-D hw'.
> > When -D is omitted, aplay opens "default" PCM.  So, you have to
> > override this one, too, for example,
> > 
> > pcm.!default "hw"
> > 
> 
> Thanks! 
> Your solution works fine with aplay and mplayer.
> But it isn't work with Skype :(
> 
> In Skype's "Tool->Options->Sound devices" I choose:
> 1) Audio System to Use = ALSA
> 2) Audio device = VIA8233
> Skype works, but foo.out is not created.
> 
> I can't understand how Skype works with audio.
> krivenok-home ~ # strace skype 2>log
> krivenok-home ~ # cat log | grep snd | wc -l
> 0
> krivenok-home ~ # cat log | grep dsp | wc -l
> 0
> 
> There is no ALSA or OSS related system calls (open, etc...)!

Does it fork or use threads?  Try with strace -f option.


> This is mplayer's log:
> krivenok-home ~ # strace mplayer Uno_momento.mp3  2>log2
> krivenok-home ~ # grep  snd log2
> open("/dev/snd/controlC0", O_RDWR)      = 5
> open("/dev/snd/pcmC0D0p", O_RDWR|O_NONBLOCK) = 6
> 
> OK :)
> 
> P.S.
> Is there a way to use separate files for in/out?

You can define different PCMs for playback and capture and bind them
using asym plugin, such as:

pcm.!hw {
	type asym
	playback.pcm {
		type file
		slave.pcm {
			type hw
			card 0
		}
		file "foo.out"
	}
	capture.pcm {
		type file
		slave.pcm {
			type hw
			card 0
		}
		file "foo.in"
	}
}


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
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux