Example Music for the Picaxe
There are three commands in Picaxe Basic that you can use for making sounds/music on the Picaxe. I posted my code as a file attachment, and there are some examples from the code below.
Note that on the Picaxe-08 models, you need to use Output 2 for the play and tune commands.
The 'play' command lets you play one of a few stored music samples.
Available tunes are:
0 - Happy Birthday (All parts)
1 - Jingle Bells (All M & X2 parts)
2 - Silent Night (08M only)
3 - Rudolph the Red Nosed Reindeer (08M only)
play soundpin, 0 'plays pre-set tune 0-3. Happy Birthday is all the Picaxe 28x1 has
The 'tune' command lets you encode a series of musical notes. The Picaxe Editor includes a Tune Wizard that can help, but for the two I've created, I rolled my own. If you can find the musical notes for a tune you want online somewhere, you can code the song for the Picaxe.
'To get the spaceships' attention prior to their arrival at Devil's Tower,
'the five notes the scientists play are G, A, F, (octave lower) F, C.
'When they arrive at the tower and are attempting communication,
'the notes they play are B flat, C, A flat, (octave lower) A flat, E flat.
'Flat notes are the same as the sharp (#) of the previous note
tune soundpin,12,(7,9,5,37,192) 'plays Close Encounters tune
The 'sound' command is good for simple beeps and buzzes.
let b0 = b0 + 1
if b0 = 126 then return