Making Music using Rosegarden on Fedora 17

I’ve always loved music – as do both of my parents. They have excellent, but divergent tastes in music. With my Mum I share a love of Sandy Denny, Jeff Lynne and George Harrison, with my father there was a shared affection for Eric Coates, Henry Hall and G. F. Handel. And when you mix the two together you get my love of Maestoso, Mike Oldfield, Kevin Ayers and Barclay James Harvest.

As well as listening to music, I also enjoy making it. But I always thought making a music on a computer seemed so difficult to do I never bothered really trying.

However, recently I got a bit of inspiration from my friend TA Walker (Tim). Earlier this year Tim signed up for something called the 5090 Challenge – writing 50 songs in 90 days. Given Tim has a full-time job, a wife and a young daughter that was insanely ambitious but astoundingly he managed 36 excellent songs which I have been known to raid for my YouTube videos. In order to reach his goal Tim was making music anywhere using anything – he was even overdubbing vocals and recording guitalele in his car during his lunch-breaks using an iPod Touch. Here is Tim playing one of his 5090 songs:

So, if Tim could make music in a car (or on a very nice looking white leather sofa) I had no excuse sitting in front of a computer that had access to a repository of free software for making noises.

I’m using Fedora 17 and I wanted to try and record music entirely using free software. This is because a) I’m on a budget of £0 and b) I think it’s the right thing to do.

Rosegarden running on Fedora 17

The first program I tried to install was something called Rosegarden. It seemed a pretty welcoming program for beginners as music programs go and therefore a good place to start. It used staves and notes – things that a dinosaur like me can (almost!) understand. However before I could get Rosegarden to make any noise I needed a synthesiser. I don’t have a real synthesiser, so instead I needed a soft synthesiser – a program that runs on the computer and pretends it’s a real synthesiser sitting on your table.

The synthesiser that everyone seemed to recommend was something called FluidSynth, so I thought I’d install that. FluidSynth is a free software synthesiser that can take MIDI data from a program like Rosegarden and turn it into audio.

It normally comes with a “SoundFont” bank containing a nice range of sounds for a beginner, so it seemed a good start. However to use FluidSynth it’s best to have a nice graphical interface so you can fiddle with it using knobs and buttons on your desktop. The most common one is called QSynth. It looks very impressive!

A very impressive addition to any desktop!

Only, before I could use the virtual synthesiser I needed something to plug it into the computer’s sound hardware. In other words, FluidSynth needs somewhere to send all this audio it’s creating. That somewhere is a piece of software called the JACK Audio Connection Kit (JACK). But before I could use JACK I thought I’d find it easier if I something graphical to could control JACK with. So I needed something called QJackCtl – a graphical JACK Control panel.

QJackCtl with JACK not started

So I downloaded all the bits I needed. I had Rosegarden (a music studio), Fluid Synth (a synthesiser), JACK (a sound server), QJackCtl (a graphical interface for JACK) and QSynth (a graphical interface for FluidSynth). It was, literally, like a house that JACK built.

Now I tried to make a noise. I worked out after a couple of minutes that it’s not enough to simply load QJackCtl – JACK has to be started and stopped by pressing the Start and Stop buttons. So I tried to start JACK and it did nothing but spit error messages at me and I certainly couldn’t get anything to make any sound.

Now, this is where the cutting-edgeness of Fedora had just bitten me on the bum. Normally you should be able to start JACK and it will work without error. And indeed, since this morning’s software repository updates that’s exactly what it does do. However at that time there was a permissions problem within Fedora so I needed to type:

su -c "modprobe snd-seq-midi"

It took me an hour or so to find that out, and before I did so I couldn’t start JACK or make any noise at all. Normally I would have given up long before this point, but with M4 and Mr Cable The Sysadmin ringing in my ears I was determined and pressed on.

There were a couple of other things I had to do in JACK to get it to work. After pressing the Setup… button I had to uncheck Realtime, check Force 16bit and change the interface to hw:0.

QJackCtl with JACK started

With JACK running happily, I started QSynth to get FluidSynth running. Everything seemed OK, so the next step was to run Rosegarden. No problems. I opened one of the examples in the examples folder, pressed the play button and success! Music!

However, music on my headphones only – there was nothing coming out of my speakers. I went to QJackCtl and pressed the Connect button to see what was going on.

QSynth in headphone-only mode

As you can see, the left output of QSynth (l_00) was going to my system’s playback_1 and the right output of QSynth (r_00) was going to my system’s playback_2. This was giving me music in my headphones. However, what were the other playbacks?

QSynth will now use my speakers too

I tried to connect the left output of QSynth (l_00) to playback_3 and the right ouput (r_00) to playback_4, and it worked. Music through my speakers!

So every time I want to make music I…

  1. load QJackCtl, 
  2. start JACK by pressing the Start button, 
  3. load QSynth 
  4. then load Rosegarden

…always in that order.

Provided I just wanted to enter musical notation into Rosegarden I was now fine, but that’s not much fun. The frustrated Woolly Wolstenholme in me wanted to have a keyboard to play!

The trouble was as well as not having a synthesiser, I don’t have a keyboard either. Fortunately there are “virtual keyboards” available that allow you to play music using your computer’s keyboard. The one I chose out of a field of three was called Virtual MIDI Piano Keyboard (VMPK). I chose this one because it was the only one that seemed able to play nicely with the Hungarian keyboard on my computer.

Be Woolly in the comfort of your own home…

