[Alsa-user] Re: Recording in/out of an oss program?
Brought to you by:
perex
From: Andrew B. <aa...@ci...> - 2005-07-12 15:31:08
|
>> I have a proprietary program that uses OSS for sound i/o. I have alsa >> installed. >> I would like to record all of its sound i/o. (It's a VoIP phone. and I want to >> record my conversations). >This is probably what you need ('vsound' package): >Name: vsound >Version: 0.6-2mdk >Size: 44 KB >Summary: Virtual loopback cable for audio >Description: VSound is sort of like a 'virtual audio loopback cable'. That is, >it allows you to record the output audio stream of a program (similar to >connecting a loopback cable to the line in and line out jacks on the sound >card, and recording the sound from the line in jack, but without the DA/AD >conversion losses). One possible use for this application is as part of a >RealAudio to WAV file converter. I do exactly this with aoss and the alsa file plugin. Its a bit of a hack but it works with mplayer. .asoundrc::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: pcm.oss_file { type plug slave { channels 2 #rate 44100 # syntax error pcm { type file file /tmp/alsa_pipe.wav slave { pcm hw:0 # pick one #pcm null # pick one } } } } # define default alsa device pcm.!default pcm.oss_file # define default oss device pcm.dsp0 { type plug slave { pcm oss_file } } ctl.mixer0 { type hw card 0 } :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Then just: rm -vf /tmp/alsa_pipe.wav aoss mplayer <avifile> :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: There are some problems: The file seems to never be erased as the alsa API says it should, it seems that alsalib just seeks back to the beginning and overwrites each time the oss_file device is opened. My app needs to see the file changing so I must always rm the file before use. The file has no wav headers so its impossible to know what the sample rate etc is, I wish there were an option to the file plugin that wrote wav headers or that the 'rate 44100' parameter worked (this is probably just my asoundrc error but I can't figure it out). Mplayer has an option to force the sample rate so I am able to work around this. For other apps I might have problems... The latency is bad, because probably no one intended this to work 'live' like I am using it. I have to use a 500msec ring buffer to prevent dropouts. Again mplayer allows me to delay video 500msec to work around this. Other apps... What I really need is a plug that take a playback stream and provides a capture stream from it. Does anyone know if this exists? From the alsalib docs, the file plugin was as close as I could come. |