Synthesia on Linux with Wine, JACK, and ALSA

Have questions? Just saying hello? This is the place.
No explicit, hateful, or hurtful language. Nothing illegal.
Post Reply
Krish
Posts: 3

Post by Krish » 05-01-10 8:20 pm

Hello,

I thought I would post an account of what was necessary for me to get Synthesia up and running on my linux box. I'll try to address some of the various approaches found in other threads on the forum. To help ensure that all the steps were accounted for I started with a clean install of Wine. Hopefully it will help future users get up and running more quickly than I.

There was no need for me to install winetricks or to use a windows version of gdiplus.dll. The most recent version of Wine, 1.1.43 (and possibly one or two versions previous) contains fixes to the built-in GDI+ which allow the text to render without the inverted fonts users have reported in other threads.

I needed to make three registry entries:

Tell Synthesia which renderer to use. Nicholas posted this in a .zip

Code: Select all

[HKEY_CURRENT_USER\Software\Synthesia]

"Renderer"="opengl"
Without this key no text was rendering. After chasing around suggestions about missing fonts, I grabbed the development version which had useful information in the log.txt output. It indicated that this was not a font problem, but had to do with label layouts. This lead me to adjusting the direct3D rendering in wine like so:

Code: Select all

[HKEY_CURRENT_USER\Software\Wine\Direct3D]
"DirectDrawRenderer"="opengl"
As others have mentioned, the Windows Media Player volume workaround causes Synthesia to zero our Master playback volume upon exit. Nicholas once again provided a registry entry in a .zip to prevent this behavior (I had to change the value to a "1" to get results)

Code: Select all

[HKEY_CURRENT_USER\Software\Synthesia]

"Disable Auto Volume"="1"

Synthesia has no trouble seeing and using my midi ins and outs. It is routed like

Code: Select all

Keyboard --> Synthesia --> LinuxSampler (w/Fantasia) --> JACK --> ALSA
If you want to record the resultant midi just link in Rosegarden:

Code: Select all

Keyboard --> Synthesia --> Rosegarden --> LinuxSampler (w/Fantasia) --> JACK --> ALSA
tip: Grab the Maestro Concert Grand v2 sample library from linuxsampler.org/instruments for a beautiful sound.

For windowed operation, rather than full screen, append "--windowed" to your command line. Is there a registry entry which would set this to avoid the command line switch? Are there entries to control the geometry of the window (size and location)?

Code: Select all

wine Synthesia.exe --windowed

Nicholas
Posts: 11912

Post by Nicholas » 05-01-10 10:02 pm

This is very helpful... nice guide. Stickied!

techzen
Posts: 9

Post by techzen » 05-30-10 8:32 pm

could someone go through this step please?

Keyboard --> Synthesia --> LinuxSampler (w/Fantasia) --> JACK --> ALSA

i'm not sure how to set up linuxsampler, i'm using qsampler(I believe i shut off my laptop out of frustration lol) and I keep getting errors like can't creat midi device channel or something like that

I'm not sure what options to pick to get the .gig instrument file working right and I'm not sure how to configure jack either.

Basically I need a how-to on configuring all that stuff, like what is the output in synthesia specifically, etc etc etc.

Thanks to anyone who can help I'm really trying to get my ubuntu laptop working so I can make synthesia portable!

Krish
Posts: 3

Post by Krish » 05-31-10 2:14 am

Hi Techzen,

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

$ linuxsampler 
LinuxSampler 1.0.0
Copyright (C) 2003,2004 by Benno Senoner and Christian Schoenebeck
Copyright (C) 2005-2009 Christian Schoenebeck
Detected features: MMX SSE SSE2
Automatic Stacktrace: Off
Creating Sampler...OK
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!
OK
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).

Code: Select all

$ java -jar Fantasia-0.9.jar
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.

techzen
Posts: 9

Post by techzen » 05-31-10 12:18 pm

thanks a lot for your in depth reply. As usual though I'm getting errors installing stuff and can't find dependencies. I can't compile gigedit because of gtkmm2.4 although I have it installed, and installing the gigedit from package manager doesn't do anything. I can't power on the audio device, I get a lot of errors.

Krish
Posts: 3

Post by Krish » 05-31-10 2:44 pm

The good news is that someone (or most likely several someones) has had the same problems you are encountering. The bad news is that you have a bit of reading and searching to find their posts and experiment with their resolutions. Google works well when presented with specific errors (copy and paste important pieces of the error reports). You might also try the Ubuntu forums at http://ubuntuforums.org/ for distribution specific help.

Before going much farther you should probably read the Debian howto at LinuxSampler, here: http://www.linuxsampler.org/debian.html Ubuntu is based on Debian, and this guide should get you moving faster than anything else. Alex posted an addendum to it for Ubuntu users encountering a libgig conflict here: http://bb.linuxsampler.org/viewtopic.ph ... 2488cd951c

techzen
Posts: 9

Post by techzen » 05-31-10 3:31 pm

Thanks a lot I got everything working perfectly, I guess the only problem is my laptop might be too slow to get a good sound from it. It will make weird beeps ever few notes, I had hoped it would be ok since it is a dual core but I guess this too much for it.

kickininthefrontsea
Posts: 39
Location: Newcastle, Australia

Post by kickininthefrontsea » 06-08-11 4:57 am

recompiling linuxsampler from cvs and possibly recompiling the kernal are beyond me
tried wine1.3 but Synthesia didn't display text

however wine 1.2 did plus
Synthesia is working with just adding timidity, fiddled a little and did a reboot, which was a lot simpler than linuxsampler
(not being disrespectful, i'm sure the above guide would produce a sweet setup)

Post Reply