pybela

pybela is a Python library that allows real-time, bidirectional data communication between Python (usually running in a host desktop or laptop) and a Bela program. pybela allows requesting data from Python through either scripts or Jupyter notebooks, with great flexibility over what, how and when data is sent. The library supports data transmission at rates up to audio frequency. Applications include collecting audio or sensor signal datasets, debugging and calibrating sensors, or streaming sensor data to a deep learning model running in the host computer, and sending the model output back to Bela for further processing.

This library offers an opportunity for creative experimentation with interaction data that moves away from the current AI tropes of large black-boxed models trained on dubiously-sourced datasets. pybela enables working with smaller custom datasets and models instead, while creatively exploring the computational limitations of low-resourced embedded platforms. This approach is especially relevant since we observe that many AI approaches in interactive media are inspired by information-retrieval techniques and often directed towards analysing audio, text or visual data rather than engaging with embodied aspects of creative practice, such as musical movement and its digital representations.

The library was developed by Teresa Pelinski as part of her project on facilitating prototyping with deep learning and physical computing, in collaboration with Giulio Moro (Lead developer at Bela, Augmented Instruments Lab alum) who wrote the Bela backend. pybela has been presented at a few workshops, with full documentation and tutorials available on GitHub. The library relies on a websocket connection between Bela and the host computer for bidirectional communication and reliable real-time data transfer. The library implementation abstracts the asynchronous programming layer that would otherwise be required to manage such communication. Technical details are available in the paper publication and documentation website.