Resource centre for ZX Spectrum games
      using Manic Miner and Jet Set Willy game engines

 

Archive of the

Manic Miner & Jet Set Willy Yahoo! Group

messages

 

 

 

Message: 4401

Author: andrewbroad

Date: 21/08/2004

Subject: Re: How to code up a MM/JSW tune

 

dasse68 wrote:

>
> I very simplistic question.. How do you make your own tunes? :)
> I mean in both MM & JSW

I plan to write a MM/JSW music-editor one day, but this is how I
currently code up a MM/JSW tune:

1. Use a piano to work out the notes, and write them down using
pencil & paper, e.g. C a# g g# a# C D D# G F...

2. Work out the durations of the notes, e.g. 4C 6a# (4/3)g (2/3)g#
(4/3)a# (2/3)C (4/3)D (2/3)D 4G 6F...

For the MM:AT title-screen tune I used a metronome to help me get
the rhythm right, but I still had to adjust the durations after my
first attempt at coding it up.

3. Look up the byte-values for the pitches using Richard Hallas's
tone-chart (in his document "A Miner Triad" - see sig. for URL),
e.g. 128, 144, 171, 162, 144, 128, 115, 108, 86, 96, ...

4. Write a BASIC program to poke these values into the game. For a
Manic Miner in-game tune, it might look something like this:

5 CLEAR 32767: LOAD "" CODE: REM insert TAP file for game
10 FOR a=34188 TO 34251
20 READ b
30 POKE a,b
40 NEXT a
100 DATA 128,128,128,68,68,64,81,81,81,76,76,86
110 DATA 128,128,128,68,68,64,72,72,72,76,76,81
120 DATA 128,128,128,68,68,64,72,64,72,76,76,81
130 DATA 128,128,128,68,68,64,72,72,72,76,76,81

Please note that the address-range in Line 10 applies only to the in-
game tune in the Bug-Byte edition of Manic Miner. See "A Miner
Triad" for the other address-ranges.

And here is the program I used to code up the MM:AT title-screen
tune:

10 FOR a=33902 TO 34186 STEP 3
20 READ d: IF d=255 THEN GO TO 150
30 POKE a,d*60: REM 60 is the unit duration
40 READ p: IF p>255 THEN POKE a+1,p/10: POKE a+2,p/10: GO TO 60
50 POKE a+1,p: POKE a+2,p+1
60 PRINT d;",";p;" -> ",
70 PRINT PEEK a;",";PEEK (a+1);",";PEEK (a+2)
80 NEXT a
99 REM Title-screen tune in (duration,pitch) pairs
100 DATA 4,128,3,144,3,144,1.33,171,0.67,162,1.33,144,0.67,128,
1.33,115,0.67,108,4,86,3,96,3,96
110 DATA 1.33,96,0.67,86,1.33,96,0.67,108,1.33,128,0.67,162,4,128,
3,144,3,144
120 DATA 1.33,171,0.67,162,1.33,144,0.67,128,1.33,115,0.67,108,4,72,
4,72,4,720,4,720
130 DATA 4,72,3,81,3,81,1.33,86,0.67,81,1.33,86,0.67,96,1.33,108,
0.67,115,4,96,3,108,3,108
140 DATA 2,128,2,115,2,108,2,64,4,72,2,86,4,108,4,96,4,108,4,108,255
150 POKE a,255: LET a=a+1: IF a<34187 THEN GO TO 150

Notes:

1. The data are specified in (duration,pitch) pairs, which the
program converts to the required (duration,pitch,pitch) triples by
adding 1 to the `red' pitch to derive the `cyan' pitch.

2. The durations are specified in units which are converted to bytes
by multiplying by the unit duration (60). The speed of the tune can
be varied by editing Line 30, although if this generates values
greater than 255, the data will have to be adjusted too, by
splitting long notes into two shorter notes (e.g. in Line 100 I had
to change 6,144 to 3,144,3,144).

3. I fudged the program to allow rests to be specified by pitches
outside the byte-range (0 to 255). When the program sees an out-of-
range pitch in the data (e.g. 720 at the end of Line 120), it
divides it by 10 and sets both pitch-bytes to that value (72,72).

4. The program recognises a duration of 255 as the terminator for
the title-screen tune, and pads out the rest of it with 255s.

--
Dr. Andrew Broad
http://www.geocities.com/andrewbroad/
http://www.geocities.com/andrewbroad/spectrum/
http://www.geocities.com/andrewbroad/spectrum/willy/
http://www.geocities.com/andrewbroad/spectrum/willy/music.html

 

 

arrowleft
arrowright