After fiddling around with various solutions for some years, I think I’ve found something now that looks promising, on Ubuntu 9.10 (64 bit). The following text describes how to install the packages. Everything is free open source software, and hence won’t cost a penny:
Install Jack Demon (package “jackd”). This is a program to serve as an audio and MIDI hub. It’s like a switchboard, of sorts. After installation, the demon needs to be configured in “/etc/default/jackd” (you can use “gksu gedit /etc/default/jackd” or “sudo nano /etc/default/jackd” from a command line to do that). It can be run using “sudo /etc/init.d/jackd start” from a command line. If you don’t set up the demon, you have to start Jack manually using the Jack Control program (in the “Applications / Multimedia” menu); Otherwise, the demon runs as soon as the system starts.
Install package “timidity” (you can do that by either using the Synaptics package manager or “sudo apt-get install timidity”). There’s also a “timidity-daemon” package. Timidity is a program to emulate a MIDI synthesizer module on the computer. Since Timidity is sound-font driven, the included sound fonts are open source, and they lack some instruments, but I didn’t find that to be a problem.
Install Virtual Keyboard from the repository using “Application / Software Center”. In the Jack Control program (available in the “Applications / Multimedia”) program, you can set connections between devices. In the “ALSA MIDI” section of that, you’ll find available MIDI ports (real and virtual). Connect Virtual Keyboard to one of Timidity’s output ports, and you’ll be able to play all the instruments Timidity provides. The user interface of Virtual Keyboard can be changed using the menu to show all elements.
Rosegarden is a MIDI and audio sequencer program using musical notation (which is often preferrable to tracker-style programs for various reasons). Install Rosegarden using Software Center. Note that this version (1.7.3) is pretty old. From the Rosegarden website (www.rosegardenmusic.com), you can download the latest source code (version 10.02). Unfortunately, compiling and installing that from source (which shouldn’t be done anyway normally) is only for advanced users. Currently, there’s no Ubuntu package available for that (it’s pretty new). For the curious: You start by changing into the source directory and enter “./configure”, then “make” (after you’ve manually installed all the dependent packages) and finally “sudo make install” (by default, it’s installed into “/usr”). You can manually remove it only by entering “sudo make uninstall”. I’ve had the thought of making an Ubuntu package for it myself, but I’ve not begun working thru the Debian Maintainers Manual yet. If you search through the Ubuntu forums, you can find a thread about “Rosegarden 10.2″ (sic). There is apparently a package for the 32 Bit version of Ubuntu 9.10 made by one of the users. (BTW, if you’re using ArchLinux or Gentoo Linux, you can get a Rosegarden 10.02 package from the website.) UPDATE: In fact, I managed creating a binary package today using the “alien” package converter tool. See this new blog entry.
Anyway, after you have some version of Rosegarden installed (don’t attempt to minimize the window in Version 1.7.3. there’s apparently a bug preventing it from coming back up in the build that I used), you can use the Jack Control panel to check and set up connections between Rosegarden, Virtual Keyboard and other things you might want to connect to your PC (like external MIDI synths, keyboards, etc.). Version 10.02 apparently fixes a lot of bugs found in the older versions still in Ubuntu’s or Debian’s repositories, so it might be worth going the extra mile for that.
In Ubuntu’s repository, there are plenty of tools for Jack that you can install using either Synaptics or Software Center.
I hope this can help people like me who want to make music with their computer for the least amount of money possible.
UPDATE: If you read the comments that I wrote, you’ll see which other changes might be necessary to make it all work.
Here’s a screenshot of the finished environment:
Sie müssen als angemeldet sein, um einen Kommentar schreiben zu können.
2010-03-06 bei 14:49
I discovered a nasty bug in either the jackd init script or jackd: When you run jackd at boot time, it apparently crashes without removing its pid file. Anyway, you have to start the daemon manually after every reboot using “sudo /etc/init.d/jackd start” to get things running. Also, DON’T click on the “Start” button in Jack Control, b/c Jack Control apparently doesn’t know about the possibility of running jackd as a daemon. In the Jack Control configuration, uncheck the starting of scripts and uncheck the realtime option. Avoid clicking on the Start button. If jackd runs as a daemon, it’s not necessary to click on it.
2010-03-06 bei 15:04
Furthermore, if you don’t run jackd as daemon, and run it user mode using the Jack Control Start button, then MIDI apparently doesn’t work (at least the connection between Virtual Keyboard and the timidity daemon produces no audible output; this also happens when timidity doesn’t run as a daemon). Conversely, if you do run jackd as a daemon, then the audio connectors for wave audio won’t appear in Jack Control, however, MIDI does work in that case. Since I’m only interested in MIDI at the moment, that’s no problem for me. I think it has to do with the fact that Ubuntu configures GNOME to use PulseAudio exclusively (despite there seems to be no obvious correlation between PulseAudio and these problems).
2010-03-06 bei 15:08
In any case, these problems may lead to a complication in audio production workflow: You may have to record the MIDI tracks separately, capture the audio using an audio recording program, and then use tools like Audacity to post-process the wave audio (or import them into a new project using only wave audio).
2010-03-06 bei 15:58
lol, I just figured out that jackd isn’t actually running at all when using the “sudo /etc/init.d/jackd start” command. It prints OK but the daemon is not running. (”Stopping” the daemon also prints OK.) However, a PID file is written that makes applications like Rosegarden think that jackd is running. In fact, only ALSA MIDI is being used. Sometime I need to figure out how to set this up properly, lol! At least MIDI is working like that.
2010-03-06 bei 17:33
OK, so after much more fiddling with that … stuff … , I found out that timidity and jackd were in competition about the ALSA outputs. I uninstalled the “timidity-daemon” package, which simply removes the init.d script, and ran “timidity -Oj -iA” from the command line when jackd was running on ALSA. Important configuration options for jackd in Jack Control are setting the frame size down to 256 from 1024 and setting the realtime priority up from default to 10. To run jackd in realtime mode, it is necessary to configure the PAM security manager in Ubuntu. This can be done by editing “/etc/security/limits” as described in the jackd FAQ (at http://jackaudio.org ).
Still, my impression is that using Jack is degrading performance to a degree since there’s now some perceivable latency that wasn’t there before when only ALSA MIDI was being used without Jack.
Anyhoo … at least now both wave audio and MIDI can be used at the same time.
2010-03-06 bei 18:22
Now I discovered that timidity is using ridiculously large buffers by default, which was the audible delay that I perceived. When running timidity with “timidity -B10,7 -Oj -iA” then there’s absolutely no perceivable delay.
When Rosegarden runs, there’s some choppiness in the output, however … I yet have to figure that one out.
2010-03-06 bei 18:25
OK, “timidity -B10,8 -Oj -iA” gives OK timing for my machine when Rosegarden is running.
Ahhh … looks like I’m finally getting somewhere!