Synthesia on Linux with Wine and ALSA using FluidSynth

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

Post by aria1121 »

Synthesia on Linux with WINE and ALSA using FluidSynth with JACK optional
Hello forums,
I felt like making this as I think it may help out quite some people out there. In this tutorial I will cover how to get Synthesia running in Linux, but also how to get a built-in output (softsynth). This method does not require JACK, as some other softsynths probably do. The advatage of this method is that you can use SoundFonts and you avoid using the awful Timidity.
Note This project is not appliable on the RPi as mentioned in their FAQ (You can't run Wine on it). Even if it would be possible, the graphics should be reduced in such a way it won't be that fun anymore to utilize it. But this doesn't mean you cannot run it on Debian.

Note (For the experienced Linux users)
Spoiler:
Usually even the beta (unstable) versions of Wine work just fine with Synthesia. I recommend getting the latest version of Wine from your distro's repository (try compiling it yourself if you know what you're doing)
As for the libraries, try finding the multilib versions where possible. You'll need mpg123, ncursesw and wine-gecko.
For the softsynth, fluidsynth is the best one I found. There are multiple GUI's for it, where I found Qsynth the best. Use the FluidR3 GM SoundFont, hook up fluidsynth to ALSA or Fluidsynth (generally spoken, it's more logical to hook it up to fluidsynth if installed instead of ALSA directly).
In Synthesia, choose OpenGL rendering and replace gdiPlus.dll with Microsoft's one, use wine's "winecfg" utility to apply.
What you will need
  • Synthesia (obviously)
    Obtain the non-installer, the latest development version from the development section or the installer version of Synthesia (if you choose for the last one, make sure you install it with PlayOnLinux)
  • Wine
    This is the Windows environment Synthesia will be running in. If you haven't installed it yet, you can either obtain it with your softwaremanager-application or right from yum/apt-get.
  • FluidSynth
    You can install FluidSynth the same way you did with wine, just type "fluidsynth" instead of "wine".
  • Qsynth
    Also downloadable the terminal-way. This is also available in the Ubuntu Software Center.
  • (optional) PlayOnLinux
    Front-end for wine. Manages installed apps, this isn't so necessary (I like it without, but if you want to use install-versions of Synthesia this may come in useful).
To install all the packages described above you have to download them directly from your preferred package manager, either from a front-ended package manager or you simply open a Terminal window, and type the following:
  • With apt-get (for Ubuntu and variants)

    Code: Select all

    sudo apt-get install wine fluidsynth qsynth
    [/size]
  • With yum (Fedora, CentOS, Red Hat Enterprise, and other variants)

    Code: Select all

    sudo yum install wine fluidsynth qsynth
[/size]Add playonlinux at the end of that command if you want to install that aswell. Your Linux distro should have atleast one of these package managers installed. Else, see the documentation of your distro how to obtain packages.


Step 1 Obtain required software
Install wine, fluidsynth and Qsynth. Then download Synthesia, save it to a folder.
Note If you have the option, stick with Wine 1.4.1. I have tested the (unstable) development version 1.5.16, everything works just fine, except that all the text in the game is twice as small as it should be, and also it is in some other font than Trebuchet (Arial?). I have reported this over at the WineHQ app-database testresults. To downgrade Wine to 1.4.1, checkout the downloads section at Launchpad. (download for ubuntu)

Step 2 Configure WINE so that Synthesia is able to see your MIDI files stored on physical drive
Go to Applications > Wine > Configure Wine (or open terminal and execute winecfg)
Then go to the Drives tab and add a drive which represents the folder you have your MIDIs stored in (let's say f.e. drive S:\) and close it.

Step 3 Optional Configure PlayOnLinux
So if you want an installed version of Synthesia, go ahead and install it with PlayOnLinux. Download and install PlayOnLinux.
Open it, go to Install. Over there a new window will appear. In the bottom left, do "Install a non-listed program" (do NOT select Synthesia from the programs list, as the installer may install it in some other way. Follow the wizard, and after it is installed it will appear in the list (if you have made a shortcut to Synthesias synthesia.exe). From now on, you can open Synthesia from here.

Step 4 Set up FluidSynth through Qsynth
Open Qsynth. (or execute qsynth from terminal)
Click Setup. Give your softsynth a name (e.g. fluidsynth), Enable MIDI Input, put as "MIDI Driver" alsa_seq if it isn't already. Put "MIDI Channels" on 16. It should look like this:
Spoiler:
Qsynth_setup10.png
Qsynth_setup10.png (37.07 KiB) Viewed 131899 times
Now we want to set the output of FluidSynth directly to the sound output (alsa). If you know what you are doing and want to route the MIDI output, put option to JACK and configure it like you wish.
Spoiler:
Qsynth_setup11.png
Qsynth_setup11.png (47.87 KiB) Viewed 131899 times
Goto Soundfonts tab, select your SoundFont from there (in case you don't have any, look here).

Note If you like, you can adjust the output of the SoundFont right in the main window of Qsynth.
Spoiler:
Here you can see I have turned off these functions. To turn on these features, click on the "Active" checkbox beneath the Reverb and Chorus modules. Click here for full image.
Qsynth_setup12.png
Qsynth_setup12.png (61.26 KiB) Viewed 131899 times
Step 5
In Qsynth, press "Start" if the synthesizer hasn't started already (you can tell it is already started if it says Restart on the same button where it should say Start)
Go to where you saved Synthesia, open it in Wine (If installed in PlayOnLinux, open it from there). In Synthesia, go to the MIDI settings and you will see a weird called "Synth Input Port (29527:0)" or something similar. That's fluidsynth, you need that one.
Feel like resizing Synthesia or running it windowed? I personally run Wine windowed (Wine configurations > Graphics tab), therefore being able to drag Synthesia around but it is also possible to make Synthesia itself windowed through its own Configuration Manager.

Congratulations, you should now have properly set up Synthesia in Linux.

Note To keep your settings on exit, keep pressing [Esc] until Synthesia closes. Also, if you restart Qsynth, the engine may have a different name and will require you to set it up again as MIDI Out.

Tips
- Background
If you are using the GNOME workspace (not sure if it works on KDE or others) and are having Synthesia running in full-screen in a Wine emulating window, hover with your mousecursor over the window titlebar of the Wine window, and press the scrollwheel of your mouse to the left (if your mouse is capable of), you'll see that the window will become opaque. You can put a nice picture in the background if you are working so. You can also use Compiz, just download the packages and configure it so that you can make the Wine window opaque.
- Multiple instances of FluidSynth
In Qsynth, you can have multiple synths running at the same time. You can also have multiple synths selected in Synthesia, so you can do some crazy things with this. You can even route them to Jack and then to MuseScore, Rosegarden, etc.
- Fraps alternative
If you like to record Synthesia in Wine, you can use glc or other apps like kazam (again, to install these, simply do 'sudo apt-get install PACKAGE' or if you have yum, do 'sudo yum install PACKAGE'). If you want to get the current FPS, run Wine thru a terminal and do a 'export WINEDEBUG=+fps' which will return it. Or you can use Synthesias built-in FPS counter by pressing [F6].


Troubleshooting
- I have trouble opening Qsynth
Are you sure you have python-qt4 installed? Copy what is in between the quotes "sudo yum install python-qt4||sudo apt-get install python-qt4" open up a terminal window, and paste it in there with [Ctrl]+[Shift]+[V] then press [Enter] if neccessary to run the command if it hasn't already.
- I have no sound
Have you set the sound output in the Qsynth settings to alsa (check step 4)? Have you selected it as MIDI output in Synthesia? Check you sound hardware.
- The sound ouput is aweful
Try using a better SoundFont (here are some). You can modify the output a little with the Reverb and Chorus in the main screen of Qsynth. Just make them Active (the checkbox for that is beneath its modules) and off you go.
- FluidSynth doesn't show up in Synthesia
Are you sure fluidsynth is running? Press the Start button in Qsynth if it isn't already. Then open Synthesia, there should be an odd named MIDI port in the list of MIDI devices. That must be it.
- The text is rendered too small/in a different font than it used to be
In the development (as I am writing this) version 1.5 of Wine, the text gets a bit rendered weird. Downgrading the package to 1.4.1 should do the trick. If you are unable to downgrade, try forcing version 1.4.1 as specific pre-installed version and apply changes afterwards as an update of the packages.
For the experienced users, try and see if you can get Microsoft's own gdiPlus to work (cross-post link)
- There is too much lag
Is your hardware able to run Synthesia as if running it on Windows on the same machine? Are you sure your CPUs aren't overloaded because of other applications? Are you using an in-development version of Wine? Have you configured Synthesia and/or Qsynth and/or FluidSynth this way? Perhaps it is a bug in Synthesia?
- Synthesia is glitchy/blacked out after hibernation/sleep
There are some distros out there that make Synthesia glitch after a hibernation. IIRC Xubuntu did this in the past.


Related
Synthesia on Linux with Wine, JACK, and ALSA
Synthesia Wiki page: Linux

External links
1. MIDI in WINE at WineHQ: http://wiki.winehq.org/MIDI
2. Fluidsynth at SourceForge: http://sourceforge.net/apps/trac/fluidsynth/
3. Qsynth at SourceForge: http://qsynth.sourceforge.net/qsynth-index.html
4. PlayOnLinux: http://www.playonlinux.com/en/

Please refer to the documentation of your Linux distro if the commands and/or actions to take in this guide differ from how it should be done on your distro. I am not responsible for loss or damage of any dependent system packages. I confirm that following the steps in this guide will set up Synthesia on Linux properly using Ubuntu 12.10 x64, Synthesia r2014 ran in wine 1.4.1 and qsynth 0.3.6 with fluidsynth 1.1.5. I also confirm running the Synthesia 0.8.4 installer through playonlinux 4.1.1 works properly as well, if executed as 'not-listed program'.
Last edited by aria1121 on 02-27-14 11:42 am, edited 1 time in total.
User avatar
Laserbeak43
Posts: 102

Post by Laserbeak43 »

Nice job :)
Synthesia's one of the reasons I've not migrated over to Linux. One down, many to go.
kiwi
Synthesia Donor
Posts: 1180

Post by kiwi »

It's a really great tutorial even if i don't use linux anymore.
User avatar
mahen
Synthesia Multiple Donor!
Posts: 73

Post by mahen »

Thanks for the tutorial !

Also, if you use a MIDI keyboard that is GM compatible, you don't have to use a software synth, so that's even more straightforward (nothing to do at all I think ?). Still it would be cool to have an optional built-in synthesizer in Synthesia (EarMaster did it recently).

I'm pretty happy all the apps I need are either Linux native or work through WINE :)

Of course a native version would be awesome !!!
Running Synthesia from Linux (WINE).
Nicholas
Posts: 13170

Post by Nicholas »

mahen wrote:Still it would be cool to have an optional built-in synthesizer in Synthesia (EarMaster did it recently).
The upcoming work on the video creator tool (after Synthesia 10 goes out the door) will probably be 95% of the work to getting a built-in synth. The video creator needs offline audio synthesis, which means bringing our own library. I've heard good things about FluidSynth, so that's probably what I'll investigate first. Once the video creator knows how to talk to FluidSynth (faster than real-time), it wouldn't be a very big extension to port that knowledge over to Synthesia for real-time synthesis.
User avatar
jimhenry
Posts: 1907

Post by jimhenry »

You'll probably kick yourself once you realize how easy it is to add FluidSynth as your default synthesizer for PCs and Macs.
Jim Henry
Author of the Miditzer, a free virtual theatre pipe organ
http://www.Miditzer.org/
Nicholas
Posts: 13170

Post by Nicholas »

I actually still have a little ~10 line code snippet that you pasted into a forum post once that is almost the entire basis for "I've heard good things about FluidSynth". :lol:

That looked absurdly easy, even back then.
User avatar
mahen
Synthesia Multiple Donor!
Posts: 73

Post by mahen »

Very promising :-)

Meanwhile, as it's an how-to for experienced Linux user, a similar how-to for un-experienced ones (with no software synth though) would be :

- install WINE from your distro package manager
- download synthesia installer and double click on it

Should be OK in most cases ! Not that difficult :)
Running Synthesia from Linux (WINE).
jsgarvin
Posts: 2

