Giocoso on Windows 11

1.0 Introduction

I find myself in a bit of a dilemma as far as running Giocoso on Windows 11, because I lack any hardware that is capable of running it in a supported fashion... yet, I do run it on a vintage 2012 spare laptop and Giocoso runs on it perfectly well. In fact, it is much easier to get it running on Windows 11 than it is on Windows 10, thanks to improvements in Microsoft's Windows Subsystem for Linux on that platform.

It remains, however, a problem to offer support for doing something on a platform that remains, for me, technically unsupported! Therefore, I won't: if you want to run Giocoso on Windows 11, I'll give you instructions which have worked for me, but I cannot vouch for them in the long-run and I won't offer support for it. You're on your own, basically! Of course, if you are a well-off classical music enthusiast who loves using Windows and wants to donate Windows 11-supported hardware on which I can continue to develop Giocoso for Windows 11 in a properly supported manner, do please get in touch!

Those preliminaries out of the way: whilst Giocoso itself merely sips PC hardware resources, the Windows Subsystem for Linux version 2 (WSL2) that makes it possible to run Giocoso at all is a bit of a resource hog. It works, fundamentally, by co-hosting a virtual Linux PC alongside and simultaneously with the running Windows one. That sort of virtualisation immediately demands a 64-bit operating system and reasonable quantities of memory and CPU grunt -though we are not in ludicrously-overspecc'd monster gaming PC territory! I mentioned my 2012-vintage HP Folio13 onto which I've managed to crow-bar a working version of Windows 11, despite its ancient and unsupported hardware: it manages on 8GB RAM, a 500GB solid state hard disk and a 2nd generation Intel i5, 2-core CPU running at a sedate 1.6GHz. That seems at least adequate.

2.0 Installing WSL2

Before you can even think about running Giocoso on Windows 11 then, you have to first install the Windows Subsystem for Linux itself. Fortunately, Microsoft has made this a walk in the park these days! Just open a command prompt window with Administrator privileges (so, click Start, search for 'command', then right-click the Command Prompt item and select Run as administrator):

In the command window that then appears, type the command:

wsl --install

This triggers quite a lot of activity, including downloading a complete copy of Ubuntu:

Note in particular the mention of 'GUI App Support has been installed': it's this message which tells you that you're actually installing WSL2g, where the 'g' indicates baked-in support for graphical and audio Linux apps to run in a Windows environment.

Once the Ubuntu download is complete, you'll see a message that reads, "The requested operation is successful. Changes will not be effective until the system is rebooted." So, reboot your PC when you're ready.

When you log in after the reboot, "things" start happening automatically! To begin with, you'll find a command-prompt-lookalike window appears, though it's got an Ubuntu roundell as its logo in the title bar and task bar:

This installation process takes a few minutes and ends with you being prompted to create a new UNIX account (note to Microsoft: Linux isn't actually UNIX, so there's a terminological inexactitude at this point, but whatever...):

The account you create at this point doesn't have to match or be the same as your Windows' username/password combo... but I usually make them the same anyway, for ease of remembering things! Once the password has been accepted, you will find yourself staring at a full-blown Linux command prompt, where you can type all sorts of Linux-y things:

...by which you will swiftly learn that though this is 'proper' Ubuntu, it's using a special 'Microsoft WSL2' kernel. It's a technical detail which needn't detain us now, but it's interesting.

3.0 Post-WSL2-Install Steps

Once you've installed WSL2, you need to update it. At the Ubuntu command prompt, therefore, type:

sudo apt update && sudo apt upgrade

A lot of software download will then take place, followed by a long process of updating hundreds of packages. Give it time and let it complete.

Once it does, I would also take this opportunity to issue this command:

sudo apt install x11-apps pulseaudio

...swiftly followed by:

xeyes

...which will appear to pause for quite a few seconds before displaying this sort of thing:

