My Life Is A House

My daily life with all things Libre and Open

Saturday, April 08, 2006

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:~$
However, j^ suggested to check out the same recording with arecord, which gave me more clues about what causes failure:
pecisk@ubuntu:~$ arecord -D hw:0 -f cd test.wav
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)
So 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:
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/pcm
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
Using 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.

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;

Friday, April 07, 2006

Death of the bug and other musings

Well, after little brainstorming, noise and brohaha, annoying gstreamer-alsa recording bug got fixed. Thanks to j^ and Sebastian of Ubuntu, bug fix was provided and new version rolled out yesterday. So now I can record with Jokosher and GNOME Sound Recorder on Ubuntu, using Gstreamer backend, without any problem.

Differently, nvidia binary driver got another bug fix release, which seems have to eliminate lot of lockups in my work computer. Will try Xgl later, which was unusable with such nvidia driver's behaviour, t.i. locked up after 5 mins.

Played with Jokosher - nice and easy for now, while not having any serious functionality (as it waits for it's 0.1 release). Slices and their split/join looks shiny and really gives promise of serious app. Ellio started to hack ALSA channel split (for multiple channel card owners like me :)) element for gstreamer, various bits and peaces gets added, visual bugs fixed. Ellio also works on using Gnonlin (Non-linear elements for Gstreamer, used in various video editors for now) for audio stuff.

Sunday, April 02, 2006

Modern Ubuntu times

There are moments in the life when I miss all that Linux desktop begining stuff, when you had to tweak your Linux distribution at maximum to get, for example, divx playing. For now, I just have to enable universe and metaverse and install gstreamer-ffmpeg and gstreamer-plugins-bad and gstreamer-plugins-ugly (for AC3 sound) to get it work. Few clicks and I can play my divx just fine, also Quicktime movies. However, Totem plugin for Firefox still has lot of raw edges, so there is room for improvement. But I am very happy to see that Gstreamer idea proves it's worthy.

Saying that, Ubuntu Dapper beta still has bugs to squeeze, and there comes today's story about several important ones. Bunch of funny and talented guys have created project Jokosher, which aims to provide easy to use and easy to configure multitrack recorder/sequencer, using newest technologies like Gstreamer 0.10, GTK+ 2.8, Python, and Cairo (more in Cakewalk/Cubase direction. In meantime, I would like to point out, that profesionally aclaimed Ardour as Protools replacement will get gtk+2 interface very soon too). They have big fun coding and improving their baby and I say more power to them.
While testing their work, I run into problem that newest gstreamer-0.10 in Dapper won't record anything from alsasrc, which is very pitty. Seems like recording stuff using gstreamer is all broken. However, Ubuntu guys are informed about this problem, also Gstreamer mob, so I hope for fast fix.
And yeah, these days is when Dapper flies sixth time. Grab it for testing/bug reporting pleasure there. And register on Launchpad to register bugs and comment them with your expierence if there is already one.