New book out now – The Science of Music

The Science of Music

My 5th and latest contribution to the “Hot Science” series from Icon Books has just been published, The Science of Music: How Technology has Shaped the Evolution of an Artform. This is a book I’ve written about a couple of times previously (here and here) – but not to be confused with The Science of Sci-Fi Music, which is a completely different book that I wrote a few years ago!

Here is the publisher’s blurb for the new book:

How can music – an artform – have anything to do with science? Yet there are myriad ways in which the two are intertwined, from the basics of music theory and the design of instruments to hi-fi systems and how the brain processes music. Science writer Andrew May traces the surprising connections between science and music, from the theory of sound waves to the way musicians use mathematical algorithms to create music. The most obvious impact of science on music can be seen in the way electronic technology has revolutionised how we create, record and listen to music. Technology has also provided new insights into the effects that different music has on the brain, to the extent that some algorithms can now predict our reactions with uncanny accuracy, which raises a worrying question: how long will it be before AI can create music on a par with humans?

Science of Music playlist

Science of Music videos

My new book The Science of Music will be published by Icon Books on 16 March 2023. I’ve already alluded to some of the musical works used as examples in the book (in this post from last year) and there’s a fuller “playlist” in the back of the book – running in chronological order from Mozart’s Dissonance Quartet and Beethoven’s Battle Symphony to Miss Anthropocene by Grimes and Djesse vol. 3 by Jacob Collier.

On a more self-indulgent note, I’ve created another short playlist on YouTube of compositions I wrote myself while trying to get my head round some of the techniques discussed in the book – particularly algorithmic (i.e. computer-assisted) composition and electronic music production using a DAW (Digital Audio Workstation). Here is a link to it:

Out Now: The Science of Sci-Fi Music

The Science of Sci-Fi Music

My latest book has just been published! It’s my fourth contribution to the “Science and Fiction” series from Springer, following on from Pseudoscience and Science Fiction (2017), Rockets and Ray Guns (2018) and Fake Physics (2019). This one is called The Science of Sci-Fi Music, and here’s the back-cover blurb:

The 20th century saw radical changes in the way serious music is composed and produced, including the advent of electronic instruments and novel compositional methods such as serialism and stochastic music. Unlike previous artistic revolutions, this one took its cues from the world of science.

Creating electronic sounds, in the early days, required a well-equipped laboratory and an understanding of acoustic theory. Composition became increasingly “algorithmic”, with many composers embracing the mathematics of set theory. The result was some of the most intellectually challenging music ever written – yet also some of the best known, thanks to its rapid assimilation into sci-fi movies and TV shows, from the electronic scores of Forbidden Planet and Dr Who to the other-worldly sounds of 2001: A Space Odyssey.

This book takes a close look at the science behind “science fiction” music, as well as exploring the way sci-fi imagery found its way into the work of musicians like Sun Ra and David Bowie, and how music influenced the science fiction writings of Philip K. Dick and others.

The Science of Sci-Fi Music is available from all the usual places, such as Amazon.com or Amazon UK, either as a paperback or an ebook.

To give a flavour of the contents, here’s a link to a short video preview of the book:

Algorithmic Beatles

Markov music matrix

When Eric Morecambe mangled Grieg’s Piano Concerto on a TV special in 1971, he insisted he was “playing all the right notes, but not necessarily in the right order”. That’s a valid point, because there aren’t that many different notes on a piano and the only thing that distinguishes one tune from another is the order in which you play them.

To a mathematician or computer programmer the situation is crying out for quantitative analysis. The diagram above shows the “transition matrix” for one specific Beatles tune (using the MIDI standard where middle C is C5). It’s clear there’s a lot of order here. One thing that jumps out is that there’s only one “black” note, G#5, and it’s always followed by A5. In fact A5 is a very popular note, cropping up after no fewer than 8 different pitches. On the other hand, G#5 itself is very rare, only ever coming after D6, and then only 6% of the time.

As well as analysing the original tune, this allows us to write a new tune of our own using the same transition matrix. The result (as the aforementioned mathematicians and computer programmers will recognize) is a first-order Markov chain. Producing an algorithm of this type from scratch would be rather tedious (as indeed the initial analysis would be), but fortunately there’s some free software called OpenMusic which includes built-in Markov functions that make the process much simpler.

Of course, there’s more to a tune than the pitch of the notes – there’s the duration of a note too. But that can be analysed and reproduced by exactly the same method. I experimented with an algorithmic composition of my own, based on the Beatles song analysed above. As a first step, I used the OpenMusic Markov functions to generate a series of tune-fragments for both the “right hand” and “left hand” of the piano. Then, to give the composition some structure, I arranged the fragments in a rough approximation to classical sonata form.

I won’t say what the original song was, because I want to see if anyone can guess it. As a hint, I’ve inserted a brief quotation from the original at the mid-point of the piece. Here it is on YouTube: