Tuesday, June 29, 2010

Getting Rosegarden to Work on Ubuntu 10.04

I finally have Rosegarden running on my Lenovo T60 laptop (2gb RAM). It is sweet. I can intermix midi with audio perfectly. It was, however, a bit of a pain to get running. Hopefully this information will make it easier for others. It should be noted that I have a very low tolerance for pain when it conmes to packages on my laptop (and in linux in general). Either it works out of the box as advertised or I ditch it. It is only in the case when the desired functionality is such that I absolutely need it and the pay-off is significant enough, that I will plod through the web trying to get the necessary components workingt together. Rosegarden is so good that I have to admit, it was one of the rare times where the pay-off was well worth the effort. I am very happy with my free recording studio.

Before starting, the main pre-requesite is that your alsa drivers are working with your sound card. If you can't currently play an mp3 or record using a mic and the built in sound recorder then you should probably correct these base issues before going any further or you will be wasting a lot of your time. Also note that these instructions are for a system that has no dedicated midi hardware connected to it. If you have a working piece of midi hardware then you will probably not want to deal with fluid/qsynth.

One of the first things I had to do was disable pulseaudio which until recently I was blissfully ignorant of. This is because I only have one sound card built into my laptop and it seems pulseaudio doesn't share well. It also seems that pulseaudio was automatically installed somehow by default. The quick fix is to create a file named client.conf in the .pulse subdirectory of your home directory if it doesn't already exist (mine didn't) and to add a single line in it. I used vi to create/edit it like this ...

$ cd
$ vi .pulse/client.conf

In this file I added the following line ...

autospawn = no

To make sure your edit worked do this ...

$ cd
$ cat .pulse/client.conf

Which should produce the following output ...

autospawn = no

Then reboot your system. The changes will not take effect until you reboot your system (though some have mentioned you only need to log out then back in again for the changes to take effect).

BTW - Once I did this my desktop volume control didn't work anymore but it was necessary to get my system working. Like I said, the pay-off is such that I don't even care.

Next I used the synaptic package manager to install (a) jackd, (b) fluidsynth and (c) rosegarden (its under system ---> administration). Note that jack came with jack control (a GUI for Jack), and fluidsynth came with qsynth by default when I selected them using Synaptic.

Unfortunately, even if you have everything working by this point you will still not get any sound. This is because you will now need to prepare a soft font for your software synthesizer (fluid/qsynth). The final step is to download sfark from http://www.melodymachine.com/sfark.htm and then the annoying part is it can't just be untarred in one step you actually have to do this ...

$ gunzip sfarkxtc_lx86.tar.gz
$ tar xvf sfarkxtc_lx86.tar

Otherwise it won't work. Anyway, now that you have the sound font conversion utility you can download the Fluid R3 soundfont. It is available from the HammerSound Soundfont Library (http://www.hammersound.net/) (direct link (http://www.hammersound.net/cgi-bin/soundlink.pl?action=view_category&category=Collections&ListStart=15&ListLength=15)). Omce downloaded, use the sfark utility to decompress it (it actually took like 3 minutes on my laptop) like this ...

$ ./sfarkxtc FluidR3\ GM.sfAr

And it should produce a file with a .SF2 extension (note - i had to run it as sudo for some reason). Once you have your .SF2 file we are ready to go.

The exact sequence of steps necessary to get the Rosegarden studio up is as follows ...

(1) run Jack Control (it should be under applications ---> sound). If it is not running press 'Start' to start it,
(2) run qsynth (it should be under applications ---> other).
(3) on the qsynth panel near the lower left click 'Setup' then select the soundfonts tab. Press 'Open' and point to the .SF2 file we created.
(4) finally, start Rosegarden (applications ---> sound).

If you don't bring everything up in this exact order it usually doesn't work. Also, for some reason Rosegarden launches in a separate pane.

In Rosegarden you will want to click the Studio option, then 'manage midi devices'. Here you should see the qsynth device. It will say something like 'Synth input port (xxxx:x) write'. This is the device you must select for your tracks to play out the midi software synthesizer. If you point to a track and hold down the mouse button and select 'audio device 1' you should also be able to record audio using a standard mic. You can mix and match digital and audio tracks with ease. I have had no problem so far with 2 audio tracks and 4 digital tracks. I set Jack to 48000, 1024 with real-time 32 bit and it sounds just fine.

Note that the main reason for Jack used to be audio support but Rosegarden requires Jack these days and if it is not running Rosegarden will spawn it in some sort of default mode which I couldn't get working. I had to get Jack working properly for Rosegarden to come up. That was very important. This is why I started this entry describing how to disable pulseaudio; because I couldn't get Jack to work with pulseaudio. Good luck.






2 comments:

Mathieu said...

Hello, thanks for the info about rosegarden on ubuntu 10.04. I'm in the exact same situation as you. If I disable pulseaudio as you said, how can you control your audio or select your input source (mic vs line-in) for audio recording?

Thanks in advance!
Mathieu

Panamint Joe said...

melodymachine.com is as dead as can be, along with the proprietary Linux version of the sfArk program. According to a rant posted at http://www.linuxmusicians.com/viewtopic.php?f=24&t=9854, sfArk doesn't work anyway, unless it's run on a genuine Intel 80386 processor and Intel 80387 math coprocessor. I retired my last 80386 motherboard around 20 years ago. Jeff Glatt, the poster of the rant, also provides source code for his Linux replacement for sfArk.exe, but it's written for GTK+3.0, and if you're running an older Linux system with GTK+2.0, it won't compile. Fortunately, Canonical has Frank Wen's Fluid Release 3 SoundFont files in its Ubuntu repositories, and I was able to very simply install them in Ubuntu 10.04 (Lucid Lynx) using the Ubuntu Software Center, avoiding the mess of dealing with sfArk.

The rest of the post was helpful, though, in getting Rosegarden to produce sound on Ubuntu 10.04.