procesos se hacen frases
usando digitos del pid como indices de una escala, las notas se espacían en un compás de ocho octavos usando el algoritmo euclidiano con todo y caminador aleatorio
This commit is contained in:
parent
ecb70926a7
commit
a8e5d7c926
22
mupah/__init__.py
Normal file
22
mupah/__init__.py
Normal file
@ -0,0 +1,22 @@
|
||||
from mupah.euclidean import euclidean_rythm
|
||||
|
||||
|
||||
def eighths_scale(p, scale):
|
||||
|
||||
hits = len(str(p.pid))
|
||||
|
||||
if hits < 8:
|
||||
length = 8
|
||||
elif hits >= 8 and hits < 16:
|
||||
length = 16
|
||||
|
||||
rythm = euclidean_rythm(k=hits, n=length)
|
||||
|
||||
for i in list(str(p.pid)):
|
||||
rythm = rythm.replace('X', i, 1)
|
||||
|
||||
phrase = [0 if i == '.'
|
||||
else scale[int(i) % 8]
|
||||
for i in list(rythm)]
|
||||
|
||||
return phrase
|
||||
@ -1,13 +1,17 @@
|
||||
import psutil
|
||||
import random
|
||||
from time import sleep
|
||||
from mupah import eighths_scale
|
||||
import mingus.core.scales as scales
|
||||
|
||||
scale = scales.Aeolian("C").ascending()
|
||||
|
||||
|
||||
def reporta(p):
|
||||
binario = bin(p.pid).replace('0b', '')
|
||||
return p.pid, binario, binario[0:7], len(str(p.pid)), len(p.name())
|
||||
print(eighths_scale(p, scale), p.name())
|
||||
|
||||
|
||||
|
||||
p = psutil.Process(pid=random.choice(psutil.pids()))
|
||||
print('random chose', reporta(p))
|
||||
|
||||
@ -20,10 +24,12 @@ while True:
|
||||
p = psutil.Process(pid=random.choice([subp.pid
|
||||
for subp in
|
||||
children]))
|
||||
print("\t↳", reporta(p))
|
||||
print("\t↳", end="")
|
||||
reporta(p)
|
||||
|
||||
else:
|
||||
p = psutil.Process(pid=random.choice(psutil.pids()))
|
||||
print('→', reporta(p))
|
||||
print('→', end="")
|
||||
reporta(p)
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user