pyBLOK

Post Reply
zeffii
Posts: 15
Joined: Thu Dec 08, 2011 8:15 pm

pyBLOK

Post by zeffii »

https://github.com/zeffii/pyBLOK

Here's a small set of python functions to create BLOK patches (.blkx) programmatically. Conceptually similar in some ways to SuperCollider or Chuck, declaring a node tree via code has the potential to take some of the tedium from otherwise complex trees. At the same time it is convenient to have the ability to drag sliders on a UI to play with the parameters afterwards.

pyBLOK doesn't talk directly to any BLOK instance, instead it writes .blkx files to disk at a given path.

Code: Select all

from blok_functions import Connect, pBlk, pCompile

out = pBlk('Mono.Out', (320, 110))

env1 = pBlk('Env.basic', (30, 110))
env1.set_params(attack=0.08, decay=0.45, release=0.6)

oscillators = []
for freq, y in zip([0, 0.5, 1], [120, 200, 280]):
    osc = pBlk('Osc', (170, y))
    osc.set_params(tuning=freq)
    Connect(env1, osc, index=1)
    Connect(osc, out, index=0)
    oscillators.append(osc)

pCompile(path=r'C:\Users\zeffi\Desktop\fluxo3.blkx', silent=0)
Image

There's a todo which may or may not happen: https://github.com/zeffii/pyBLOK/issues/2
Post Reply