However, in order to record MIDI data created with a virtual keyboard meant I had to plug it into something that records MIDI data – Rosegarden. It was back to the QJackCtl Connect dialog:

VMPK running, but QJackCtl shows nothing to plug it into

VMPK had appeared in the MIDI tab of the QJackCtl Connect dialog. The trouble was, nothing else did – the only thing I could plug my virtual keyboard into was itself.

This proved to be a very tricky problem to sort out. It took me a long time to find an answer but the answer was a program called a2jmidid. Apparently there are two kinds of MIDI on a GNU/Linux machine – ALSA MIDI and JACK MIDI. They can’t talk to each other without a “bridge” program. The bridge is called a2jmidid and it’s available in the Fedora repository. To use it I had to start a terminal window and type:

a2jmidid

Then, provided I kept the terminal window open, when I go back to my QJackCtl Connect dialog I get some extra things in the MIDI tab:

VMPK connected to Rosegarden in QJackCtl

As you can see, I can now connect the VMPK Output to the Rosegarden record in and, hey bingo, I’ve got a MIDI keyboard connected to Rosegarden.

VMPK configured for a Magyar keyboard

The only thing left to do with VMPK is create a Hungarian key mapping – this was very easy to do using a dialog provided by the program.

The first thing I wanted to try and record was a tune I remembered from my childhood. It was an early music or baroque piece for recorder and a small ensemble used by the Open University before their morning broadcasts. I have never heard since early mornings in the 1980s when I used to get up early to watch a maths foundation course on calculus or the foundation course on modern art.

A lost childhood memory

I did a rather twee arrangement using a harpsichord, viola, cello and a recorder. I think the real thing was less Bach and more Henry VIII.

However when I came to play it the recorder just didn’t sound right. It sounded very good, but it didn’t sound like the recorder I had in my head. So I looked on-line to see if there were any other SoundFont banks I could use with QSynth.

I was in luck because the pianist and composer S. Christian Collins has put together an excellent SoundFont for bank for QSynth and put it on his website here. It’s called the GeneralUser GS Soundfont bank.

GeneralUser GS Soundfont bank loaded into QSynth

To load it I had to get QSynth running and press Setup…. Next, I had to go to the Soundfonts tab and replace the default soundfont bank (an sf2 file) with the GeneralUser GS SoundFont bank I had downloaded.

To my delight the recorder sounded much more how I wanted it to sound.

So now I  had finished and was happy with my sounds I realised I needed some way of recording what I’d just done as an audio file instead of a Rosegarden file.

When I ran QJackCtl with nothing else running the Connect dialog looked like this:

By default I can only get sound from the microphone

If you look at the Readable Clients box on the left you’ll see the only place I could get any audio is from  capture_1 and capture_2. They represent the microphone socket on my computer. capture_1 is the left channel and capture_2 is the right channel of the stereo microphone input.

If I ran Rosegarden I found they were connected automatically to Rosegarden’s record in 1 L and record in 1 R Input Ports:

Rosegarden connects to the microphone automatically

I looked in the QJackCtl Setup dialog and saw a Monitor check box which was unchecked. It sounded like what I needed so I checked it.

However you can enable monitoring

When I restarted JACK I saw this:

And route the monitor output where you want it

So now I have monitor output in addition to microphone input as a potential source of audio. What monitor output means is that I can record whatever I can hear through the speakers. This is just what I needed.

Such as here, where the monitor output is routed to Rosegarden

I started Rosegarden up again and connected up monitor_1 and monitor_2 to record_in_2 L and record_in_2_R.

This meant that now Rosegarden had the system’s sound output available as a source of audio. Now I could use Rosegarden to record whatever Rosegarden was playing as an audio file!

You can easily turn the metronome off in Rosegarden

Setting this up in Rosegarden is quite easy and pretty logical once you work it out (which took me a long time!). The first thing you need to do is go to Studio-> Manage Metronome to turn off the click track. You usually don’t want that on your master recordings!

The next thing you need is an audio track that can accept the monitor output as its audio input:

Rosegarden all set up to record Rosegarden

You can see in the picture above I’ve set track 17 as my current track. It’s an audio track and I’ve called it RECORD.

On the left hand side you’ll notice that I’ve set the In: to In2. This is very important – In2 is the Rosegarden input we connected up to the monitor output in QJackCtl earlier. Never use In1 – it’s quiet and full of  interference noise!

Finally you’ll notice I’ve armed track 17 to record – shown by the red light to the left of the track name. Now when I press the record button the my Rosegarden file will play and be recorded as an audio file on track 17 at the same time.

My recorded Rosegarden output in Rosegarden

When the track has finished you will see the waveform displayed in your recording track as it is above.

Double-clicking on an audio track segment in Rosegarden opens Audacity

Now you can double click on the recorded segment and it will open in Audacity. Don’t forget to set Audacity to JACK Audio Output as I have in the picture above, or it will freeze and not play.  From Audacity you can edit or export the audio in the usual way.

For OGG Vorbis files or MP3 files I normalize to -2.0dB

I always save a lossless FLAC file from Audacity first. If I want to save to a lossy format such as OGG Vorbis or MP3 I always Normalize to -2.0 dB first before I export.

Being able to set Audacity to use JACK audio output is very handy – particularly if you find you want to listen to audio files while you are working.

So now I had a FLAC file, an Ogg Vorbis file and an mp3 file. The FLAC file was fine, but what I really wanted to do was get a picture in my mp3 and ogg files so they would be just like the ones I downloaded from TA Walker’s Bandcamp page.

To do this I found an excellent program called EasyTAG which does exactly what it’s name suggests. This program allows you to add a picture to your audio files and is very easy to use. Although I tend to use Ex Falso for most of my tagging (it’s better for classical music) I’ll use EasyTAG for tagging my own files in future.

The next thing I decided to do was re-record the OU Tune in Mike Oldfield style. When I was a child I remember watching Simon Groom visit Mike Oldfield to see him re-record the Blue Peter signature tune. That video had a enormous effect on me as a child and recording something like that was something I always wanted to try.

I had a lot of fun in Rosegarden pretending to be Mike – particularly tapping away on my computer’s keyboard pretending to play the bodhrán.

When I finished Tim very kindly recorded a real electric guitar solo for me to add to my track. He supplied it to me as a FLAC file, but the funny thing was I could not find any way of importing a FLAC file into Rosegarden – only .WAV files.

TA Walker’s solo shown on the red track

However, by accident, I discovered you could import FLAC files directly into Rosegarden if you dragged and dropped them onto the time track.

I’d enjoyed myself so much with the Open Universtiy tune I decided to record another tune Mike Oldfield-stylee, so I dusted off my recording of Border Television’s Keltic Prelude March by L. E. DeFrancesco and did that as well!

The reason I did the Keltic Prelude March was so that I could upload my video of a Border Television start-up that I had pulled down earlier this year. The reason I had pulled it down was because of a copyright claim over the track Holiday People by James Clarke that I had used over the menu rundown. Therefore I decided I would also create a pastiche of Holiday People to use in my Border start-up. I came up with a tune I called Lionel’s Talking!

Lionel’s Talking in Hydrogen

I needed a “real” drum kit for Lionel’s Talking so I decided to use a special drum synthesiser called Hydrogen which does the job flawlessly. Hydrogen also works beautifully in tandem with Rosegarden. The Rosegarden website has a wonderful tutorial to explain how to do this here.

So put it all together and what do you have? Well something like this…

Producing music on GNU/Linux can be a bewildering and frustrating experience at first. There are so many things you need – each one has to be set up correctly in order to work properly. There is a huge amount to learn and sometimes you feel the easiest thing is to just give up. I spent a lot of time trying, and failing, to do things which I thought should have been easy.

In addition, differences in hardware mean what you have to do get everything working is slightly different for everyone.

But with a little perseverance you find that things rapidly begin to make sense, there is a common logic that underlies all the things you have to do and you begin working out answers to your problems yourself.

I hope you try making some music too.

Spotlight on Synfig

The only thing I haven’t been able to do using free software since moving to GNU/Linux in 2008 is animate. And it bugged me. Everything else – raster graphics, vector graphics, offline video editing, audio editing, font design, desktop publishing – I could achieve, but animation was the reason I’ve had WINE and Macromedia Flash 8 installed on my machine for the past three years.

When I first started playing with GNU/Linux I came across a program called Synfig Studio which could do animation, but at that time it needed to be compiled from source code. It seemed a bit too much like brain surgery for a GNU/Linux beginner! However, the other day I was banging my head trying to do some animation in Flash. I decided to Google for any free software tools that might be able to help and I was reminded of Synfig Studio once again.

Blue hair? Why, it’s Mrs. Slocombe!

I went to the Synfig Studio website and the first thing I noticed was that a brand new shiny version of Synfig Studio was available as an RPM for Fedora. In other words, all I had to do was download, double click and go. Everything worked perfectly. I found the Synfig Studio website was excellent, there were a large number of tutorials and an extensive manual and so I set about reading.

Animation programs are always off-putting to beginners due to their complexity, and Synfig Studio was no exception – partly because it began life as an in-house tool in a professional animation company and that really shows in the power and complexity of what it offers.

I learned Flash 2 back in 1998 by trying to create the ATV Colour Zoom ident as I thought it would be quite a good challenge and force me to look into the tool properly. For the same reason I dusted off one of the more challenging animations in my “TODO” list to learn Synfig – the BBC South West Spotlight dots titles.

My plan was to draw the Spotlight logo in Inkscape, import that into Synfig Studio and then animate it. The first thing I did was set up my canvas. Changing the units to pixels is very important – Synfig Studio uses points by default which seems a strange choice for a tool not centred on printed work.

When I tried importing my artwork from Inkscape it came in at the wrong size:

Imported SVG from Inkscape

The reason was obscure and not what I had been expecting. I had assumed it was the old Inkscape dpi (dots per inch) problem, but it was to do with something called Image Span which is related to the aspect ratio of the end animation. After reacquainting myself with Pythagorean theorem I worked out I needed to set the Image Span to 16 for 768 by 576 pixel artwork from Inkscape.

Setting Image Span in Synfig Studio

Then artwork comes in correctly from Inkscape. However, now I could see some problems with imported SVG:

Problems with Imported Inkscape SVG

There were two problems – the holes had disappeared in the “P” and “O” and there was a segment missing from the circle of the letter “O”.

Paths with holes are imported into Synfig Studio as two objects or “layers” (everything in Synfig Studio is a layer) – the letter and its hole. To make a letter with a hole in it you need to place the hole layer above the letter layer, and then give the hole a layer an “alpha over” blend method. As you can see, the logic behind the program is very different to Flash!

Using Alpha Over in Synfig

The nick out of the letter “O” was Inkscape’s fault. When you convert text to paths in Inkscape you often get double nodes (nodes stacked on top of each other). Double nodes also cause problems in Inkscape itself so it’s always a good idea to merge these nodes in Inkscape.

The join nodes button in Inkscape

Inkscape ellipses don’t import as Synfig Studio circles (they come in as something called Blines instead), so I redrew the dots in the Spotlight logo as Synfig Studio circles to make animation easier later. In fact to get an ellipse in Synfig Studio you draw a circle and then apply a transformation layer to it – again, a bit strange for a beginner! So, now I had the artwork imported:

Inkscape SVG imported perfectly

I discovered I didn’t actually need the background rectangle I’d drawn in Inkscape in Synfig Studio, there’s a special type of layer for solid backgrounds called “Solid Colour” that always fills the background however large your animation is. This is analogous to “Background Colour” in Flash, only in Synfig Studio you could use a “Gradient” instead.

Now I needed to colour my artwork. I found a small bug in Synfig Studio which means that you cannot use the HTML-style RGB value (a six digit hexadecimal number) to enter colours. My background colour in hexadecimal was #171a17. When I entered this into Synfig Studio I got a mid grey, instead of the charcoal colour I was expecting.

A Lighter Shade of Dark

I went into the GIMP and discovered that #171a17 is equivalent to the the RGB percentages 9% 10% 9%.

The GIMP Colour Picker information dialog

I entered the values 9%, 10%, 9% into the Red, Green and Blue spinboxes on the Synfig Colours dialog box, and I got the colour I expected. However, I also found that the HTML code displayed on the Colours dialog became 010101 – not what I expected!

In Synfig Studio, the HTML code is wrong

The ever-helpful Genete on the Synfig Studio Forums suggested that I might have a non-linear palette selected for my file, but this turned out not to be the case. So the moral of the story is, sadly, only enter colour values as RGB percentages.

Speaking of colours, it would be great if Synfig Studio could load GIMP palettes, or create a palette from the currently imported layers.

I then set about animating. This is quite different to Macromedia Flash as in addition to “keyframes” you also have the concept of “waypoints”. A “keyframe” stores every setting of every “layer” item on the current canvas at a particular point, whereas a “waypoint” just stores one setting. You also have to forget about the concept of “frames” that was so key to Macromedia Flash. Synfig Studio, in common with Swift 3D, uses the concept of time instead. As far as the time-line was concerned I am very glad that I had done some work in Swift 3D before approaching Synfig Studio.

Keyframe labels appear on the canvas too

One thing I did like is the fact you could label not only your layers but your keyframes – that saved me an awful lot of scribbling! Once you have your keyframes set up Synfig Studio really excels. There are numerous different ways of defining how the animation gets from one keyframe to another. The default was TCB which gives beautiful naturalistic movement, but for Spotlight it would cause arcing like this:

Arc caused by TCB Interpolation

When I really wanted linear tweening to give me straight edges like this:

Corrected by Linear Interpolation

Another little gotcha I found whilst animating was that the time-lines starts at “0f”, not “Frame 1” as in Flash. This caught me out when I was putting the animation together as I was getting odd blank frames!

Whilst animating I came across a niggle caused by my operating System. In GNU/Linux Alt and left-click is used to move windows around. However, in Synfig Studio Alt and left-click is used to transform (i.e. scale) objects. Fedora 15’s deskptop GNOME 3 compounds this problem by removing the “Windows Movement Key” setting that you could adjust in Gnome 2 to change this behaviour. Fortunately the wonderful Synfig Studio forum came to the rescue as “nikolardo” had a cunning work-around:

“Another workaround for the Alt issue presents itself when you realize it only happens when you Alt-click. Pressing Alt and then clicking gets picked up by the WM (openbox, in my case), but clicking on a vertex and then holding the Alt key produces the scaling behavior intended. So, next time you Alt-click and the window moves, let go, and then click-Alt.”

Whilst working I found that “Groups” were not what I expected at all. The purpose of Groups in Synfig Studio is to collect disparate items around your animation so they can be selected together. In fact, when creating the animation I never used any groups at all, although I can see how they would be useful on other animations.

I loved the fact I could enter a frame number e.g. 454 to move somewhere on the time-line and it got converted into seconds and frames. I tend to think in frame numbers and it’s great I don’t have to keep dividing by 25 and working out the remainder. This was a huge help when setting up keyframes.

Useful for creating guides at 0x and 0y

Another thing I found was I could use the Canvas Metadata window, which at first seemed useless, to adjust the guides. It would be even better if you could use pixels instead of internal units to adjust the guide positions in this window.

One thing I soon learned as I worked was that Synfig Studio’s canvas window is not always WYSIWYG, and the Preview Window isn’t always an accurate reflection of the end result either (but this is being rewritten for the next release) – you have to do a render in order to see how your final result is coming along. This is particularly true if you are using effects like Motion Blur. For instance, when the Spotlight S is rotating, this is what I get to see on the stage:

What you see in Synfig Studio…

Whereas this is what the end result looks like:

…is much more impressive when rendered!

Correction from Genete:

“That’s because your display quality settings were not set to high quality. There is a spin button on the top of the canvas that allows you to set the quality to 1 (better), instead of use 8 (worse) the default value. WYSIWYG is fully done always in Synfig Studio. The problem is that it takes some time to render complex effects like motion blur, duplicate layer, etc.”

For my renders I used a PNG sequence, and only rendered the frames I’d just worked on. One thing I noted when rendering is that the render progress bar and cancel button on the canvas window don’t work. In the future I would love it if a WebM render option was added to Synfig Studio, particularly given the popularity of YouTube.

Notice that zooms, blurs and colour corrections are layers.

As I’ve said before, in Synfig Studio everything is a layer. Not just every single shape but a whole host of other things such as colour changes, blur effects, tranforms. So, obviously the number of layers you get soon gets large and unwieldy. However you can “encapsulate” layers together into what are called “Paste Layers” and then deal with these encapsulated layers as one object.

The capsules show encapsulated layers

You may be thinking this sounds a bit like the Flash concept of having symbols, but it isn’t – yet. The encapsulated layers are still on the main canvas and therefore use the main canvas’s time-line. In order to use encapsulated symbols in a way analogous to Flash library symbols you need to “Export” the Paste Layer as a separate Canvas. It will then appear in the Canvas Browser.

The Canvas Browser

Now your capsule of layers is a canvas in its own right, with its own independent time-line and you can use it in a way akin to library symbols in Flash. As you work, you’ll find that the main canvas’s time-line gets cluttered with keyframes and waypoints, so it’s worth exporting encapsulated layers to simplify your work.

The only real downside of the Synfig Studio time-line design is shared by Swift 3D. It’s that you can’t add and remove things from your animation easily. If you want to “hide” something you have to set its amount to 0 and then you have to fiddle about with waypoints with constant interpolation in order to show it again. It seems too much work when you simply want to put things on and take things off of your canvas.

Exporting a Paste Layer after you have already done work on an animation needs some care. Key frames are not brought across to the new canvas, and the exported animation duration defaults to 5s (five seconds) which means you have to increase it to the right length manually. So, before you start work on an animation it’s better to decide upon its structure first. But that was always the case anyway!

One minor thing – I found that I could only remove things out of encapsulated layers by dragging and dropping which was not discoverable for me – I expected to find another way of doing it via a button of some kind too.

Put a space in an Exported Canvas name and…

Entering a canvas name with a space in gives a message telling you about the C++ standard type library throwing an exception – not something most cartoonists would find particularly helpful!

When adding an exported canvas from the canvas browser on your main canvas you can offset its start-point by any number of frames. However, the offset needs to be a negative number of frames to make it appear a positive number of frames later and a positive number to make it start earlier which foxed me for a bit too!

Anyway, enough moaning – these are only very minor points! What you should take away from all this is that with exported canvases I found I could work exactly the same way as I was used to in Flash.

This does the hard work in the Spotlight animation.

Meanwhile, back to my animation. I wanted to emulate some optical film effects in my animation. The first one, motion trails, was easy to do with the Synfig Studio Motion Blur layer. This gives you a huge amount of control over the appearance of your finished trail.

Software doesn’t get any more magical.

I also needed some “optical glow”. I achieved this very easily by using the Colour Correct layer. This actually had a setting for Over Exposure – the exact effect I wanted to emulate – built into it! I was absolutely amazed! And not only that, I could animate the Over Exposure setting too. Incredible.

A bit of Blur (of which there are a dazzling array) helped to sell the glow even more.

The range of effects you can add to your animations in Synfig Studio is truly overwhelming. I think I’ll be blogging for months about the huge range of things you can do in Synfig Studio. It is an enormous amount of fun.

Zoom layers are a very clever idea.

To zoom in and out I used, naturally enough, the Zoom layer. Having a zoom on a separate layer is incredibly sensible when you actually start using it, but seemed very odd at first appearance.

And, it goes without saying, moving the dots around the canvas in Synfig Studio was simplicity itself.

So, here’s the finished result:

Did I mention Craig Rich knew my Granny…

Synfig files are very small and compact. The final file size was tiny – 11.9KB. I found that utterly incredible and it compares very favourably to Flash.

I could have completed these titles in about two hours in Macromedia Flash 8, in Synfig it took me two days to learn the tool and complete the animation which I was quite pleased with.

Synfig is an excellent tool that is staying firmly installed on my computer! I really love using it and I am excited about what I can achieve using it in the future and the vast range possibilities it opens up. It is powerful, flexible, stable and rewards the effort you put into learning it a thousand times over. It also has a friendly and helpful community. Recommended.

Fedora 15 Beta, GNOME 3

Recently, a rather nasty crash caused by the gftp FTP client locked me out of all my files and shut me out of my Desktop. The program is rather ropey and has done odd things to my computer before so I really shouldn’t have been using it.

Still, every cloud has a silver lining and since then I’ve moved to Filezilla as an FTP client (which is a lot better anyway) and become rather less blasé about making backups.

GNOME 3 Desktop – Click to enlarge

As I needed an OS reinstall I also decided to take the plunge and install Fedora 15 Beta. I’d been reading about GNOME 3 for years so I thought it was high time I tried it for myself.

Here are my thoughts so far:

Pros:

  • I was delighted to find my Trust 5300 graphics tablet works out of the box. No compiling and installing Wizardpen and playing around with settings. This is very important to me as I’m fond of using MyPaint to paint pictures when I’m listening to podcasts. It’s also very useful in conjuction with The GIMP.
  • I was disappointed at first to find that Colour Management was missing, but once added using Add/Remove Software it’s better than ever. Work has been done to make it easier to use and it has had some bug fixes too. Colour Management would be enough to justify my using GNOME3 on my production machine.
  • Firefox 4 is fantastic – I love being able to play HTML5 videos at long last without needing a Flash plug-in.
  • I was surprised that I couldn’t just press Delete in the Nautilus File Manager to remove files. You have to press Ctrl+Delete together. However, I like this better as it makes it much harder to delete things by accident.
  • It only took me about 30 seconds to work out how to use it.
  • It gets out the way most of the time and lets you get on with your work.

Cons:

  • The most serious problem is what happens when you switch off the computer. For some reason the Shut Down option is missing unless you hold down the Alt key. By default, you can only Suspend, rather than Shut Down your computer. This would be no problem at all if it were not for the fact that Suspend only works about one time out of four for me; Suspend is simply not stable enough to replace Shut Down.
  • You cannot alter how fonts are hinted on screen. This is very irritating as the default settings make text look, frankly, revolting.
  • The weather widget is missing – it showed the current weather, temperature and windspeed. I find that hugely irksome – I don’t mind it not being on the desktop but you should be able to see it when you click on the time at the top of the screen.
  • The title bars on the windows are too tall for no good reason. The whole of the rest of the interface seems to be about conserving vertical space, yet this throws away everything gained by losing the bottom panel.
  • Some dialog boxes are missing close buttons.

The whole system feels very stable indeed and I’m using it on my production machine quite happily even though, really, I shouldn’t be!

Gotta Dash

One of the most interesting aspects of working on Repton: The Lost Realms was having my sleeve artwork and inserts proof-read by Michael S. Repton. Michael is a professional proof reader, a linguist and someone who really knows his stuff.

Michael S. Repton playing Galaforce
Photo Courtesy Joel Rowbottom

One of the things that Michael disliked about my copy was my use a minus sign to indicate a pause. I had to replace every single one with something called a spaced en-dash.

Of course, I’m not really to blame for this – computer keyboards are rather deficient in the punctuation department. As a rule, they don’t have a real apostrophe or proper opening and closing quotation marks. But whilst your keyboard doesn’t have these symbols, your computer almost certainly does. If you have a look at the Character Map application you can find them all.

Character Map on Fedora 14 – Click to enlarge

The problem is that using the Character Map application every time you wanted an apostrophe or quotation marks would be too slow on a large document. Fortunately there is another way of entering these punctuation marks in GNU/Linux. You hold down Ctrl and Shift, press the u key, type the four digit Unicode value for the symbol you want and press ENTER.

So, an en-dash is Ctrl+Shift+u 2013 ENTER. After a while, you find you remember the most common symbols. An apostrophe is u2019, quotation marks are u201c and u201d and so on.

Characters of Gnote

To help me remember the less common symbols I put a list on a pinned Gnote, which I can call up easily whenever I need it.

You Know When You’ve Been Tango-ed

My friend Samwise and I are both enthusiastic users of the GNU/Linux operating system and also enormous fans of the incredible range of retro computing emulators produced by the brilliant Tom Walker.

Tom (left) and Samwise (right)
Photo courtesy regregex

There’s seemingly nothing that Tom isn’t able write an emulator for. He’s written emulators for everything from the humble Acorn Electron to the StrongARM-ed Risc PC with Spectrums, Amstrads, Beebs, Archimedes and much else in between.

Elkulator, running on Fedora 14

So it wasn’t altogether surprising when, last month, Sam asked if I could create some icons for his desktop he could use with Tom’s emulators.

Superior’s EGO:Repton4, running on RPCEmu

Sam is a KDE desktop power user, whereas I’ve always been a GNOME numpty. Fortunately for us starving scribblers and colourers in there is a project that aims to standardise all free software desktops and ensure we can create icons once that look good on all of them. The project is called the freedesktop project and the part concerning icons is called Tango.

There are numerous tutorials on the web that explain how to create Tango icons in both Inkscape and The GIMP.

The first icon I tried to create in Tango format was the three dimensional RISC OS era Acorn logo, to use with Arculator. Below, you can see the real Acorn logo on the left, and the “Tango”-ed version on the right.

More Tango-ed than Judith Chalmers

As you can see, the Tango version looks rather cartoonish – and the colours are rather muted and pastel. And the direction of the light source has been changed. This was all done deliberately and in order to follow the Tango guidelines.

Sam was happy with this icon and asked if I could create icons for all of the Acorn-related emulators. And that’s when sticking to the rules started to get a bit of a pain. For Tango icons, each icon should be a distinctive shape in order to help those with poor eyesight and each icon should also contain a metaphor as to the icon’s purpose.

However, for the emulators all that we really needed was a square icon with a logo that told you at a glance what computer you were using so the guidelines rather went out the window. The Tango colours were also very restrictive as far as what I could use so I just threw caution to the wind and did what I felt!

Here’s the Elkulator icon:

I really like the background grid, which was the trademark of the Acorn Electron.

Here’s the B-Em icon:

And here’s the RPCEm icon:

I also created some Archimedes artwork – here’s the Archimedes logo I created as an SVG file in Inkscape:

Click to enlarge.

Here it is “Tango”-ed!

And here are the full set of icons I created for Sam:

Click to enlarge

In future, when I have more time, I’ll create proper Tango themed icons for all of these emulators. I spent about two minutes on each of the icons above and it shows! This will require me to actually draw the systems being emulated and make sure that I’ve got a different shaped outline for each one.

So I’ll probably return to this topic when I’ve done some decent, real, Tango icons!

Lost In Translation

I’ve blogged a few times about ClapTraps, the ingenious free software puzzle game written in PyGame and Python by testpilotmonkey. The last time I blogged about it, I mentioned I was planning to add i18n (internationalisation) and a bit of l10n (localisation) to the game.

Claptraps in British English

In terms of internationalisation, what I wanted to do was to make the game multi-lingual so that on my daughters’ computer, where they use Hungarian rather than English, they would be able to play the game in Hungarian.

