buzz forums
http://forums.jeskola.net/

pyBLOK
http://forums.jeskola.net/viewtopic.php?f=3&t=2135
Page 1 of 1

Author:  zeffii [ Wed Jun 01, 2016 8:31 am ]
Post subject:  pyBLOK

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:
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

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/