The pair of eyes is a Linux program running on the Windows desktop and, incidentally, interacting with the movements of your mouse around the Windows desktop: it's clever stuff, basically! Close the eyes when you're done proving that Linux graphical apps appear on the Windows desktop without you having to install third-party X servers.

I'd do one other thing at this point, too:

wget https://absolutelybaching.com/musictest.flac

...which downloads a small FLAC file we can test with later on.

Now, you should reboot your Ubuntu 'virtual environment' so that the software updates we applied earlier actually take full effect... but you can't reboot WSL2 by typing 'reboot' at the Ubuntu command prompt! You'll get an error message about 'System has not been booted with systemd...' if you try! Instead, to reboot a WSL2 virtual environment, you open a Windows command prompt window (administrator rights are not required) and type:

wsl.exe --shutdown

To then simulate powering on your Ubuntu PC once more, you simply click Start -> Ubuntu, and that will re-open the Ubuntu command prompt window afresh.

4.0 Installing Giocoso

At your freshly-rebooted Ubuntu command prompt, type this command:

wget https://absolutelybaching.com/abc_installer

That quickly fetches a tiny (3KB) text file from this website's servers. You then run it as follows:

bash abc_installer --giocoso

That will trigger a further software download and a prompt for your password to grant sudo privileges:

And that's really all that's required to install Giocoso version 2! Getting it to run successfully is a separate story entirely, however! We come to that next...

5.0 Running Giocoso for the first time

To run Giocoso for the first time, just type the command:

giocoso

This will trigger the appearance of a rather fierce-looking wall of red error message text:

On its first run, Giocoso does a software inventory of whatever Linux environment you're running in and has concluded that your newly-minted Ubuntu environment is missing a few packages that it will need. The command needed to install the missing dependencies is written in blue, but is broken over two or more lines. For it to work, it actually needs to be submitted on a single line. To achieve that, you could copy-and-paste the two parts of the command separately; or just type the whole thing out as a single-line command. However you choose to do it, issue that installation instruction as a single-line command:

The command will fail, claiming that it has no idea what 'fc-list' is. This is a known 'feature' of installing Giocoso on Ubuntu-on-Windows: the fc-list package is actually required, but it's not available to Ubuntu-on-Windows under that package name, so you can simply edit that last package name off the installation command and try again:

As you can see, without that one package name in the command, it all works fine. You'll be prompted to continue (just press [Enter] to confirm) and then another bunch of software downloads and installs will take place. Once that's completed, launch Giocoso once more (again, just type giocoso):

This is progress! The first time Giocoso runs with all software prerequisites installed, it will notice that there is no persistent configuration file present and will therefore propose to download a default one from this site's servers. Press a key to make that download happen (it takes mere seconds) and you'll next see this:

Another wall of red error message text! This one isn't really an error, though: it's simply saying that when you run the bare command giocoso, the program assumes you want to source information about what music exists from a database (called 'music' by default)... and, of course, no such database yet exists, because you haven't created one yet. The trick, therefore, is to tell Giocoso to run without a database -to just play whatever music files happen to be in the folder we're running the program in, in fact.

So, now issue this command:

giocoso --dbname=none

...to tell Giocoso to run without a database, and you'll see this happen:

