Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save adrienbeau/1d0af5c53a1f952a07b41da02ed2d7c2 to your computer and use it in GitHub Desktop.
Save adrienbeau/1d0af5c53a1f952a07b41da02ed2d7c2 to your computer and use it in GitHub Desktop.
How to run Melodics on Linux using Bottles

How to run Melodics on Linux using Bottles

TL;DR: Melodics runs out-of-the-box with the current version of Bottles and its default settings. However Melodics uses your browser to handle logins, and expects your browser to be able to call the Melodics app once logged-in. Read "Melodics Desktop Integration" below to set that up.

Versions tested:

  • KDE neon (based on Ubuntu 22.04)
  • Bottles 51.10
  • Soda 8.0.2 (fork of Wine by Bottles developers, used by default)
  • Melodics 4.0.266.0

Credits:

Installing Bottles and Melodics

Use the Flatpak version of Bottles, this is heavy, but so much better than fiddling with multiple forks of Wine using a distro package manager or whatever. In a terminal, simply run:

flatpak install flathub com.usebottles.bottles

Bottles can then be run from your distro app launcher, or from the command-line:

flatpak run com.usebottles.bottles

Inside Bottles, click the “Create new Bottle…” or “+” button to create a new bottle. Type a name for the bottle, for example “Melodics”. All the settings below that are fine (application environment, soda-8.0.2 runner, 64-bit architecture), so just click the “Create” button.

On melodics.com, after creating an account, click “Download for Windows” and save the installer wherever you are comfortable.

Inside Bottles, click on the Melodics bottle if it is not already open. Click on “Run Executable…” and select the Melodics installer you have downloaded. Depending on your OS, you may need to clear the filter at the bottom of the file selector so that the installer becomes visible.

On its final screen, the Melodics installer will offer to run Melodics. You may do so to verify Melodics starts on your computer, but will be stuck once you log into your browser. See below for the missing pieces of the puzzle.

Inside your Melodics bottle, you should now see a “Melodics” program which you can simply start using the “▶” button.

Melodics Desktop Integration

Save the following in a file named “melodics.sh”. The script assumes you have named your bottle “Melodics”, correct the name after --bottle if you have used another name.

#! /bin/sh

flatpak run --command=bottles-cli com.usebottles.bottles \
    run --bottle Melodics --program Melodics --args $1

You can then install the script in a well-known location. Run this command from the directory where you have saved “melodics.sh”:

sudo install -m 755 melodics.sh /usr/local/bin/melodics

You can verify everything is OK by simply running melodics in a terminal. It should launch Melodics.

We’re getting close to completing the puzzle. Save the following in a file named “melodics.desktop”:

[Desktop Entry]
Name=Melodics
Comment=Helps you learn to play your instrument
Exec=/usr/local/bin/melodics %u
Icon=melodics
Terminal=false
Type=Application
Categories=AudioVideo;Audio
MimeType=x-scheme-handler/melodics;

You can now integrate Melodics in your desktop with the following commands, run from the directory where you saved “melodics.desktop”:

sudo xdg-icon-resource install --novendor --size 256 ~/.var/app/com.usebottles.bottles/data/bottles/bottles/Melodics/icons/Melodics.png melodics

sudo xdg-desktop-menu install --novendor melodics.desktop

sudo xdg-mime default melodics.desktop x-scheme-handler/melodics

If you have not named your bottle ”Melodics”, edit bottles/Melodics in the first command with the name of your bottle, for example bottles/MyBottle.

At this point, you should have a Melodics entry in your distro app launcher, which should quite simply start Melodics.

Your browser has also been told how to handle melodics:// URLs, which the website uses once you are logged-in. For those URLs, your browser will run the melodics script we have installed.

Now, on most distros, everything should work. Start Melodics any way you want, log-in, if required confirm to your browser that you indeed want to launch Melodics. This should redirect you back to the app, where you can finally start practicing your instrument.

If you can start Melodics fine but your browser cannot, some distros have additional security restrictions, read on…

Ubuntu, Firefox, AppArmor

As an additional layer of protection against malicious web site, Firefox on Ubuntu has an AppArmor profile that prevents execution of scripts in /usr/local/bin.

To add an exception for our melodics script, run
sudo editor /etc/apparmor.d/local/usr.bin.firefox
and add the following line at the end of the file:

  /usr/local/bin/melodics uxr,

You can then tell AppArmor to reload its profiles by running
sudo systemctl reload apparmor.service.

Everything should finally work fine.

@jgerlier
Copy link

Thanks a lot for this detailed tutorial! At first the login was failing in the Melodics app after the browser redirection with a message indicating a network error, so I tried to install the winhttp dependency in the bottle and luckily it worked 🎉.

@TheLucasSchwarz
Copy link

TheLucasSchwarz commented Feb 19, 2024

Thanks very much for this tutorial. But unfortunately, the final step is not working properly. I am using Ubuntu 23.10 and I followed every step of your tutorial, also the additional security settings. When I start Melodics and try to log in, my melodics backlink with xdg works after the login on the website. But then my laptop opens a new instance of melodics. Then it seems like it trying to validate my login. But finally I get following error:
Bildschirmfoto vom 2024-02-19 18-48-02

I have installed the latest version of melodics from the website. I don't know exactly which version this is.

Other times I get typical 'Bottles not responding'-Error Message. Unfortunately, the 'Waiting'-button does not help. In this case I have to force the shutdown of bottles/melodics.

I hope you can help me. If you need additional information, please let me know :)

@jgerlier
Copy link

Hi @TheLucasSchwarz , I had a similar issue at first, but it disappeared after I installed the winhttp dependency on the bottle. Have you tried that?

@ipleten
Copy link

ipleten commented Feb 21, 2024

I've got the same problem. I don't have firefox apparmor file though. 'winhttp' installed.
image

Is there any way to see logs or debug somehow?

@ipleten
Copy link

ipleten commented Feb 21, 2024

oh shoot.
I've enabled
image
and it started. not tested sound yet :)

@ipleten
Copy link

ipleten commented Feb 21, 2024

But it doesn't see my drums at all :( Alesis.
Never mind I forgot it doesn't work with USB3+. Change port and everything works.
Thank you all.
I love Linux community.

@KarenziDM
Copy link

Did you ever get the Guided tab loading? I see no content in there as well.

Thank you @adrienbeau for this fantastic guide! And many thanks to everyone who got you here!

@ipleten
Copy link

ipleten commented Apr 11, 2024

Did you ever get the Guided tab loading? I see no content in there as well.

Thank you @adrienbeau for this fantastic guide! And many thanks to everyone who got you here!

Guided tab doesn't work for me too.

@KingKrouch
Copy link

So I just tried this with the nixpkgs version of Bottles, by adding the program to the applications menu via the Bottles menu, and after choosing to open the URL in the Melodics shortcut, I was able to sign in without needing bash scripting chicanery.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment