A Spectrum symphony
It doesn’t often find its way into lists of the most influential books of the 20th century, but the ZX Spectrum BASIC programming manual has to be up there, for putting countless thousands of youngsters on the path towards a future career in computers.
Matt Westcott revisits this great work with a particular ambition in mind…
Everything about the Spectrum’s design invited curiosity about programming. Switching on the computer would drop you into the BASIC environment, where pressing a key would immediately produce a corresponding keyword like PLOT or NEW – all helpfully printed on the keyboard. Even if you were only there to play games, you still had to negotiate your way to typing LOAD “”, and get a taste of talking to the computer in commands. (If you could tell it to play a game, what else could you tell it to do…?) The Spectrum manual took this spark of curiosity and ran with it, giving its readers a gentle, accessible introduction to the world of programming.
Chapter 19 of the manual introduced readers to the Spectrum’s modest sound capabilities. A command like BEEP 1,0 would produce a single electronic tone from the Spectrum’s built-in speaker. String enough of these commands together, with different numbers corresponding to different note lengths and pitches, and you could pick out a melody, as the manual demonstrated with a few bars of a theme from Mahler’s first symphony (bearing a certain resemblance to Frere Jacques).
Assembling a complete tune like this was painstaking work, hunched over that rubber keyboard with a page of sheet music and a chart of note values – and so it was with a cheeky sense of humour that the author added an ‘Exercise’ at the end of the chapter:
Program the computer so that it plays not only the funeral march, but also the rest of Mahler’s first symphony
Even if anyone had the patience to attempt this back in the day, they would almost certainly have run into the Spectrum’s memory limitations. Feats of extreme patience were nothing unusual to Spectrum programmers, though: creating any kind of fast-paced arcade game meant leaving behind the friendly world of BASIC programming in favour of low-level machine code, where a simple programming error could crash the computer entirely and force the programmer to load their work in from tape all over again. In the early days, before programming tools had been perfected, entire games like Sandy White’s 3D Ant Attack were written entirely on paper and then keyed into the computer as thousands of hex codes…
Like the rest of us, those programmers moved on to better, faster, friendlier computers, and were probably quite glad to gain the conveniences of hard disks and real text editors. For hobbyists like me who still do Spectrum programming for fun, though, it’s the best of both worlds – thanks to those home comforts, the internet, and 30 years of accumulated knowledge about the Spectrum’s hardware, it’s possible to tackle these technical challenges without needing the patience of a saint. And that brings us to a December afternoon in 2014 at the Museum of the History of Science, where we’ll attempt to turn that jokey comment in the manual into a reality, and host a ZX Spectrum performance of Mahler’s first symphony.
Taking that challenge on today, we have the distinct advantages of an internet where classical music is readily downloadable in the form of MIDI files, and modern computers that can do the number-crunching to turn them into our desired format. Nevertheless, the resulting programs are things that someone could – in theory – have typed into their Spectrum back in 1982.
We’re doing it with a 21st century twist though: at the event I’ll be joined by Dylan Smith, creator of the Spectranet interface which plugs into the back of a Spectrum and allows you to hook it up to the internet. We’ll be using these interfaces to link up the Spectrums and allow them to keep time with each other. That way, we’ll be able to play not just the melody, but the whole orchestral arrangement – and hopefully, arrive at a result which does justice to both Clive Sinclair and Gustav Mahler!
See Matt program, perform, and conduct this incredible feat at our Geek Out! event on Saturday 6 December, 10am-5pm.
Matt Westcott is Oxford-based web developer, demoscener and Spectrum obsessive, dedicated to making technology do stuff that it patently shouldn’t.