- Edited
Hey hi Giulio et allii,
I have been migrating my tested SuperCollider code to a new Bela mini and for some reason the TrillCentroids UGen seems to block the TrillRaw UGen on the new Bela. I am using 4 trill flexes together with 1 craft. For the flex sensors I use the TrillCentroids UGen and for the craft the TrillRaw.
When I run this code
SynthDef(\trillcraft, {|t_recalibrate=0.0 t_updateTrill=1.0|
var i2c_bus = 1;
var i2c_address = 0x30;
var noiseThreshold = 0.06;
var prescalerOpt = 7;
var touchsigs = DC.ar(0).dup(3);
var centroids;
var rawvals;
var out, ping;
rawvals = TrillRaw.kr(i2c_bus, i2c_address, noiseThreshold, prescalerOpt, t_updateTrill);
SendReply.kr(Impulse.kr(10), "/craft", rawvals);
}).store;
~trill_craft = Synth(\trillcraft);
OSCdef(\craft, {|msg| var button1, button2;
msg.postln;
button1 = msg[11+3];
button2 = msg[18+3];
if ( button1 != 0, {
("button 1: "++button1).postln; });
if ( button2 != 0, {
("button 2: "++button2).postln; });
}, "/craft");
and then touch the first button that is connected to the Craft, I get good readings:
But as soon as I add my flex synth to the setup:
SynthDef(\trillflex, {|t_recalibrate=0.0 t_updateTrill=1.0|
var i2c_bus = 1;
var i2c_address = 0x48;
var noiseThreshold = 0.045; // float: 0-0.0625, with 0.0625 being the highest noise thresh
var prescalerOpt = 4; // int: 1-8 with 1 being the highest sensitivity
var touchsigs = DC.ar(0).dup(3); // use 3 touches
var centroids;
var rawvals;
var out, ping;
centroids = TrillCentroids.kr(i2c_bus, i2c_address, noiseThreshold, prescalerOpt, t_recalibrate);
SendReply.kr(Impulse.kr(10), "/flex", centroids);
}).store;
~trill_flex = Synth(\trillflex);
I just get zero readings from the TrillRaw / craft, while the TrillCentroids / flexes are working fine (all four of them). So somehow the TrillCentroids is blocking the TrillRaw. On my previous Bela mini (that unfortunately broke) I had a setup working in which TrillRaw's were working together with TrillCentroids, so I am suspecting some kind of build issue here.
I have built both the TrillCentroids.so and the TrillRaw.so against the SuperCollider version 3.12.1 that is present on the board. In the build instructions it is mentioned that one should add:
# Build the shared library
add_library(${PROJECT} MODULE
${FILENAME}
${BELA_PATH}/libraries/Trill/Trill.cpp
)
but I get an error message from that part, so I need to leave it out. So maybe it has something to do with that?
My bela image is: Bela image, v0.3.8h, 5 January 2023
It would be great if you could point me in the right direction to solve this issue.
Thanks!
All the best,
Sjoerd