Willy-Longwalk.gif (4471 bytes)Willy-Longwalk.gif (4471 bytes)
A Miner Triad

Back ] JSW Remakes Home ] Up ] Next ]
JSW1-bathroomfloor.gif (1468 bytes)


visitors to
this page since
21-09-2000

 

Discussions

View Guestbook
Sign Guestbook


decoboot.gif (4103 bytes)


A Miner Triad

Music in Jet-Set Willy and both versions of Manic Miner

by Richard Hallas (author of Join the Jet-Set! and Jet-Set Willy in Space)

Introduction

I was never a great Spectrum hacker, as I didn't have the time in my childhood to get into machine code and hack games in a big way. However, I did dabble to a certain extent with games that particularly interested me, and the game that captivated me above all was Jet-Set Willy.

Of course, there was a veritable deluge of hacks for this game in the various magazines shortly after it was launched, with Your Spectrum and Crash devoting large sections of their pages to maps and the latest weird and wonderful POKEs. The room format was discussed, and it wasn't long before game editors appeared. Undoubtedly the best of these was JetSet Edit by Paul Rhodes, which I used to create both of my JSW games.

So, the editors and POKEs, between them, allowed you to customise the room layouts and graphics, and even to alter the behaviour of Willy; effectively, you could create whole new games. It seemed strange, therefore, that none of the magazines or editors ever touched on one other important aspect of the Willy games: their music.

Despite not being much of a hacker back in the 80s, I did manage to achieve one work of distinction that no other JSW hacker (to my knowledge) ever attempted: I succeeded in editing the in-game music, and for Join the Jet-Set! I presented the player with a choice of ten different tunes. (Later, for Jet-Set Willy in Space, I did a rendition of the Star Trek: Voyager theme music, and tunes of mine have turned up in other people's JSW games.)

Since a number of JSW-clone authors have expressed an interest in various aspects of the Willy game music, I have extended my investigations, and this document is the result. It explains how to alter the in-game music in both Jet-Set Willy and Manic Miner (both Bug-Byte and Software Projects versions), and in addition it explains how to change the music which accompanies Jet-Set Willy's title screen. Finally, it reveals a number of interesting potential tricks which, at the time of writing, have not yet been employed in any genuine Willy game.

This document does not concern itself either with the title screen music in Manic Miner, or any aspect of music in Jet-Set Willy II.

Basic tone chart

All the music under discussion here is based around a simple tone chart. One byte is used per note, and the value of each byte corresponds to a pitch as follows:

X C 16
B 17
# 18
A 19
# 20
G 22
# 23
F 24
E 25
# 27
D 29
# 31
High C 32
B 34
# 36
A 38
# 40
G 43
# 45
F 48
E 51
# 54
D 57
# 60
Top C 64
B 68
# 72
A 76
# 81
G 86
# 91
F 96
E 102
# 108
D 115
# 121
Middle C 128
B 136
# 144
A 153
# 162
G 171
# 180
F 192
E 204
# 216
D 230
# 242
Bottom C 255 (in-game music) or 0 (title-page music)
X C 0 (in-game music only)

The most comfortable range for music should be centred around the Middle and Top octaves. At the extremes of pitch, notes become unpleasant, hard to distinguish and increasingly out of tune. In the chart, 'X' denotes the very extreme of the range, and # indicates a 'between note' (a semitone, or a black key on a musical keyboard).

When considering the above chart, Middle C should be thought of as the tonic (or 'root') for your tune, and you can think of it like middle C on a piano. It should be made clear, though, that in the context of these games the Spectrum is a 'transposing instrument': Middle C here is in fact the F# above middle C on a real piano. Unless you have perfect pitch, however, this shouldn't be a cause for concern.

If you examine the chart you will see that the notes follow a simple logarithmic scale: take any note value and double it, and you will get the same note an octave lower; halve it and you will obtain the octave higher. This is of course a very simplistic system, and the absence of floating-point values means that it soon breaks down, and the notes go out of tune. Indeed, nearly all of the notes are out of tune to some extent, and it's really not feasible to write music in 'keys'; if you wish to transcribe a real melody, you should first transpose it into C (assuming it's not in C to start with) and then transcribe it into the decimal integers given above.

