v0.1.1 — now on PyPI

Code is
the instrument

Write Python. Save the file. Hear it change.
Your code structure becomes music — in real time.

Get started GitHub
demo.py
SuperCollider output
cutoff
418 Hz
lfo rate
1.08 Hz
reverb
0.00
voices
1 voice

Save a file. Change the music.

PyCodeDJ analyses the AST of your Python code and maps structural features to audio parameters — no music theory required.

✍️
Write Python
Any valid Python — functions, loops, comments
🔬
AST Analysis
Depth, control-flow count, function count, comment ratio
📡
OSC Bridge
Parameters sent over UDP to SuperCollider
🔊
Sound
Real-time synthesis via scsynth
🌊
nesting depth
──▶
Filter Cutoff
Deeper if/for nesting opens the filter. More structure = brighter sound.
〰️
if / for / while count
──▶
LFO Rate
More control flow = faster modulation. Complexity becomes movement.
🎹
def count
──▶
Voice Count
Each function is a voice. Four functions fill a chord.
🌫️
comment ratio
──▶
Reverb Depth
Whitespace becomes space. More comments = deeper reverb.

Up and running in minutes

Python 3.10+, SuperCollider, and one pip command.

terminal
$ pip install 'pycodedj[watch]'

# Evaluate a loop block once
$ pycodedj eval demo.py::bass

# Watch file — auto-reload on save
$ pycodedj watch demo.py
  1. Install SuperCollider Download from supercollider.github.io and boot the server
  2. Load the synths Open sc/synths.scd in the SC IDE → Ctrl+A → Ctrl+Enter. Wait for Ready.
  3. Install PyCodeDJ pip install 'pycodedj[watch]'
  4. Write code, hear sound Run pycodedj watch myfile.py and start editing

Every edit is a performance

Try changing these patterns — each one shifts the sound in a different direction.

# bright + fast cutoff ↑ lfo ↑
# @loop bass interval=2.0
def bass():
    for i in range(8):
        for j in range(4):
            if i == j:
                pass
# 4-voice chord voices = 4
# @loop chord interval=1.0
def voice_a(): pass
def voice_b(): pass
def voice_c(): pass
def voice_d(): pass
# deep space reverb ↑↑
# @loop pad interval=4.0
# smoke above the kick
# late reflections
# concrete room tail
# crowd heat
def pad(): pass