Post by jsgarvin »

I tried following the provided steps, which seemed to be fairly easy to follow. However, when I'm on the screen in Synthesia for the midi "Synth input port" and I select "Notes" and then click on "Test", I see a blinking light next to the "fluidsynth" tab in Qsynth, but all I hear is what I can best describe as popcorn popping.

I've tried the /usr/share/sounds/sf2/FluidR3_GM.sf2 sound font, as well as the merlin_gmv22 sound font that I downloaded and extracted from one of the links provided above. Both have the same effect, so I think I've ruled that out.

Anybody have any guesses on what might be the issue? Thanks.

Update: Got things to work with Timidity for now. Still curious what went wrong with the Qsynth approach.
aria1121
Posts: 1505

Post by aria1121 »

jsgarvin wrote:Anybody have any guesses on what might be the issue? Thanks.
- What distro are you running?
- What are the specs of your computer? (RAM, CPU, speakers/synthesizer)
- What did you do different than this guide?

If it's not Debian/Ubuntu/Mint/#!/Elementary, or if you set up the Linux environment yourself, please check whether you are perhaps running Pulse or OSS instead of ALSA?
Spolen
Posts: 2

Post by Spolen »

jsgarvin wrote:I tried following the provided steps, which seemed to be fairly easy to follow. However, when I'm on the screen in Synthesia for the midi "Synth input port" and I select "Notes" and then click on "Test", I see a blinking light next to the "fluidsynth" tab in Qsynth, but all I hear is what I can best describe as popcorn popping.

