ALSA worries countinues
And I thought to myself, that it was too easy...
Yesterday, playing again with Jokosher, I run again in two errors on both computers I use to test gstreamer-alsa/Jokosher stuff with. First of all, I got error while try to address 'hw:0' as device from which you can record from. It was bugging me for a while and I thought that it is Ubuntu or ALSA bug.
So after consulting with j^ in private on IRC, I got that these are two seperate issues. First was on my work computer and it was more like this - any ALSA recording, using 'device=hw:0' was failure.
pecisk@ubuntu:~$ gst-launch-0.10 alsasrc device=hw:0 ! flacenc ! filesink location=device.flacSetting pipeline to PAUSED ...Pipeline is live and does not need PREROLL ...ERROR: from element /pipeline0/alsasrc0: Could not get/set settings from/on resource.Additional debug info:
gstalsasrc.c(349): set_hwparams (): /pipeline0/alsasrc0:Rate doesn't match (requested 44100Hz, get 0Hz)
ERROR: pipeline doesn't want to preroll.Setting pipeline to PAUSED ...
Setting pipeline to READY ...Setting pipeline to NULL ...
FREEING pipeline ...pecisk@ubuntu:~$
pecisk@ubuntu:~$ arecord -D hw:0 -f cd test.wavSo issue appeared to consist of two problems - my sound card has recording locked on 48000Hz - quite unusual for built-in sound card (could be card problem or ALSA driver bug) and alsasrc (and as far is known, alsasink too) don't probe cards for rate instead of that requesting it. If cards set rate doesn't mach with requested from alsasrc/alsasink, it fails. Solutions can be several - first, probing for rate of PCM in alsasrc/alsasink would be very good, because it would benefit for various encodings/players/recorders to convert their media before playing it. This, however, would require bug gstreamer guys _or_ start to take it upon myself. Another solution would be simply probe sound card PCM directly for rate and use it within pipeline - but it feels more like workaround, not long-living solution to problem:
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
Warning: rate is not accurate (requested = 44100Hz, got = 48000Hz)
please, try the plug plugin (-Dplug:hw:0)
gst-launch alsasrc device=hw:0 ! "audio/x-raw-int,channels=2,rate=48000,depth=16" ! audioconvert ! flacenc ! filesink location="test.flac"So this is for my first problem. Second one, however, appeared to be more difficult one. I have two sound cards on my home computer:
pecisk@blackcatstudio:~$ cat /proc/asound/pcmUsing System > Preferences > Sound, you can choose which card would be used then for playing sounds/movies/etc (I usually switch to my EWS88MT, which sounds just perfect for music/movies with gst-0.10, thanks to ALSA/Gstreamer guys). It changes order of soundcards (defining which card is default one) and creates .asoundrc and .asoundrc.asoundconf files within your home directory. This, however, screws up 'hw' definitions and it was no more possible to record anything using 'hw:0' even from arecord.
00-00: VIA 8235 : VIA 8235 : playback 4 : capture 1
00-01: VIA 8235 : VIA 8235 : playback 1 : capture 1
02-00: ICE1712 multi : ICE1712 multi : playback 1 : capture 1
02-01: ICE1712 consumer : ICE1712 consumer : playback 1 : capture 1
02-02: ICE1712 consumer (DS) : ICE1712 consumer (DS) : playback 6
So on my todo list is to:
* Fill bug about Ubuntu/GNOME screwing sound card definitions in ALSA - should be easy to fix;
* Fill bug for Gstreamer about probing rate from PCMs and using them for play/recording;
* Take a look on ALSA, Gstreamer and GNOME with various cards in computer - how such scenarios could be improved;