!Riff!Riff(*X `(E 3!Help 48 Anson Road, London, NW2 3UU +44 (181) 450 9448 !Run .!Sprites RMEnsure Podule 0 RMReinit Podule RMEnsure Podule 0 Error 0 No Podule module! RMEnsure Midi 3.00 RMReinit Midi RMEnsure Midi 3.00 Error 0 !Riff requires version 3.00 or later of the MIDI module WimpSlot -min 32k -max 32k Run .!RunImage %*0 !RunImage ಢLEDI8  > Riff  9 This program is Copyright 1994 Denis Howe. You may < distribute verbatim or modified copies of this program = provided each such copy is distributed with a copyright < notice and distribution conditions identical to these.  . Please send me a copy of any changes you 1 make and add the details to the list below.  # Denis Howe $ 48 Anson Road, London, NW2 3UU  +44 (181) 450 9448  ? 12 May 1992 0.00 Written by Denis Howe # 14 Dec 1994 0.01 WIMP version  Task$="Riff" #Purpose$="Random MIDI patterns" Author$=" Denis Howe 1994" !Version$="0.01 (14 Dec 1994)"   Error  HSeed%=17 : Change this to get different "tunes"  Dummy%=(-Seed%) /BeatLength%=100+(200) : Initial tempo RhythmChannel%=-3  WimpInit MajorMinor New ! MidiInit " # (200)=1 Reset $ (5)=1 Copy New %" Time%=Time:StartTime%=Time% & T%=0 NT%-1 '- T% 3 Velocity%=80 Velocity%=120 ( Chan%=0 NChan%-1 ) Pitch%(T%,Chan%) *" Note(Chan%,0,0,Time%) +9 Note(Chan%,Pitch%(T%,Chan%),Velocity%,Time%) , - Chan% . Time%+=BeatLength% / T% 0 AllOff(Time%) 10 Wait: Time>StartTime%+NT%*BeatLength% 26 (10)=1 BeatLength%+=.1*BeatLength%*((2)-1.5) 3' BeatLength%<100 BeatLength%=100 4' BeatLength%>300 BeatLength%=300 5 6 7 Set(T%,Chan%,P%) 8Pitch%(T%,Chan%)=P% 9DrawNote(T%,Chan%) : ; < Reset =Pitch%()=0 > Force ? @ A? ========================== WIMP ========================= B C WimpInit D b% 260:b%+=4 E NChan%=4 FLog2NT%=5:NT%=1<WinW% WinW%=TitleW% i1b%!0=9999:b%!4=-WinH%:b%!8=b%!0+WinW%:b%!12=0 j,b%!16=0:b%!20=0:b%!24=-1:b%!28=&FF000002 k#b%?32=7:b%?33=2:b%?34=7:b%?35=0 l$b%?36=3:b%?37=1:b%?38=12:b%?39=0 m,b%!40=0:b%!44=-WinH%:b%!48=WinW%:b%!52=0 n0b%!56=&07000039:b%!60=0:b%!64=1:b%!68=&10001 o$(b%+72)=Title$:b%!84=0 p$ș "Wimp_CreateWindow",,b% WH% q b%!-4=WH% rș "Wimp_OpenWindow",,b%-4 sT%=+100: Wait: >T% t u v Poll w More%,R%,Y% x$ș "Wimp_Poll",&FFF9FDBC,b% R% y Ȏ R% z 0:MoveCursor { 1 |( ș "Wimp_RedrawWindow",,b% More% }* WkOrX%=b%!4-b%!20:WkOrY%=b%!16-b%!24 ~ ȕ More%  Redraw(WkOrX%,WkOrY%) * ș "Wimp_GetRectangle",,b% More%  2:ș "Wimp_OpenWindow",,b% ! 3:ș "Wimp_CloseWindow",,b%  6  Ȏ b%!8 2 * b%!12=-2 Y%=1*44+96 Y%=b%!4+28 . ș "Wimp_CreateMenu",,Menu%,b%!0-64,Y% 4 , !b%=WH%:ș "Wimp_GetWindowState",,b%  b%!32 1<<16 # ș "Wimp_CloseWindow",,b% " ș "Wimp_OpenWindow",,b%  9:Quit 17,18  Ȏ b%!16  0,8:Quit 9 &400C2: b%!4<>Task% String(b%+28)=Task$ Quit      DrawNote(T%,Chan%) X%,Y% !X%=Chan%*ChanW%:Y%=-T%*CharH% Eș "Wimp_ForceRedraw",WH%,X%+CharW%,Y%-CharH%,X%+ChanW%+CharW%,Y%   Force .ș "Wimp_ForceRedraw",WH%,0,-WinH%,WinW%,0    MoveCursor  More%,Now%,X%,Y%,y%,oldy% Now%=Time /Y%=(StartTime%-Now%)*CharH% BeatLength%-8  (Y%-OldY%)<4 4b%!0=WH%:b%!4=0:b%!8=-WinH%:b%!12=CharW%:b%!16=0 &ș "Wimp_UpdateWindow",,b% More% V% CurrentPitch%(Chan%)=P(P%) P%=CurrentPitch%(Chan%) ;Command%=&90 Chan% CurrentPitch%(Chan%)<<8 V%<<16 &ș "MIDI_TxCommand",Command%,Time%    AllOff(Time%) Chan%  Chan%=0 NChan%-1  Note(Chan%,0,0,Time%) Chan%    AllOffNow Chan% AllOff%=&03007BB0  Chan%=0 NChan%-1 ' ș "MIDI_TxCommand",AllOff%+Chan%     MajorMinor + <0 P%(2)=3:P%(5)=8 P%(2)=4:P%(5)=9   New  D%,T%,M%,P%,TT%,CC%,MP% Chan%=(NChan%)-1 $ Chan%=RhythmChannel% Rhythm: T%=(NT%)-1 1 Pitch%(T%,Chan%) >0 Pitch%(T%,Chan%)=0: 2 Round T% down to biggest silent power of two M%= 1   TT%=T% M% 2 Pitch%(TT%,Chan%)=0 T%=TT%:M%=M%<<1 M%=0  (NT% M%)=0 P%=(15)+6:MP%=P(P%)  CC%=0 NChan%-1 % CC%<>Chan% Pitch%(T%,CC%) $ D%=(MP%-P(Pitch%(T%,CC%)))  UH%(D% 12)   Set(T%,Chan%,P%)    Rhythm  D%,T%,P% D%=1<<((Log2NT%+1)-1) T%=(NT%)-1 P%=(22)+6  ȕ T%0  C%=0 NChan%-1  P%   Swap%(C%)=(NChan%)-1 1 CC%=0:ȕ Swap%(CC%)<>Swap%(C%) CC%+=1:  CC%=C%   Swap%(C%)=C%   LS%=1<<((NT%-1)/2-1) ( LS%*4=TS%+LS% # C%=0 NChan%-1 $% P%=Pitch%(TS%+T% LS%, C%) % P% &" P%+=PS%+DS%*(T% LS%) ' ȕ P%>28 P%-=7: ( )+ Set((TD%+T%) NT%,Swap%(C%),P%) * + , - . /& P(P%)=12*(P% 7)+P%(P% 7)+36 0 1? ========================== Misc ========================= 2 3 String(S%) 4 P%:P%=S% 5ȕ ?P%>" ":P%+=1: 6 $P%="" 7=$S% 8 9 Error : ;AllOffNow < <>0 <>17 = !b%=:$(b%+4)=$+" @ "+ >& ș"Wimp_ReportError",b%,1,"Riff" ? @ Quit A B C Quit D MidiInit E!ș "MIDI_FastClock",0 : Stop F+$b%="TASK":ș"Wimp_CloseDown",Task%,!b% GȘ H I, Yamaha TX81Z-specific stuff (not used) J K DEF PROCPerf(Chan%) L LOCAL C%,T%:C%=Chan% AND 7 M1 REPEAT V%=RND(160)-1:UNTIL V%<136 OR V%>149 N PROCPAR(0,12*C%+1,V%>>7) O# PROCPAR(0,12*C%+2,V% AND 127) P ENDPROC Q R DEF PROCPAR(S%,P%,D%) S& PROCM(&F0):PROCM(&43):PROCM(&10) T' PROCM(&10+S%):PROCM(P%):PROCM(D%) U PROCM(&F7) V ENDPROC W X- DEF PROCM(A%) :REM Send A% to MIDI Y SYS "MIDI_TxByte",A% Z ENDPROC !Sprites ҶgEW!riff, DEDTD]]\]]UUUUUUUUUUUUUUUe\孪]UDQݭ]UUUUUU]UUUUUUUDDEDTEEP[]\ŭE[UU]UUUUUU]UUUUUUUݭU[[]ݪ][[]UUU]UUUUUUUUUݪ]UU]PUUU E]ݪ]PUUUUUUUUUUUUUUUUUUUUU]ݪ]P@UP@EPTReadMecA*X AE!Help for !Riff 0.01 (14 Dec 1994) !Riff generates random repeating patterns on an attached MIDI instrument. A new note is added each time the pattern is played unless the note chosen would be unharmonious in the position chosen for it. Sometimes a section of the pattern is copied to one or more other locations in the pattern, possibly with a pitch shift and with channels interchanged. Very occasionally the pattern is cleared completely and the whole ghastly business starts again, probably producing a different pattern. The tempo also changes randomly between certain limits. !Riff displays the current pattern in a window. There are no controls except Quit. All you can do to relieve the monotony is change the instruments assigned to MIDI channels 1 to 4 or change the value of Seed% near the start of !Riff.!RunImage. !Riff requires a version 3 MIDI podule with the MIDI_FastClock SWI (mine is version 3.14). This program is Copyright 1994 Denis Howe. You may distribute verbatim or modified copies of this program provided each such copy is distributed with a copyright notice and distribution conditions identical to these. History ======= Please send me a copy of any changes you make and add the details here. 0.00 12 May 1992 Written by Denis Howe 0.01 14 Dec 1994 WIMP version If you like this kind of infinitely boring music (I love it!) you should hear "Drumming" by Steve Reich or anything by Philip Glass or Micheal Nyman. If you have any comments on this program feel free to mail me. Denis Howe 48 Anson Road, London, NW2 3UU +44 (181) 450 9448