I've tried the /usr/share/sounds/sf2/FluidR3_GM.sf2 sound font, as well as the merlin_gmv22 sound font that I downloaded and extracted from one of the links provided above. Both have the same effect, so I think I've ruled that out.

Anybody have any guesses on what might be the issue? Thanks.

Update: Got things to work with Timidity for now. Still curious what went wrong with the Qsynth approach.
I know it's an old, as well as solved, post, but I just wanted to add that I had the same issue with my setup using a Casio WK245 on Ubuntu 14.04. I realized I didnt even need a software synth, so for both the input and output i set it to use my keyboard, also I removed fluidsynth and Qsynth after setting it, it works just fine now for me. so if anyone has a similar situation just use your keyboards synth if it has one.

@aria1121 I also want to say thanks for the great post it was very helpful.
shideneyu
Posts: 4

Post by shideneyu »

Hello,

I followed the how-to exactly as you said. However the "synth input" is in the output menu of synthesia :s Do you have any idea on how should I do to put the option in the input ?
I use the last version of Synthesia, and I use Linux Mint 17.
Thanks you.

here is a screen:
Image
shideneyu
Posts: 4

Post by shideneyu »

Between, I tested those available MIDI Inputs, to no avail.
And my keyboard is fully recognized by my computer, since I can use play on my piano keyboard and make my computer play the sound out of it thanks to QSynth and aconnect.
shideneyu
Posts: 4

Post by shideneyu »

Hi,

Any news ?
aria1121
Posts: 1505

Post by aria1121 »

