Music Maker V1.0
;Bits-Musical Standard
;Defines Musical Note lengths and Pitchs
;Options may be added later (Tempo,Tones,Glissando,Init Duet)
;Tommy Engdahl
;—-Init port A0(or more) for digital output (PowerUp) and A2 for duet input—-
to Powerup
write $fc1 $f
clearbit 0 porta-ddr
clearbit 0 porta
clearbit 1 porta-ddr
clearbit 1 porta
setbit 2 porta-ddr
end
;—-Tuning for Musical Notation—-
constants [[g6 9][fs6 10][f6 11][w6 12][ds6 13][d6 14][cs6 15][c6 16]]
constants [[b5 17][as5 19][a5 20][gs5 22][g5 24][fs5 25][f5 27][w5 29][ds5 31][d5 33][cs5 35][c5 38]]
constants [[b4 41][as4 43][a4 46][gs4 49][g4 53][fs4 56][f4 59][w4 64][ds4 68][d4 72][cs4 76][c4 81]]
constants [[b3 86][as3 92][a3 98][gs3 104][g3 110][fs3 117][f3 125][w3 132][ds3 140][d3 148][cs3 158][c3 168]]
constants [[b2 179][as2 189][a2 200][gs2 212][g2 226]]
global [ tone ]
global [ pitch ]
global [ duration ]
global [ tempo ] ;factor on all time variables
to tick ;fundamental sound
clearbit 0 porta
setbit 0 porta
end
;—-Note—-
to Note :Pitch :Duration ; :tone might add more but will need new tuning
repeat :duration
[ tick
repeat :pitch [no-op]
]
end
:————-ROW ROW ROW YOUR BOAT (WITH ROUNDS)—————
to startup ;insert song here
;staccato method :uniform beeps with rests for note duration
;note # # rest/duration
note c3 10 mwait 500
note c3 10 mwait 500
note c3 10 mwait 500
note d3 10 mwait 250
note w3 10 mwait 500
note w3 10 mwait 500
note d3 10 mwait 250
note w3 10 mwait 500
note f3 10 mwait 250
note g3 10 mwait 1000
duet
note c4 10 mwait 166
note c4 10 mwait 166
note c4 10 mwait 166
note g3 10 mwait 166
note g3 10 mwait 166
note g3 10 mwait 166
note w3 7 mwait 166
note w3 7 mwait 166
note w3 7 mwait 166
note c3 5 mwait 166 ;compensation for note period
note c3 5 mwait 166
note c3 5 mwait 166
note g3 10 mwait 500
note f3 10 mwait 250
note w3 10 mwait 500
note d3 10 mwait 250
note c3 10 mwait 1000
end
;—-Duet Algorithm—-
to duet ;trigger starts a duet
clearbit 1 porta
; setbit 1 porta
end
;listens to start duet
if (testbit 2 porta) [startup]
Looping Row Your Boat
It took a while to get this to work. You need at least 3 devices. You also need to make sure they all have a “common ground” and they are all turned on within 10sec of each other. There is also a master or starting version to the program so that the one primary device will start the loop.
;Bits-Musical Standard
;Defines Musical Note lengths and Pitchs
;Options may be added later (Tempo,Tones,Glissando,Init Duet)
;Tommy Engdahl
;—-Init port A0(or more) for digital output (PowerUp) and A2 for duet input—-
to Powerup
write $fc1 $f
clearbit 0 porta-ddr
clearbit 0 porta
clearbit 1 porta-ddr
clearbit 1 porta
setbit 2 porta-ddr
wait 100
flash
;startup ;add this for master
loop [if (testbit 2 porta) [startup]]
end
;—-Tuning for Musical Notation—-
constants [[g6 9][fs6 10][f6 11][w6 12][ds6 13][d6 14][cs6 15][c6 16]]
constants [[b5 17][as5 19][a5 20][gs5 22][g5 24][fs5 25][f5 27][w5 29][ds5 31][d5 33][cs5 35][c5 38]]
constants [[b4 41][as4 43][a4 46][gs4 49][g4 53][fs4 56][f4 59][w4 64][ds4 68][d4 72][cs4 76][c4 81]]
constants [[b3 86][as3 92][a3 98][gs3 104][g3 110][fs3 117][f3 125][w3 132][ds3 140][d3 148][cs3 158][c3 168]]
constants [[b2 179][as2 189][a2 200][gs2 212][g2 226]]
global [ tone ]
global [ pitch ]
global [ duration ]
global [ tempo ] ;factor on all time variables
to tick ;fundamental sound
clearbit 0 porta
setbit 0 porta
end
;—-Note—-
to Note :Pitch :Duration ; :tone might add more but will need new tuning
repeat :duration
[ tick
repeat :pitch [no-op]
]
end
:————-ROW ROW ROW YOUR BOAT (WITH ROUNDS)—————
to startup ;insert song here
;staccato method :uniform beeps with rests for note duration
;note # # rest/duration
note c4 10 mwait 500
note c4 10 mwait 500
note c4 10 mwait 500
note d4 10 mwait 250
note w4 10 mwait 500
note w4 10 mwait 500
note d4 10 mwait 250
note w4 10 mwait 500
note f4 10 mwait 250
note g4 10 mwait 1000
setbit 1 porta ;duet
;clearbit 1 porta
note c5 10 mwait 166
note c5 10 mwait 166
note c5 10 mwait 166
note g4 10 mwait 166
note g4 10 mwait 166
note g4 10 mwait 166
note w4 7 mwait 166
note w4 7 mwait 166
note w4 7 mwait 166
note c4 5 mwait 166 ;compensation for note period
note c4 5 mwait 166
note c4 5 mwait 166
note g4 10 mwait 500
note f4 10 mwait 250
note w4 10 mwait 500
note d4 10 mwait 250
note c4 10 mwait 1000
clearbit 1 porta
end
;—-Duet Algorithm—-
to duet ;trigger starts a duet
; setbit 1 porta
end
;listens to start duet
if (testbit 2 porta) [startup]