Demo: Synthesis-Enabled Live Coding on the Web

Kat Pompermayer, Catherine Ji, Hannah Macias, Mark SantolucitoAIIDE Workshops 2021

Introduction

Live coding is a performance practice where artists write code in real-time to generate music or visuals. Central to this practice is the "show your code" mantra, which emphasizes transparency as a core artistic element. However, this requirement presents a significant barrier to entry, as performers must master both musical theory and programming syntax simultaneously.

This paper introduces a web-based live coding environment designed to lower this onboarding cost. By leveraging program synthesis, the tool automatically generates music code from graphical user interface (GUI) interactions. This approach bridges the gap between traditional drum machine interfaces and text-based programming, making live coding accessible to beginners while maintaining the expressive power of manual coding for advanced users.

Methodology: Programming-by-Example

The system utilizes Programming-by-Example (PBE), a form of program synthesis, to translate user interactions into executable code. When a user interacts with the drum rack GUI—for instance, by placing a kick drum on a specific beat—the tool captures these actions as data constraints.

These constraints are processed by a SyGuS (Syntax-Guided Synthesis) solver, which searches for a function within a predefined domain-specific language (DSL) that satisfies the user's input. The resulting code is then injected into the live coding editor in real-time. This bi-directional synchronization ensures that changes in the GUI update the code, and manual edits to the code are reflected back in the GUI.

System Design and Multi-View Interaction

To accommodate different skill levels and performance styles, the tool provides three distinct interaction modes: the Drum Rack View (GUI only), the Live Coding View (code only), and the Synthesis View.

The Synthesis View provides a side-by-side interface where GUI interactions automatically generate corresponding code in the editor.

The Synthesis View (Figure 3) serves as an educational scaffold. Users can "sketch" a rhythmic pattern in the GUI and immediately observe how that pattern is represented in the underlying DSL. This allows for a gradual transition from visual interaction to manual programming.

Musical Representation and Constraints

To ensure the synthesis engine remains responsive enough for live performance, the authors implemented several constraints. The musical space is quantized into a standard 16-step sequencer. Furthermore, the tool supports complex musical parameters such as volume and note duration.

The 16-step sequencer uses circular icons to represent musical parameters like volume and duration for each step.

As shown in Figure 6, the interface uses specialized circular icons to represent these parameters. The synthesis engine handles these by generating two separate functions—one for volume and one for duration—within a single query, maintaining high performance in a web browser environment.

Results and Future Directions

The resulting tool is a functional, open-source web application that supports real-time synthesis and recording. By providing a logic-based synthesis engine rather than a data-driven one, the system avoids the need for large training datasets and operates efficiently on client-side hardware.

Future work will focus on expanding the synthesis capabilities to include "automation"—the recording of slider movements over time—and conducting user studies to evaluate the tool's effectiveness as a learning aid. Additionally, the authors aim to evolve the internal DSL into a more specialized external language to further simplify the syntax for novice users.

Summary updated

BibTeX
@inproceedings{pompermayer2021demo,
  author = {Kat Pompermayer and Catherine Ji and Hannah Macias and Mark Santolucito},
  title = {{Demo: Synthesis-Enabled Live Coding on the Web}},
  booktitle = {AIIDE Workshops},
  year = {2021},
}
Figure