With these tuning inadequacies in mind, you should treat the above tone chart with a small degree of flexibility, and consider its notes as theoretical ideal values. Depending on the nature of your melody, and the register in which it is playing, you may find it necessary to de-tune individual notes very slightly to compensate for the lack of numeric resolution. The chart above should be considered as an 'equal temperament' solution: it will give you the best note when considering the whole range of notes available, just like a piano will always give you the same note without taking the key into account. If you were playing an unequally tempered instrument, though (such as the violin, for example), you would make adjustments of fractions of a tone in order to tune notes correctly for the current key and/or context. The same applies here: you may find it necessary to add or subtract 1 to any given note value in order to make it sound right. A discerning musical ear (and an accurate Spectrum emulator!) is necessary to do this well.

The following sections all rely on the above tone chart.

In-game music

This is the 'blippy' music that cycles continuously as the game is being played.

64 notes are available for the melody: no more; no fewer. Your melody must, therefore, be of a suitable nature to be squeezed into this shape, which means that it really must have either two or four beats in a bar.

Simple tunes often have an A1-A2-B-A1 structure (where A1 and A2 may or may not be slightly different), or something equally straightforward. Such tunes generally adapt well to being in-game music. Often it is possible to fit an entire tune of this structure into an in-game melody (though, to be fair, you may also discover that you have only enough notes for half of the tune that you'd like to use!).

The best way to start transcribing a melody into an in-game tune is to quantise it. What is the shortest note that you need to represent? It may be a crotchet, in which case you can have a relatively lengthy tune which plays very quickly (but which may be difficult for the player to discern). It's more likely to be a quaver, however. This means that most of the notes in your melody, the crotchets, must be represented by repeated pairs of note in the in-game tune. (Minims would be four repeated notes, and so on.) Assuming that one game-tune note equates in length to a quaver, you will find that your 64 notes can be divided into four 8-crotchet phrases.

So, once you have written a simple tune, or adapted a real melody, to fit into 64 notes, the tone chart above should be used to determine the values to poke into the appropriate locations in the game code. The addresses are different for all three games, and are as follows:

Game Tune addresses (Hex)
Manic Miner (Bug-Byte) 34188 to 34251 &458C
Manic Miner (Software Projects) 34194 to 34257 &4592
Jet-Set Willy 34399 to 34462 &465F

The addresses are in the Spectrum memory map, and can be POKEd directly from Spectrum Basic. The Hex addresses represent the start of the melody within a SNA-format snapshot, and may be of use to people with emulator snapshot disassemblers and memory monitors. (SNA-format snapshots exclude the first 16384 bytes of the Spectrum's memory, and so their addresses are &4000 less than the 'real' Spectrum memory addresses.)

Special note

Using a value of 0 in the in-game melody produces a 'fundamental' C which is very low indeed (an octave below the C produced by the value 255).

Jet-Set Willy title screen music

JSW's title screen music is played in an unusual way: one note in memory actually produces two notes when sounded. JSW plays each note at the pitch specified, and then doubles the value to play the same note an octave lower. By default, the title music (the first part of Beethoven's Moonlight Sonata, prematurely cut off) is of a rather odd length of 99 notes, starting at address 34299 (&45FB). For reference, the default music is as follows:

99 notes, addresses 34299 to 34397:

 81,  60,  51,    81,  60,  51,
 81,  60,  51,    81,  60,  51,
 81,  60,  51,    81,  60,  51,
 81,  60,  51,    81,  60,  51,

 76,  60,  51,    76,  60,  51,
 76,  57,  45,    76,  57,  45,
 81,  64,  45,    81,  60,  51,
 81,  60,  54,    91,  64,  54,

102,  81,  60,    81,  60,  51,
 81,  60,  51,    40,  60,  40,
 40,  54,  45,    81,  54,  45,
 81,  54,  45,    40,  54,  40,

 40,  60,  51,    81,  60,  51,
 38,  60,  45,    76,  60,  45,
 40,  64,  51,    81,  64,  51,
 45,  64,  54,    32,  64,  54,

 61, 121,  61

The note values should be poked into the addresses in just the same way as for the in-game music, but with a few important extra considerations.

Notes of value 128 and less (i.e. higher notes) produce the specified note plus the octave below it, as expected. However, notes of value greater than 128 (lower notes) do not produce the octave effect, but instead produce a second, consonant tone. The possible results can be presented in a table, as follows:

136 = B + X C (16)
144 = A# + High C (32)
153 = A + Top E (50) *
162 = G# + Middle B (68)
171 = G + Middle G (86)
180 = F# + Middle E (104) *
192 = F + Middle C (128)
204 = E + Bottom A (152) *
216 = D# + Bottom F# (176) *
230 = D + Bottom E (204)
242 = C# + Bottom D (228) *
0 = C + unity (produces double-length held note)

* These notes are slightly out of tune (but not enough to be very noticeable).

These lower notes can therefore be used cleverly to produce extra notes in the tune, or to imply harmonies, and to get away from the constant octave-doubling effect.

The reason that this happens is that the player routine plays the note at pitch, then doubles its value and plays it again to get the note which is an octave lower. For notes below 128 (i.e. with values which are greater), doubling obviously creates a number which is greater than 255 (256 maps to 0), and so the second note is double the value of the first note, modulus 256. So, for example, playing Bottom F (192) gives a secondary note of value (192 x 2) - 256 = 384 - 256 = 128 (which is Middle C).

Variable-length melodies

Using a value of 255 in the title page music causes the tune to stop playing. This can be useful if you don't want your tune to have to be 99 notes long (which is an awkward length in any case). In fact, if you can stand the constant flashing, you can poke 34299 (the first title music note) with 255 to eliminate the title music altogether and just end up with a continuously scrolling 'scenario' message and flashing title screen.

Super-long combined melodies

Interestingly, if you compare the addresses of the title music and the in-game music in Jet-Set Willy, you will find that they are stored consecutively in memory: the title music goes from 34299 to 34397, and the in-game music from 34399 to 34462, with a single byte, value 255, separating them at address 34398.

As explained above, the value of 255 is used to terminate the play routine, so if another value is poked into address 34398, the title music player simply plays the note you have poked in, and continues on to play the in-game music.

However, a value of 255 then needs to exist at the end of the in-game music in order to stop the title page play routine. (If there's no 255 within the music, the play routine will go on to 'play' the data following the tunes! It soon encounters a 255 and stops anyway, but it sounds pretty awful until then, and so should be avoided.) With clever composition, therefore, it would be possible to produce a 163-note title page tune (the 164th note needs to be the 255 end-marker, which is bottom C to the in-game play routine), the latter 64 notes of which are used as the in-game music.

If you decided to do this, therefore, you would have to avoid the use of Bottom C (255) in the in-game music until the very last note. This is slightly annoying, because the pitch produced by Bottom C (255) with the in-game player is actually the same as the pitch produced by value 0 in the title music player. Using the value 0 in the in-game music produces 'fundamental C', which is an octave lower. So, the note that you are prevented from using in the in-game music is not actually the very lowest note available.

Document produced by Richard Hallas, BMus(Hons), 1/9/98


Back ] JSW Remakes Home ] Up ] Next ]

View the JSW Remakes Guestbook Sign the JSW Remakes Guestbook

JSW1-bathroomfloor.gif (1468 bytes)
From the original location of Gawp's Jet Set Willy Pages

Last updated: September 12, 2001.

Thanks to Emulation Unlimited for providing the web space.
willy3.gif (249 bytes) eulogo.gif (19565 bytes) Willy3reflected.gif (285 bytes)