Pure Data uses programming blocks and lines to build a functional script.
At the top of the script, Pure Data begins listening to port 12345
and receiving data over the port using netrecieve
.
The incoming data is sent from the QT Py ESP32-S2 with the socket message. This message is parsed using route
. The message is divided by the variable names sent before each sensor value.
- TSC2007 x coordinate:
x
- TSC2007 y coordinate:
y
- ADXL343 x value:
aX
- ADXL343 y value:
aY
- Run state:
run
- MIDI note number:
n
Values are sent around a Pure Data script using s
or send
. Underneath route
, you can see each individual value being sent with s
.
The seq
array holds the received MIDI notes and are played in a loop. You can adjust the array's parameters using the bounds
, const
and resize
messages.
Values are received as inputs using receive
or r
. n
and x
are received by the array using r
. Those values are written to the array using tabwrite
.
run
affects whether the synth patch is playing or not. When a new run
message is received from the socket, the patch will either begin playing or stop. Additionally, when it stops, a 0
is sent to all of the parameters so that the synth is muted using s off
.
The + 1
and % 8
blocks act as a for loop, advancing by 1
with a limit of 8
. This lets the script iterate through the notes in the seq
array like a sequencer.
tabread
reads the MIDI notes in the seq
array. Those note numbers are converted to frequencies using the MIDI to Frequency block (mtof
). The frequency is sent to the synth.
The synth is built using a sawtooth waveform, created with the phasor~
block. It has a series of filters that are affected by the accelerometer.
Page last edited March 08, 2024
Text editor powered by tinymce.