Code for Algo 1
\ Copyright (c) 1995 Adam Nelson
\ include assigns
\ include hsys:debugger
: bang
80 midi.noteon 4 delay midi.lastoff
;
: validate_degree
\ make sure new scale degree is within 0..23
dup
0 <
if drop 0
then
dup
21 >
if drop 21
then
;
: rnote
\ get a random distance of either 1 or 2 scale steps
2 choose 1 +
\ get a random direction
2 choose
0=
if negate
then
+ validate_degree
dup
\ now play the scale degree on the stack!
Case
0 of 48 endof \ C
1 of 50 endof \ D
2 of 52 endof \ E
3 of 53 endof \ F
4 of 55 endof \ G
5 of 57 endof \ A
6 of 59 endof \ B
7 of 60 endof \ C
8 of 62 endof \ D
9 of 64 endof \ E
10 of 65 endof \ F
11 of 67 endof \ G
12 of 69 endof \ A
13 of 71 endof \ B
14 of 72 endof \ C
15 of 74 endof \ D
16 of 76 endof \ E
17 of 77 endof \ F
18 of 79 endof \ G
19 of 81 endof \ A
20 of 83 endof \ B
21 of 84 endof \ C
Endcase
bang
;
: my.init
hmsl.init
user.init
;
: my.term
user.term
hmsl.term
;
: many.rnotes ( --, play many random notes )
CR
CR ." Hi! Please ignore all text up to this point. As you can see, HMSL,"
CR ." while fun to use, comes with some baggage. For example, can you"
CR ." believe this file is 368K! Anyway, press any key to exit. Feel free"
CR ." to select other MIDI instruments. I start with #90, because the Warm"
CR ." Pad seems to work well with this algorithm."
CR
CR ." (C) 1995 Adam Nelson
90 midi.preset
0
begin
rnote
?TERMINAL
until
;
Return to Music page
Return to Top of Supreme Infotrainschedule
algo_6 @ tappedin.com