It's been a while since I posted something I made on this forum.
Today I'd like to present to you my random music generator.
The tokenised .bbc file can be found here: http://dusthillresident.ddns.net/folder ... mMusic.bbc
There is also a version for the BBC Micro:
https://twitter.com/dusthillperson/stat ... 6289212422
Source code for the BBC Micro version:http://dusthillresident.ddns.net/folder ... erator.txt
It plays random chords and random melodies in harmony with the chords. I'd love to know what you think.
Code: Select all
DIM P(2),N$(2): N=RND(17)-1: a=-15: I=-2
P(0)=&C740: N$(0)="ACEFHJL":
P(1)=&C730: N$(1)="ACDFHIK":
P(2)=&B720: N$(2)="ACEHJLO":
FORi=0TO3
SOUNDi,0,0,16-4*(i=3)
NEXT
REPEAT
R=19*4+RND(12)*4
H=RND(3)-1
FORj=-15 TO 0 STEP 4
FORk=0TO1
IFRND(2)-1:N=FNn(RND(5)-3+N):a=-15:ELSEa=a+2
b=R+4*(ASCMID$(N$(H),N MOD7+1,1)-65)+(N DIV7*48): SOUND2,a,b,4: SOUND3,a*0.5,b-1,4
NEXT
FORi=0TO3
SOUND 1,j,R+(P(H)DIV(16^i)AND15)*4,2
NEXT
NEXT
UNTIL FALSE
DEFFNn(N)IFN<0:=-N
IFN>16:=16-(N-16)
=N