Radio K-THUD, The station with jazz performed by Robots.
REM K-THUD BY NOTEJAM
dim scale(30):dim pik(20):pick=0
scale(0)=48:scale(1)=50:scale(2)=52:scale(3)=53:scale(4)=55
scale(5)=57:scale(6)=58:scale(7)=60:scale(8)=62:scale(9)=64
scale(10)=65:scale(11)=67:scale(12)=69:scale(13)=70:scale(14)=72
scale(15)=74:scale(16)=76:scale(17)=77:scale(18)=79:scale(19)=81
scale(20)=82:scale(21)=84
pik(0)=1:pik(1)=1
dim no(8)
no(0)=3:no(1)=3:no(2)=3:no(3)=3:no(4)=3
no(5)=6:no(6)=6:no(7)=6:no(8)=8
Dim Ryth(20)
ryth(0)=400:ryth(1)=400:ryth(2)=200:ryth(3)=200:ryth(4)=100
Load Dll "WINMM.DLL",1
HANDLE = Make Memory(4)
PORT=0:REM CHANGE TO PORT YOU DESIRE -1=MIDIMAPPER, 1 TO ? = YOURS
CALL DLL 1,"midiOutOpen",HANDLE,PORT,0,0,0
rem to get the handle of the Midi Out port:
HMO As DWORD
HMO = *HANDLE
INSTRUMENT=7
In:
event = 192
INSTRUMENT=INSTRUMENT+1:REM pick a instrument
CLS
PRINT " YOU ARE LISTENING TO K-THUD"
PRINT " THE RADIO STATION WITH JAZZ PLAYED BY ROBOTS"
PRINT " NOW PLAYING INSTRUMENT ";INSTRUMENT
IF INSTRUMENT>127 THEN INSTRUMENT=0
lo = (INSTRUMENT*256)+event
Message=lo+hi
Call Dll 1, "midiOutShortMsg", HMO, Message
Here:
for x=1 to 45
r=rnd(8)
n=no(r)
pick=pick+rnd(n)-rnd(n):rem pick always 0 to start, then set 4 next time
if pick < 4 then pick = 4
if pick > 21 then pick = 21
note=scale(pick)
check=rnd(6)
if check=1 then note=note+1
if check=2 then note=note-1
if note=na and note=nb and note=nc then goto here
nc=nb:nb=na:na=note
de=ryth(rnd(4))
event = 144
lo = (note*256)+event
rest=rnd(6)
if rest=1 then vel=0:goto rest
vel = 127
rest:
hi=vel*65536
Message=lo+hi
rem put it out
Call Dll 1, "midiOutShortMsg", HMO, Message
WAIT de
EVENT=144
VEL=0
LO=(NOTE*256)+EVENT
HI=VEL*256
Message=lo+hi
CALL DLL 1,"midiOutShortMsg",hmo,Message
wait 10
next x
wait 4000
GOTO in
REM HAVE Q KEY PRESS CAUSE JUMP TO EXIT: TO QUIT PROGRAM
EX:
DELETE MEMORY HANDLE
DELETE DLL 1
END