I did gloss right over setting up all the low-level things since they don't really pertain to Synthesia. However, some of it is necessary to play, so we can go over some of it here. I use Gentoo and not Ubuntu, but I don't anticipate many discrepancies for this project.
For a more complete discussion of the relevant pieces you should check out the documentation and forums for each package:
JACK Audio Connection Kit : http://jackaudio.org/documentation
ALSA : http://www.alsa-project.org/main/index.php/Main_Page
LinuxSampler : http://bb.linuxsampler.org/
Wine : http://wiki.winehq.org/
A quick overview is probably in order.
ALSA is responsible for controlling your sound card. It is generally compiled as a kernel module and the source ships with all modern kernels. ALSA also hosts MIDI via a sequencer or optionally raw MIDI. Jack also provides this, but (unless someone wants to bring in a very in-depth tutorial of how to expose JACK midi into Wine) you should stick to ALSA's sequencer.
JACK is a professional audio system for low-latency and synchronous execution of a Digital Audio Workstation. It is not
required to play Synthesia, and if you don't plan on using your laptop as a DAW you'll probably be happier without it.
LinuxSampler is an audio sampler. Rather than having a synthesizer fabricate a sound when you press a key it will play a recorded sound file. It is very configurable, but in order to play Synthesia you shouldn't have to do too much set up. LinuxSampler itself is a 'server' type program where everything happens behind the scenes. What little setup is required is accomplished through a front-end (or a script, if you prefer to write code). I like the Fantasia (aka: Jsampler) GUI front-end. Qsampler should also work, but it doesn't support all the features of LinuxSampler. I've also had more troubles with it than with Fantasia.
Since we don't really need JACK to play, let's look at the setup without it.
First, start LinuxSampler from a terminal.
Code: Select all
Copyright (C) 2003,2004 by Benno Senoner and Christian Schoenebeck
Copyright (C) 2005-2009 Christian Schoenebeck
Detected features: MMX SSE SSE2
Automatic Stacktrace: Off
Registered sampler engines: 'GIG'
Registered MIDI input drivers: ALSA,JACK
Registered audio output drivers: ALSA,JACK
Loading instrument editor plugins...OK
Registered instrument editors: 'gigedit'
Starting LSCP network server (0.0.0.0:8888)...Thread: WARNING, can't mlockall() memory!
LinuxSampler initialization completed. :-)
It is now waiting for you to tell it what to do.
Now start Fantasia (I'll walk through the setup on Fantasia, hopefully it'll be easy enough to translate to qsampler if you don't like java).
On the rightmost pane you should have a tab labeled, "Devices". Under this you should see sections for "MIDI Devices" and "Audio Devices".
Let's connect audio first. Clicking the "power button" icon will display the audio port creation dialog. Select ALSA from the "Driver" dropdown menu. All the options will likely be populated for you using your default sound configuration. Click the "Create" button.
Now we should load an instrument to test our sound output. In the center pane (bracketed by the rack rails) press the "power button" to create a new channel. If you select the "Options" drop-down (on the far right of your new channel component) you'll see that the "Audio Output" has been assigned for you. It should match the channel number of the audio device we created earlier. Clicking the "Load Instrument..." button will bring up a selection dialog. Choose the bottom radio button labled, "Select Instrument from file", and browse for a .gig instrument file. After you select the file, the, "Instrument index" dialog will be populated with all the instruments located in that file. They are often variations of the same instrument or similar instruments such as with a drum kit. If you downloaded the Maestro Concert Grand from the LinuxSampler page then you'd probably pick instrument "0 - Maestro Concert Grand" from the dropdown. Click, "OK" to load the file. The title of the component should have changed from "Select instrument from file..." and should now display the name of your chosen instrument. You should also see that the keyboard at the bottom of the window has been enabled. Clicking on any of the keys with your mouse should issue a sound from your speakers. If you don't hear anything be sure to check your mixer levels with your favorite volume control application.
Until now we haven't done anything at all with MIDI. Now is the time to create our MIDI device. Back in the right pane, under the "Devices" tab click the power button icon under "MIDI Devices". For the driver we want, "ALSA", and the provided defaults should be sufficient. Click, "Create". We now need to open that device up and look at its settings; click the dropdown button to the right of our new MIDI Device. At the bottom of this dialog you should see a label, "ALSA_SEQ_BINDINGS" which most likely has a blank value field. Clicking inside the value field box will present you with a popup selection for all the available devices on your system. 0:0 and 0:1 are your system connections, if you have one additional keyboard it should show up under those (with a *:0 and *:1 for in-out respectively). These are checkboxes, and you can have multiple selected at any given time (for instance if you also ran a virtual keyboard such as vmpk). You should now hear key presses on your keyboard, as well as see the keys on LinuxSampler's soft keyboard light up when you press your real keyboard keys. You don't *need* to set this binding to play Synthesia, since we'll be binding the keyboard's input and LinuxSampler's output to the game. But you'll want these bound here if you just want to play your keyboard through the laptop without the game running.
At this point you should save all these configurations so you never have to do it again! Under the, "Actions" menu at the top of the window you'll see, "Export" and under it, "Sampler Configuration...". This will open the save dialog where you can write these settings to a file. Next time you start Fantasia you can choose, "Run Script" from the same menu and it will do everything you just did for you. Actually, you can send this script directly to LinuxSampler on the command line without the use of any front end by using netcap or socat (but you should read up on these powerful programs before deciding to install them).
Hopefully that gets you playing! Open up Synthesia and choose, "Keyboard Setup" from the main menu. You should see your keyboard in the input list and LinuxSampler in the output list. Select them, and you are good to go.