first post since 8 months, lol
May I note, that I don't frequent the Synthesia fora as I used to in the beginning, and therefore might get here once a month? Therefore I won't really be able to answer questions that fast, so my apologies for that.
Spolen wrote:
jsgarvin wrote:I tried following the provided steps, which seemed to be fairly easy to follow. However, when I'm on the screen in Synthesia for the midi "Synth input port" and I select "Notes" and then click on "Test", I see a blinking light next to the "fluidsynth" tab in Qsynth, but all I hear is what I can best describe as popcorn popping.
I've tried the /usr/share/sounds/sf2/FluidR3_GM.sf2 sound font, as well as the merlin_gmv22 sound font that I downloaded and extracted from one of the links provided above. Both have the same effect, so I think I've ruled that out.
Anybody have any guesses on what might be the issue? Thanks.
Update: Got things to work with Timidity for now. Still curious what went wrong with the Qsynth approach.
I know it's an old, as well as solved, post, but I just wanted to add that I had the same issue with my setup using a Casio WK245 on Ubuntu 14.04. I realized I didnt even need a software synth, so for both the input and output i set it to use my keyboard, also I removed fluidsynth and Qsynth after setting it, it works just fine now for me. so if anyone has a similar situation just use your keyboards synth if it has one.
@aria1121 I also want to say thanks for the great post it was very helpful.
Again, you might want to check your audio output configuration. Is your audio output set to a suitable bitrate? Have you selected the correct audio output (OSS/ALSA/PulseAudio)?
shideneyu wrote:Hello, I followed the how-to exactly as you said. However the "synth input" is in the output menu of synthesia :s Do you have any idea on how should I do to put the option in the input ?
I might be misconstruing the situation, but I believe you want to set up fluidsynth (informerly Qsynth) as Synthesia's input. This shouldn't be the case, as Synthesia requires note input, as so does fluidsynth. You see, the notes need to come from a certain source, whether it be a keyboard or a MIDI file, where-after it gets lead through Synthesia to an output, which should be something like a keyboard capable of rendering the sound or a soft-synth doing it instead on your computer (which is what fluidsynth is intended for). That means fluidsynth should not be set up as an input in Synthesia, but rather as an Output. Therefore, your setup is correct and not faulty.
If, for some reason, you'd still like to set up fluidsynth as an input for Synthesia (meaning you need to make it a system output), you should use different software to loop the unknown source of whatever you're attempting to read to fluidsynth. A suitable software for this case might be JACK, though I'm not that familiar with audio configurations.
shideneyu
Posts: 4

Post by shideneyu »

I see, I now understand.
After having devoted my whole afternoon, I found a solution to my issue:
Using those two commands do the trick. It created a (working) audio input and an audio output. I think that I can also use fluidsynth for the audio output.
timidity -iA -B2,8 -Os1l -s 44100
timidity -iA -B2,8 -Os -EFreverb=0

Thanks you for the answer, it surely helped :) !
User avatar
mahen
Synthesia Multiple Donor!
Posts: 73

Post by mahen »

Just wanted to say that nowadays, there's not even a single tweak required anymore to run Synthesia under Linux.
Just install it wine WINE. Built-in synth, MIDI and even jack through WINE support all work.

Of course, a native version would be cool to offer it directly and officially and to potentially offer the support for other CPU architectures. (I opened another thread on this subject). But I have no idea what amount of work it would represent for Nicholas.
Running Synthesia from Linux (WINE).
aria1121
Posts: 1505

Post by aria1121 »

That's great to hear! I would very much like to see a native Linux version as well, but I remember Nicholas once mentioned it would be too much of a hassle for a too small audience, which is unfortunate but that's the way it is.

Things have changed a lot over the almost 10 years since I started this thread. The original post is written in horrible English and I should probably update it with some more modern information, I don't even know if all those packages are still called that way. I even put that in the footnote that I used Wine 1.4.1, while Wine 5.0 was released a few hours ago! Though that doesn't matter for running it assume, it's just time which passed so quickly.

Anyhow, I'm glad to see Synthesia is still around and am thankful of Nicholas for the many years of joy Synthesia gave me.
Post Reply