03
04
04
01
01
01
03
03
03
09
10
11
02
04
06
11
01
01
02
05
05
08
09
09
10
10
10
10
12
01
01
01
01
10
03
03
03
03
03
04
04
05
05
06
06
07
08
10
11
02
02
03
04
05
05
05
05
05
05
05
05
05
05
05
08
09
11
11
11
12
03
05
06
07
07
08
09
09
09
10
11
12
12
03
04
04
04
06
06
09
09
09
11
11
11
11
03
03
06
06
07
09
10
11
11
03
06
06
06
07
01
03
04
05
05
06
06
06
11
08
11
11
11
11
01
03
03
03
04
05
05
06
06
07
07
09
10
11
11
11
11
11
11
11
11
11
01
01
02
03
03
04
05
06
06
06
08
09
09
11
12
02
02
03
03
04
04
05
05
05
06
07
08
03
05
05
05
05
06
09
09
10
10
10
11
03
05
12
03
06
07
11
11
11
03
03
04
06
11
01
01
02
04
04
04
05
05
06
06
07
07
09
09
09
10
10
11
01
01
01
03
03
03
04
04
04
05
05
05
05
05
06
06
06
06
06
07
07
07
07
07
08
08
08
09
09
10
10
10
10
11
11
12
12
01
12
02
03
03
04
04
05
05
06
06
07
07
09
09
10
10
11
11
12
12
02
03
03
04
04
04
04
05
06
06
06
08
08
09
10
10
10
10
10
11
11
11
11
12
12
12
12
02
02
03
03
03
03
03
04
04
05
05
05
05
06
06
07
07
07
07
07
07
07
09
10
10
10
10
10
10
11
12
02
03
04
04
05
06
06
Conférence PyCon DE & PyData Berlin 2024
Berlin Congress Center (BCC)
Alexanderstr. 11
10178 Berlin
Berlin (D)
(voir carte)
En juin 2022, lors d'une mise à jour du programme de lutherie augmentée utilisé pour son Passamezzo antico, Matthieu Amiguet a eu l'idée d'une innovation dans l'utilisation du langage de programmation Python. Au printemps 2023, pour appuyer les désirs artistiques de Barbara Minder & Christian Jelk pour la performance Créolité suisse, il a développé et affiné cette innovation. Pensant que cette nouvelle manière de faire serait utile à des programmateurs non musicaux et plus généralistes, Matthieu Amiguet a soumis et décroché une conférence pour présenter cela au congrès international PyCon.de.
Le détail de la conférence en anglais ci-dessous et sous le lien https://pretalx.com/pyconde-pydata-2024/talk/Y7R9GZ/
Replacing Callbacks with Generators: A Case Study in Computer-Assisted Live Music
Callbacks have become an ubiquitous programming technique that we use every day without even thinking about it. They are definitely handy in many situations, but sometimes they feel more like a burden than a help. In developing an interactive realtime audio processing system for use on stage in live music, we encountered such a situation. This talk will present how a few dozen lines adding a thin abstraction layer allowed us to replace a complex callback mess with tremendously more readable generators (yes, you know, those functions which yield
results instead of return
ing them...).
At Les Chemins de Traverse we explore ways of "augmenting" acoustical musical instruments with new sonic possibilities offered by computers (think "augmented reality" for live music). For doing so, we are using Olivier Bélanger's great pyo module for realtime audio processing. To make the system interactive, this module allows to register callbacks on some events. While this works great in many situation, it can get very cumbersome when we design a stateful system, where the same event must trigger different callbacks depending on the system's inner state.
This talk will present how we developed a thin abstraction layer that allows us to replace many callback functions together with many registering/unregistering of these functions by a nice, streamlined generator definition that's incomparably more readable than the many-callbacks version. This allows us to keep our mind focused on what's important, namely supporting the music we want to play, instead of tedious boilerplate code.
While our use case is admittedly very specific, we believe that the ideas we present could be adapted in many other situations where callbacks are used for technical reasons, but lead to bulky and contrived code.
Trained both as a musician and a mathematician, Matthieu Amiguet took up programming as a hobby and somehow ended up making a PhD in computer science. He now works freelance - both as a musician and a developer. He is Artistic Director at Les Chemins de Traverse, jointly with Barbara Minder.
Les Chemins de Traverse is a collective of musicians, artists and researchers from a variety of backgrounds with a focus on sonic exploration and live performance. They cover a large musical territory from renaissance and baroque music to jazz, rock music and contemporary experimental noise. More often than not, they mix different styles and techniques - like in a weird chemical experiment that would produce nice colored fluids but might as well explode at any time.
Sur scène
Projets concernés
Chemin de création
Rodage du soir - espoir!
Rodage à l'atelier en vue de la conférence PyConDE pour quelques happy few qui tiennent la charge. Les générateurs pour simplifier du code basé sur les callbacks, ça déchire grave! La face cachée de Passamezzo et Créolité suisse!