I had been under the mistaken impression that all I needed to do to prepare a Python script for i18n was to import the gettext library and then surround all translatable strings with the function _().

It turned out to be a little bit more complicated than that. The reason was that I wanted ClapTraps to stay self contained in a single folder rather than force the user to install it.

ClapTraps’ self-contained folder structure

Normally when GNU/Linux programs are installed on a computer, the compiled translation scripts are copied to a central location for access by all users of the computer. On Fedora GNU/Linux, that location is /usr/share/locale. Python always expects the compiled translation files to be stored there. However, I wanted my translations to remain in the ClapTraps folder.

It would have taken me quite some time to work out what to do if Mark Mruss had not already solved all the problems for me in his excellent blog post on translating Python/PyGTK programs. There’s a fantastic snippet of code there called “Translation stuff” that magically does it all!

The next step, now I had the Python script prepared, was to generate a POT (Portable Object Template) file. The POT file is the template file from which individual translations can be prepared.

The POT file for ClapTraps

It contains a header, then a list which shows the line a translatable string appears in, the id of the translatable string, and a space for the translation.

I found one problem when first creating my POT file was that it only had five strings in it! The reason was that testpilotmonkey had used single quotes for most of his strings but xgettext, the tool you use to create a POT file, only recognises double quotes.

From my POT file, I used the msginit tool to create two PO (Portable Object) files – one for en_GB (British English), the other for hu (Hungarian). Now came the really hard part – the Hungarian translation! I did this myself, but it took me three days until I was happy. The main problem was my difficulty with the imperative mood in Hungarian. Fortunately the excellent website HungarianReference.com helped enormously. My Hungarian is still a bit dodgy, but I like to think that adds to the charm.

Finished PO file with Hungarian translation

Now all I needed to do was compile my PO files in MO files and I could see if it worked. To test the game I used the LANG variable from the command language.

To force the game to run in Hungarian whilst running Fedora 13 in British English I typed LANG=hu python claptraps and….

Magyar and testpilotmonkey – a tricky combination!

Success! That was a lovely feeling. Now the next challenge was a bit of l10n. The problem I faced was that ClapTraps regularly asks the user to press Y for Yes or N for No. But in Hungarian that should be I for Igen or N for Nem. So I needed some way of changing the keys that you need to press to suit the current language.

This turned out to be quite easy – first I had to import the locale library. Next, I just needed to ask the locale class for the initial letters used for “yes” and “no” in a language like this:

# Make lists of "yes" and "no" keys for current language
locale.setlocale(locale.LC_ALL, '')
yes_keys=list(locale.nl_langinfo(locale.YESEXPR)[2:-3]);
no_keys=list(locale.nl_langinfo(locale.NOEXPR)[2:-3]);

The nl_langinfo function returns a regular expression string with the acceptable keys for Yes or No for the current locale. For English it would be:

^[yY].*
^[nN].*

For Hungarian it would be:

^[IiyY].*

^[nN].*

Note that Y is also acceptable for Hungarian. I used the Python slice operator to slice off the bits I didn’t want and then bunged the result in a variable. So now, when I want the user to press yes or no I simply do this:

while(1):
    wait_event = pygame.event.wait()
    if wait_event.type == pygame.KEYDOWN:
        if pygame.key.name(wait_event.key) in yes_keys:
        return False
    elif pygame.key.name(wait_event.key) in no_keys:
        program_quit = False
        break 
    else:
        pass

And that solves it. Since I made these changes to ClapTraps my daughters have both had hours of fun out of the game. It’s a tribute to the genius of testpilotmonkey – and Richard Stallman. For, without the GPL, I wouldn’t have been free to make these changes which allowed my children to enjoy this fantastic piece of software.

Karmic Tablets…

I’ve wanted a graphics tablet ever since I watched a pretentious little series on BBC2 (Painting With Light, 1987) where artists such as David Hockney were given the Quantel Paintbox to play with for an afternoon. They all produced a load of bobbins, but it looked such fun.

My interest was rekindled when a former colleague of mine, the multi-talented artist David “Peanut” Paramore used to bring a graphics tablet in to work with him a few years ago. The sort of work he produced with it was (and is) incredible and I really wanted to have a go at using a tablet for myself.

So, for Christmas this year, I was delighted to finally receive a Trust TB 5300 graphics tablet.  Even after I asked my parents for this, I wasn’t actually sure I’d be able to use the thing with GNU/Linux. I had visions of having to take a crash course in C and X programming in order to get the thing to work.

I needn’t have worried – the nice thing about the GNU/Linux world is that its users tend to blog about getting unusual bits and bobs working on the operating system, and this was no exception.

A blog called “Dick’s Open Source Life“, which is written by Dick Thomas, came to my rescue and thanks to this blog post I have the Trust TB 5300 working on Ubuntu Karmic Koala very happily indeed.

Both Inkscape and The GIMP work fine; even pressure sensitivity functioning as expected. I didn’t even need to callibrate the tablet as it worked fine out of the box.

In fact, the tablet even works properly when I’m running Macromedia Flash 8 via WINE.

Thanks once again for your help Dick!

Repton Through Wine

A couple of days ago I rather glibly said that the PC versions of the computer game Repton ran fine with WINE on the GNU/Linux operating system. That’s not quite true, so I thought I’d take a closer look at running Superior Interactive‘s PC versions of Repton 1, Repton 2 and Repton 3 on GNU/Linux.

WINE Is Not an Emulator

