Listen: https://soundcloud.com/nadremy1jnwj/random-relax
Listen more wide range: https://soundcloud.com/nadremy1jnwj/random-guitar
Use: https://drive.google.com/open?id=0B1O2I ... zZvVU1PV1U
Do you like the result? Maybe I need to add some features?
It's Bezier curves generator+my old beat generator modified.
It gives three outputs: midi, spectrogram for Virtual ANS and wav.
You need scipy+numpy+pypng or my midi lib that's bundled with, or both. If you don't have both... I think you can figure out how to disable some functions.
Here's some code:
Add:
I forgot that there's not 7 notes per octave but 12. Changed that and music became more interesting.
Listen more wide range: https://soundcloud.com/nadremy1jnwj/random-guitar
Use: https://drive.google.com/open?id=0B1O2I ... zZvVU1PV1U
Do you like the result? Maybe I need to add some features?
It's Bezier curves generator+my old beat generator modified.
It gives three outputs: midi, spectrogram for Virtual ANS and wav.
You need scipy+numpy+pypng or my midi lib that's bundled with, or both. If you don't have both... I think you can figure out how to disable some functions.
Here's some code:
Code: Select all
music=[(0,random.randrange(nres),random.getrandbits(1)),]
def musadd(up,soc,fbit):
global music
yadd=soc
if not up:
yadd=-yadd
if not 0<=(music[-1][1]+yadd)<nres:
yadd=-yadd
if not 0<=(music[-1][1]+yadd)<nres:
yadd=0
xadd=((yadd*yadd)^4095)**.5#change 4095 to 2**n-1 to get different result
music.append((music[-1][0]+xadd,music[-1][1]+yadd,fbit),)
def composer(pres,nres):
global music
pressed=True
bf=random.getrandbits(16)
bf2=random.getrandbits(16)
up=random.getrandbits(1)
soc=random.randrange(-8,8)
alg=[random.randrange(-2,2) for bt in range(16)]
for patterns in range(pres):
by=random.getrandbits(4)
#print('test')
for bt in range(16):
if bt%8==0:
xop=random.getrandbits(1)
if bt%2:
xop=not xop
cur=(xop<<bt)#2**by
if bool(by&(1<<(bt%4)))^((bt%8)>4):
bf^=cur
#if cur:
# print('swap')
#else:
# print('noswap')
#else:
# print('noswap')
by=random.getrandbits(4)
for bt in range(16):
if bt%8==0:
xop=random.getrandbits(1)
if bt%2:
xop=not xop
cur=(xop<<bt)#2**by
if bool(by&(1<<(bt%4)))^((bt%8)>4):
bf2^=cur
alg[bt]=random.randrange(-2,2)
by=random.getrandbits(8)
for bt in range(16):
bp=1<<bt
if bp&bf:
up^=1
musadd(up,soc,bool(bp&bf2))
else:
soc+=alg[bt]
while abs(soc)>8:
up^=1
soc=random.randrange(-5,5)
musadd(up,soc,bool(bp&bf2))
musmin=[min(nn) for nn in zip(*music)]
musmax=[max(nn) for nn in zip(*music)]
musnor=[tuple(((it[0]-it[1])/(it[2]-it[1]) for it in zip(nn,musmin,musmax))) for nn in music]
music=[(0,random.randrange(nres),random.getrandbits(1)),]
return musnor
I forgot that there's not 7 notes per octave but 12. Changed that and music became more interesting.
Code: Select all
soc=random.randrange(-12,12)
Code: Select all
while abs(soc)>12:
up^=1
soc=random.randrange(-8,8)