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

nothing has changed on the Supercollider or Trill externals since at least january 2023. How old was the supercollider/trill ugens install you were running on the older board? Are you running the exact same supercollider code?

    giuliomoro I am sure that they were up-to-date (from your trill ugen github that your forked from jonathan reus)

    Are you running the exact same supercollider code as before?

      This is my code (that used to work on the previous Bela mini):

      s = Server.default;
      s.options.numAnalogInChannels = 8; // can be 2, 4 or 8
      s.options.numAnalogOutChannels = 8; // can be 2, 4 or 8
      s.options.maxLogins = 4; // should match the settings on the remote sclang
      s.options.bindAddress = "0.0.0.0"; // allow anyone on the network connect to this server

      s.options.numDigitalChannels = 16;
      s.options.pgaGainLeft = 10; // sets the gain for the left audio input to 4 dB
      s.options.pgaGainRight = 10; // sets the gain for the left audio input to 5 dB
      s.options.headphoneLevel = -6; // sets the headphone level to -6 dB
      s.options.speakerMuted = 0; // enable the speaker amp
      s.options.dacLevel = 0; // sets the gain of the dac to 0 dB
      s.options.adcLevel = 0; // sets the gain of the adc to 0 dB
      s.options.numMultiplexChannels = 0; // do not enable multiplexer channels

      s.options.blockSize = 512;
      // analog inputs 2-7 will still be available through the AnalogIn Ugen.
      s.options.numInputBusChannels = 2; // Use only the L/R audio channels
      s.options.numOutputBusChannels = 2; // Use only the L/R audio channels
      s.options.belaMaxScopeChannels = 4; // allow to send some channels to the Bela scope

      s.options.memSize = 8192; // the default is 8192 which is quite little
      s.boot;

      s.waitForBoot({
      s = Server.default;
      s.options.numAnalogInChannels = 8; // can be 2, 4 or 8
      s.options.numAnalogOutChannels = 8; // can be 2, 4 or 8
      s.options.maxLogins = 4; // should match the settings on the remote sclang
      s.options.bindAddress = "0.0.0.0"; // allow anyone on the network connect to this server

      s.options.numDigitalChannels = 16;
      s.options.pgaGainLeft = 10; // sets the gain for the left audio input to 4 dB
      s.options.pgaGainRight = 10; // sets the gain for the left audio input to 5 dB
      s.options.headphoneLevel = -6; // sets the headphone level to -6 dB
      s.options.speakerMuted = 0; // enable the speaker amp
      s.options.dacLevel = 0; // sets the gain of the dac to 0 dB
      s.options.adcLevel = 0; // sets the gain of the adc to 0 dB
      s.options.numMultiplexChannels = 0; // do not enable multiplexer channels

      s.options.blockSize = 512;
      // number of audio channels: values greater than 2 will use the first few analog
      // channels as audio channels.
      // Any additional analog channels will be available through the AnalogIn/Out Ugens
      // e.g.:
      // s.options.numInputBusChannels = 4;
      // means that bus in 0/1 are the audio L/R channels and 2/3 are the analog inputs 0/1
      // analog inputs 2-7 will still be available through the AnalogIn Ugen.
      s.options.numInputBusChannels = 2; // Use only the L/R audio channels
      s.options.numOutputBusChannels = 2; // Use only the L/R audio channels
      s.options.belaMaxScopeChannels = 4; // allow to send some channels to the Bela scope

      s.options.memSize = 8192 * 16; // the default is 8192 which is quite little
      s.boot;

      SynthDef(\trillcraft, {|t_recalibrate=0.0|
      var i2c_bus = 1;
      var i2c_address = 0x30;
      var noiseThreshold = 0.06; // float: 0-0.0625, with 0.0625 being the highest noise thresh
      var prescalerOpt = 7; // int: 1-8 with 1 being the highest sensitivity
      var touchsigs = DC.ar(0).dup(3); // use 3 touches
      var centroids;
      var out, ping;
      centroids = TrillRaw.kr(i2c_bus, i2c_address, noiseThreshold, prescalerOpt, t_recalibrate);
      SendReply.kr(Impulse.kr(10), "/craft", centroids);
      }).store;

      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);
      //rawvals = TrillRaw.kr(i2c_bus, i2c_address, noiseThreshold, prescalerOpt, t_updateTrill);
      SendReply.kr(Impulse.kr(10), "/flex", centroids);
      }).store;

      3.wait;
      /*TRILL SYNTHS */
      ~trill_craft = Synth(\trillcraft);
      ~trill_flx = Synth(\trillflex);
      5.0.wait;

      OSCdef(\craft, {|msg|
      msg.postln;
      }, "/craft");

      OSCdef(\trillflex, {|msg|
      msg.postln;
      }, '/flex');

      });

      When I run this code, I just get reading from the Trill Flex, but not from the craft. When I touch both my craft button and the flex sensor I get this:

      Now when I comment out the trill flex synth // ~trill_flx = Synth(\trillflex);
      and I touch one of my craft buttons, I immediately get a proper reading:

      Maybe it has something to do with the way that I built? Or could it be in a difference between your repository, Giulio, and the one of Jonathan?

      The issue had been there since January 2023. Fixed now, see if it works for you.

      I can confirm that the TrillRaw and TrillCentroids now work simultaneously again. Great, thanks, Guilio!