Wow, Pure Data is a blast! Coming from asynchronous procedural coding, visual programming of realtime data/audio flows was a novel excersise by itself. But my love comes from the elegance of it’s minimalism: just a handful of objects that you can put on a single A4 reference sheet, and some basic rules concerning the order of which things are processed, and off you go. I’ve stuck with Pd Vanilla, actively supported (again), and at it’s most basic and minimal. And all works smoothly on the Bela board. Oh, and the Pd documention is amazing, as well as the community!
The Pepper racked.
I’ve added the Pepper modular shield (described in an earlier post) to the Bela, and finished it with my favourite Rogan Buchla knobs that I ordered at Thonk. Since the potentiometers of the Pepper are 6mm D-shaft, while the Rogan knobs are solid shafts of 6.33mm, I had to use these copper sleeves (not the first time I ended up at Thomann after first searching the whole internet). The hex screws of the knobs, however, align perfectly with the cutout of the D-shaft, so I used shards of PCB to fill in that space with some hard material. Worked perfectly well. My USB mounting cables arrived in the meantime, and when racked in my case it’s a very, very tight fit with both the host and device cables plugged in. In fact, it only fits in my top shelf, and I have to temporarily remove modules below to finger in the USB host cable. I don’t think it’ll work in a single 3U Eurorack row. I haven’t yet received the extra USB faceplate, but the friendly guys at Bela promised they’d send me one. Due to a some defect due to perhaps some soldering or defective potentiometer, it’s easier unracked for now, but I hope to have it be a permanent part of my case soon. Anyway, this post is about the Pd patch.
Scaling
First of all though, the precision of the potentiometers and resistors is pretty low – about 10%, and indeed when measuring impedance they varied quite a lot from one to the other. This means that if you would ‘open’ the pots fully, the Bela would not register exactly 10v, but different values depending on the knob. Which in turn means that you would not be using the full range if your code would only scale the input with the same value for every knob. In my patch I therefor automatically scale the input CV values with their individual maximum value. It requires a single sweep to the max to set them though, but afterwards the values will be retained. A long press on the second push-button will reset the calibration.
Noise
Secondly, and even more surprising for a electronic engineering noob like me, is that the analog input signal (as digitized by the Bela), is pretty noisy – I’m getting around 1% of fluctuations when the signal itself should be just be of a certain constant voltage. One percent of noise means that if I want to use the input voltage to set e.g. the pitch of a sine wave at semi notes, I would not be able to get to any precision beyond about 100 steps – and probably a bit less. The 128 possible pitch values in 7-bit MIDI suddenly don’t sounds so rediculous anymore! It really brings the message home how precise/noiseless digital values actually are. Much of the code in Pd responds to changes in values, so dealing with a continuous noisy signal requires more CPU than is useful, and will make the program unstable or unpredictable. I therefor add a bit of ‘digitization’ or ‘granularization’, by imposing a maximum of 100 values (i.e.: int(old_value*100)/100).
Smoothing
Finally, I have one very noisy channel. Actually, it’s probably broken somewhere and might need some resoldering to which I am not looking forward. Before I figured his out I did add some useful smoothing to the input to deal with short abrupt changes and noise in the signal. This would also help with reducing noise, assuming that we are not interested in milli-second changes in the input, but CV controlled – and often hand-controlled – changes.
Manual input
I’d often work on the laptop uncoupled from the Bela, and simulated the input CV with manual sliders. I had to try some different ways to not make them interfere with the pots once uploaded onto the Bela, and ended up with a ‘manual’ toggle that is set globally.
Input abstraction
In the end, this is my little Pd ‘abstraction’ for reading the CV input. It scales the output to values that are used in the main patch, and allows for a manual input.
This is then how I use them in the main patch. Note the different min-max ranges that are set for the calibration. Some need to be integer values, for which I add a rounding expression. I guess I could add a flag for this in the abstraction. Also note I have only defined the first 7 analog inputs. I use the last input as a digital in to allow setting the tempo by ‘pinging’ it.
Sequencer
The analog CV inputs control the basic parameters of a random sequencer and simple synthesizer: it creates random, repeating, sequences of and adjustable length, with notes in a user-defined scale, and with a particular offset and range. Just like the seminal Turing machine, one can set the change of a single note changing, creating slowly evolving sequences. I also added random ratcheting, i.e. the retriggering of some notes at an integer multiplication of the clock rate.
Outputs
There are several outputs: clock triggers, the quantized notes at 1V/oct, the triggers including ratcheting, as well as the envelope. Envelope? Yes, an attack-decay envelope of which the ratio between rise and fall can be adjusted with CV. Finally, there is the audio output. On the Left output a sine wave and on the Right a sub-saw one octave lower. Both are enveloped. All together you’ll have quite the little generative synth!
Github and EEGsynth integration
I’ve not yet connected it with e.g. an OSC coupling and an EEGsynth patch. That would be partly the point, but since it isn’t there yet, I’ve added the patch to a separate repository for Bela here. Once I’ve used it in some kind of recording I will add it all to the EEGsynth repository.
I hope to be able to connect with some more Bela Pepper users, as there is not that much around yet – although it can all be easy adapter to Pepper. Still, I am curious to see what the Eurorack community comes up with.