You obviously can't tell from a static screenshot whether I can actually hear music playing at this point, of course... but I can! The test music file I got you to download earlier is 'sounding' perfectly fine through my laptop's speakers (although it took a couple of runs before it worked, presumably because my laptop is old, slow and actually isn't meant to be running Windows 11 at all! After the fifth attempt, it all just sprang into life and has stayed that way ever since).

From this point, therefore, everything is 'normal Giocoso'. The hard part of running Giocoso on Windows is getting graphics and audio running inside an Ubuntu environment to appear and sound on the Windows desktop -but WSL2 takes care of all of that for us.

6.0 File Access

I thought I'd conclude this very long article by a quick look at how you 'map network drives' inside a WSL2/Ubuntu environment -simply because I myself never store my music on my main PC, but instead access it over the home network. Thus any Windows PC running WSL2/Ubuntu won't have any local FLAC files to play and will instead need to find them on a remote server.

More fundamentally, the question is 'how does the Ubuntu environment see what the Windows PC knows about' (and a related question is how you can see the Ubuntu environment's folders from Windows)?

6.1 Local Files

Let's start with the simplest case: how can you see your Windows PC's C: drive from within the Ubuntu environment? That one's easy: it's accessible from Ubuntu's /mnt/c folder:

Ignore for the moment the various 'permission denied' errors in that lot of output: take a look instead at the list of folders displayed there. Do they look in the least bit familiar? How about now:

And hopefully you will be able to recognise that the listing of /mnt/c in the Ubuntu environment exactly corresponds to the contents of your C: drive on Windows.

If you wanted Giocoso to process some music you had stored in your Music folder on Windows, therefore, you'd simply navigate inside Ubuntu to /mnt/c/Users/hjr/Music. (Though, obviously, if your username isn't 'hjr', you'd replace that bit with whatever is more relevant to you!)

For the record, you can do the same thing in reverse: if you open Windows Explorer (i.e., the File Manager) and type \\wsl$ in the address bar, you'd be able to navigate your way through the Ubuntu file system using a purely Windows tool:

Hopefully, you recognise the contents of the main panel there as being what you'd expect to find in the /home/hjr folder inside my Ubuntu environment!

The point is that whilst we have two separate operating system environments -one Windows, one Linux running 'inside' Windows-, they both share the same file system and each can 'see' the other, though they remain distinct within their own folder structures. If you store all your music files on the C: drive, therefore, it's not going to be hard to get Giocoso to 'see' them: you just tell it to play the contents of the /mnt/c/username/Music folder (or wherever is actually applicable).

6.2 Remote Files

What do you do, however, if your music files are stored on a remote server and you've mapped that 'share' to your Windows PC's M: drive, like this:

Here, I have a server called 'jsb' which I've mapped to my M: drive. All my music is thus accessible in Windows by visiting the M: drive and its various sub-folders. How can I get Giocoso running in the WSL2/Ubuntu environment to see that M: drive? If you try visiting /mnt/m inside Ubuntu, for example, you'll find that doesn't work.

Well, the quick fix (which won't persist between reboots) is to issue this command from within the Ubuntu environment:

sudo mkdir /mnt/m && sudo mount -t drvfs M: /mnt/m

Here you see me first listing the contents of the /mnt folder inside the Ubuntu environment: the C: drive mapping is listed (along with a 'wsl' one, which is of no interest), but there's no M: drive. So I issue the above command... and all of sudden, a new listing of /mnt does show an M: drive, and I can 'cd' into it and list its contents, too.

The command is actually in two parts: the 'mkdir' makes a new /mnt/m folder permanently... but it will be merely an empty placeholder at this stage. The second part then mounts or maps the Windows' M: drive to the empty placeholder folder -and thus makes it appear to contain the same contents as the Windows' drive.

As I say, this will grant you temporary access to a mapped network drive. Reboot your PC or restart your WSL2 environment and though the /mnt/m mount point will still be there as a folder, its contents won't be.

The persistent fix, therefore, is to issue this command from within your WSL2/Ubuntu environment:

sudo nano /etc/fstab

...and then add this line to the end of the existing file:

M: /mnt/m drvfs defaults 0 0

...which is simply another way of saying 'please make my Windows M: drive appear at the /mnt/m mountpoint I created earlier'. Because that request is in the fstab file, however, it will be re-executed automatically every time the Ubuntu system re-initialises: your /mnt/m folder will therefore automatically and always contain the contents of your Windows' M: drive.

An alternative approach to getting the Ubuntu environment to 'see' remotely-accessible files is also described in section 7 below: using NFS or SAMBA to access network shares directly. But this idea of mapping a network drive in the Windows environment and then getting the Linux environment to make use of it via a mount point has the benefit of working out of the box and might be easier for Windows users to get comfortable with!

7.0 Next Steps

Once you've got Giocoso playing the test file adequately, it's time to point it at your real music collection. If that's stored on your Windows hard drive, you'll be able to access it from within the Ubuntu environment at the /mnt/c folder (replace 'c' with 'd', 'e' or whatever other drive letter you use!).

If (like me) your music files are actually stored on a remote server (not that remote in my case: in the loft!), then you'll need to be able to tell Ubuntu how to access them directly. In my case, I use the NFS networking protocol (though you might also do it via SAMBA), so I would do the following:

sudo apt install nfs-common

...followed by something like:

sudo mkdir /sourcedata
sudo chown hjr:hjr /sourcedata
sudo mount -t nfs jsb://bulkdata/music /sourcedata

...which then allows me to do:

cd /sourcedata/music/classical/B/Benjamin\ Britten/Opera/A\ Midsummer\ Night\'s\ Dream\ \(Britten\ -\ 1966\)/
giocoso --dbname=none

...and get this result:

...and you can tell from the 'Now in:' bit of text in Giocoso's header that I'm now playing music from my music server, directly on Windows 11, via Ubuntu!

Once you can play music directly from your network sources, it's probably time to get Giocoso to scan your network sources for all your music and to populate its database with details of what exists and where it can be found. The command to do that in my case would be:

giocoso --dbname=main --musicdir=/sourcedata/music/classical --createdb

...which triggers:

...a search for all your music files, followed by:

...a visit to each music file in turn, to assess the file's characteristics (composer, composition name, duration, performers, and so on). Once that has completed (which can take a while!), you'll see this sort of summary at the end:

Once you know that Giocoso now knows where all your music can be found, you can simply launch Giocoso with the command:

giocoso --dbname=main

...and get randomised playback of your music:

I have no idea why Giocoso decided to play some Ignace Joseph Pleyel at this point: I certainly didn't request it, but Giocoso simply picked something at random to play and this happened to be what it picked! That's the whole point of Giocoso, of course: continual surprise at what gets played!

If you want to start instructing Giocoso what it should next play... well, that's where reading the rest of the documentation comes in handy 🙂 In particular, you need to read up on all the selection and filtering runtime parameters you can specify as you launch Giocoso.

For now, however, we're done: Giocoso is running on Windows 11 (sort-of!) and its audio and graphical output are handled entirely automatically by the magic that is the Windows Subsystem for Linux.

8.0 Conclusion

Summing up all of the above, then:

  • The Windows Subsystem for Linux (WSL2) on Windows 11 means you don't have to worry about installing third-party audio or graphical servers on Windows for a Linux virtual machine to talk to: it's all baked-in and ready to run by default (unlike on most Windows 10 installations at the time of writing, for example)
  • Installing WSL2 is a simple one-line command: wsl --install
  • Giocoso is then installed within Ubuntu by downloading the abc_installer script and running it with the --giocoso runtime parameter
  • On first run, Giocoso will prompt for installation of extra software within the Ubuntu environment: the mention of fc-list at this point as one of the missing packages should be ignored.
  • On second run, Giocoso will download a persistent configuration parameter file and then error-out, as it thinks you have asked it to use a database which doesn't exist yet
  • On its third run, with the --dbname=none runtime parameter specified, the program should play the test music file correctly
  • After that, it's standard Giocoso and Linux stuff: mount your networked music files locally, point Giocoso at them with the --musicdir runtime parameter, create a database of those files and then start invoking Giocoso with the --dbname=<something> runtime parameter to get randomised selections of music made
  • Anything that's stored locally on your Windows PC is accessible directly from within the Ubuntu environment at the /mnt/<drive letter> folder.

[Back to Front Page]|[Giocoso on Windows 10 Distilled]|[Giocoso on Windows 11]|[Giocoso on Linux]|[Giocoso on Raspberry Pi]|[Giocoso on macOS]