Example Music for the Picaxe

musicgclef.jpg

sound_examples.bas (1724Bytes)

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)

Example:

bday:
play soundpin, 0 'plays pre-set tune 0-3. Happy Birthday is all the Picaxe 28x1 has
return


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.

Example:

encounter:
'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

return

 


The 'sound' command is good for simple beeps and buzzes.

 

Examples:

buzzer:
sound soundpin,(237,10)
pause 100
sound soundpin,(247,10)
pause 100
sound soundpin,(177,10)
pause 10
low soundpin
return

rising:
let b0 = b0 + 1
sound soundpin,(b0,50)
pause 100
if b0 = 126 then return
endif
goto rising

 

I only discovered LMR a few

I only discovered LMR a few days ago, and the mention of the 08m and Close Encounters here made me sign up. I just HAVE to mention my project HERE.

I’m just planning my first robot project, but can’t quite decide what form it’s to take. So many ideas, so much food for thought on LMR.

Andy.

Welcome to LMR!

I have to laugh… I’ve read your project on Instructables just before starting on Blind Lemon. It was inspirational. I’m glad to see you on LMR.

FYI, your version of the Encounters theme sounds better than mine. ; j

There are lots of interesting robot ideas here, many using the 08 or other Picaxe processors. Arduino and other processors are popular too.

The start here robot is a good walkthrough for a basic robot, if you are interested.

I can’t wait to see what ideas you come up with.