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
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:
- TSC2007 y coordinate:
- ADXL343 x value:
- ADXL343 y value:
- Run state:
- MIDI note number:
Values are sent around a Pure Data script using
route, you can see each individual value being sent with
seq array holds the received MIDI notes and are played in a loop. You can adjust the array's parameters using the
Values are received as inputs using
x are received by the array using
r. Those values are written to the array using
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
+ 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.