Making noise with the PICAXE-08M
I've been playing around recently with microcontrollers. Any old school programmers who grew up programming a TV computer with a ZX-80 inside will feel very comfortable with the PICAXE-08M. The visual output is generally limited to LEDs or seven-segment displays, and input comes in just a handful of digital and analog pins. They're easy to program in a modern version of BASIC that eschews the monstrous line numbers in favor of labels.
The PICAXE comes with a handful of sound generating commands, like tune and play and sound, but these are basically canned. Play is the worst offender as it can literally only play one of four preset songs, and I'm not such a big fan of Rudolph the Red-Nosed Reindeer.
So, I'm experimenting with different ways to make tuneful noise from my PICAXE.
pwm: makes really strange noise, like sferics. Sounds a lot like electronic noise. Drop the values of b1 and b0 to something lower to get more musical tones.
main:
for b1=0 to 255
for b0=0 to 255
pwm 2, b0, 1
let b0 = b0 + b1
next b0
next b1
goto main
pulsout: Can be made to sound flatulent or percussive, depending on the highest value of b0. If you set it high, then you get long farts. If you keep it low, you get percussive noises.
main:
for b1 = 1 to 64
for b0 = 0 to 16
pulsout 2, b1
pause b0
next b0
next b1
goto main
let pins: deep, drony, with harmonics. Make sure to run diodes from the output pins to the speaker to avoid damaging the PIC
main:
output 1, 4
pins = %00000000
let b2 = 0
let b3 = 1
goto pin_loop
pin_loop:
for b1 = 0 to 16
for b0 = 1 to 64
pins = %00001010
pause b1
if b2 >= b3 then
pins = %00000000
let b2 = 0
else
let b2 = b2 + 1
pins = %00001000
endif
pause b1
next b0
next b1
let b3 = b3 + 1
goto pin_loop
These are good starting points for your own noise-making programs. Each one leaves plenty of room for adding extra code, perhaps a memory bank with values corresponding to different scales of notes. I'd be very interested in seeing what others were able to come up with.