I have two computers here. They both run the GNU/Linux operating system with the GNOME desktop and have WINE installed. In case you didn’t know, WINE is the little bit of free software magic that lets you run programs written for Microsoft Windows on GNU/Linux, Mac OS, FreeBSD and Solaris. My wife’s computer runs the Fedora 12 distribution (or distro) of GNU/Linux and the free nouveau graphics driver. I’ve installed version 1.1.32 of Wine on my wife’s computer. My computer currently runs Ubuntu 9.10 (Karmic) distro of GNU/Linux with the non-free nVidia driver. It has version 1.1.35 of WINE installed.

WINE 1.1.32 is the version currently available for popular distros such as Ubuntu or Fedora, and will therefore be the version most users are running. WINE 1.1.35 is the very latest version, and instructions on how to obtain it are available here.

The PC Repton games can be run “full screen” or in “windowed” mode, in a window on your desktop. You can toggle between these modes by pressing F10.

Repton 1

On WINE 1.1.32 the game will not run properly in “full screen” mode. It will run in “windowed” mode but suffers from a couple of issues. The first is masking – the masking of sprites and the pointer does not work at all.

Repton 1 masking visible on WINE 1.1.32

The second issue is digits missing from the screen selector boxes on the main menu screen.

The boxes at the base should contain digits

On WINE 1.1.35 Repton 1 runs perfectly in “windowed” mode so if you have WINE 1.1.35 or above I can recommend Repton 1 to anyone running GNU/Linux provided you’re happy to have the game running in a window.

No masking visible on WINE 1.1.35

And the digits are present on WINE 1.1.35 too

It also runs reasonably well in “full screen” mode. The sprites are stretched, as no compensation is made for the aspect ratio of my widescreen monitor when making the display full screen. The game also suffers from the masking problems that affected Repton in “windowed” mode on WINE 1.1.32. But it does not suffer from the missing digits on the screen selector boxes that affected WINE 1.1.32.

Apart from the masking issue and the stretched sprites the game plays very well “full screen”.

The Repton 1 level and sprite editor works with no issues on both versions of WINE.

Repton 2

On WINE 1.1.32 the game will not run properly in “full screen” mode. It will run in “windowed” mode but suffers from the same masking issue as Repton 1.

Repton 1 & 2 have same mask issue on WINE 1.1.32

On WINE 1.1.35 Repton 2 runs perfectly in “windowed” mode so, again, if you have WINE 1.1.35 or above I can recommend Repton 2 to anyone running GNU/Linux provided you’re happy to have the game running in a window.

No mask issues on Repton 2 with WINE 1.1.35

It also runs reasonably well in “full screen” mode. The sprites are stretched, as again no compensation is made for the aspect ratio of my widescreen monitor when making the display full screen. The game also suffers from the masking problems that affected Repton 1 in “windowed” mode on WINE 1.1.32.

On exiting Repton 2 from full screen mode

However, unlike Repton 1, it crashes messily on exiting the program having been in full screen mode.

The level and sprite editor works with no issues on both versions of WINE.

Repton 3

The issues with Repton 3 are identical for both versions of WINE.

The game will not at all in “full screen” mode – in fact, selecting it will cause the game to crash messily. It leaves the screen at low resolution as it crashes so you have to either log out and in again.

Repton 3 in “windowed” mode

It will run in “windowed” mode, with issues. The first is that selecting “Run game in high priority mode” will cause the game to crash, and you need to reinstall the game before you can use it again.

The second is selecting the map. If you try and select the map the game will crash. So, Repton 3 will run (and run very well) in Windowed mode provided you don’t try and look at the maps.

I told you not to look at the map…

The level and sprite editor works with no issues on both versions of WINE.

Conclusions

So there you have it. Other than no full screen mode Repton 1 and 2 work well on the latest version of WINE. Repton 3 has a serious fault (the lack of maps) and more minor niggles (no full screen mode, and the crasher upon selecting High Priority mode) but other than that is perfectly playable.

If you have tried to run one of these games with WINE I’d be interested to hear how you got on.

Watching DVDs on Ubuntu

Many moons ago I published a post about my problems in playing DVDs in Ubuntu GNU/Linux. The main problem was that I simply couldn’t. Which is quite a big problem, particularly for me.

Well, now I can without going through the hoops I posted about last time. Thanks to the updated version of the Linux kernal found in the latest version of Ubuntu, the fix for UDF now actually works. To apply it you need to change a file you find in

/etc/fstab

You need root privileges to write to this file, so to get them I opened it up in the gedit Text Editor using the sudo command.

sudo /usr/bin/gedit /etc/fstab

Then I commented out the line that read:

/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto,exec,utf8 0       0

By putting a hash (#) symbol in front of it and then added a line underneath it that read:

/dev/scd0 /media/cdrom0 udf,iso9660 users,noauto,uid=0,gid=46,mode=0777,dmode=0777,nosuid,noexec 0 0

This should be all one line. Once that is done, video DVDs will actually mount, and you can actually play them.

Now I can watch DVDs just like this one!

I had another problem with video in Ubuntu, and that was Totem never seems to be able to work out the duration of a VOB or MPG video file. It thinks no MPG file is longer than about 24 seconds. Mind you, that’s about four times the average attention span these days, which is probably why the bug hasn’t been picked up yet.

I fixed this by the simple expedient of installing the excellent free software media player VLC. It particularly excels with video, and allows me to have lovely jittery interlaced fields using the Video -> Deinterlace -> Linear option.