music.txt


\ music 97.9.9 9:15 pm NAB

include sound

variable volume
variable duration
variable octave
variable tempo

: o  octave ! ;
: v  volume ! ;
: t  tempo ! ;

: whole  1000 duration ! ;
: half  500 duration ! ;
: quarter  250 duration ! ;
: eighth 125 duration ! ;
: sixteenth  62 duration ! ;
: dot  duration @ 2/ duration +! ;

: reset  64 v  1 o  1 t  quarter ;
reset

: note  create ,
  does> @  volume @
  duration @ tempo @ /
  rot 1 octave @ lshift  * sound ;

493 note B
467 dup note Bb note A#
440 note A
418 dup note Ab note G#
392 note G
371 dup note Gb note F#
349 note F
330 note E
312 dup note Eb note D#
294 note D
278 dup note Db note C#
262 note C
32000 note rest


  HTMLized by Forth2HTML