This morning I attended a very interesting presentation on the pyo DSP module for python. From their website:
pyo is a Python module written in C to help digital signal processing script creation.
pyo is a Python module containing classes for a wide variety of audio signal processing types. With pyo, user will be able to include signal processing chains directly in Python scripts or projects, and to manipulate them in real time through the interpreter. Tools in pyo module offer primitives, like mathematical operations on audio signal, basic signal processing (filters, delays, synthesis generators, etc.), but also complex algorithms to create sound granulation and others creative audio manipulations. pyo supports OSC protocol (Open Sound Control), to ease communications between softwares, and MIDI protocol, for generating sound events and controlling process parameters. pyo allows creation of sophisticated signal processing chains with all the benefits of a mature, and wildly used, general programming language.
Here’s an incredibly simple example – it creates and plays a single sine at 200Hz:
from pyo import * s = Server().boot() s.start() a = Sine(freq=200, mul=0.5).out()
Since we already have Python bindings for libmapper, with a few lines of code we can make this example “mappable” and interactive.
from pyo import * import mapper s = Server().boot() s.start() a = Sine(freq=200, mul=0.5).out() try: dev = mapper.device('pyo_example') dev.add_input_signal('/freq', 1, 'f', 'Hz', 200, 500, lambda s, i, v, t: a.setFreq(v)) dev.add_input_signal('/mul', 1, 'f', 'na', 0, 1, lambda s, i, v, t: a.setMul(v)) while 1: dev.poll(5) finally: s.stop() s.shutdown()
*Note: The above code snippet has been updated for compatibility with libmapper v1.0 and greater.
One thought on “pyo and libmapper”