Triggering samples through respiration sensor

Hello !
I currently have a conductive cord sensor that I use to ‘measure’ breathing from the diaphragm going into Arduino and then through serial communication into SuperCollider. The value is a rate of change already mapped from 0 to 1. It is a very delicate sensor, and usually even in resting position it goes from 0.00, 0.01 but usually not more than that. In the current iteration the common max val is 0.08, only achieving 0.12 or so when the sensor is super under stress.
I have done some experimentations with the sensor and a microphone (a reverb and pitch-shift controlled by the breathing of the same performer), and I am currently trying to use the same idea to control samples through granular synthesis. Here is a video of the respiration sensor with the mic: https://vimeo.com/665734016?share=copy .

I have been trying to get the sample triggered, or at least audible, only when there’s significant movement but I haven’t find a solution yet. My last try was to map the gain (amp) of the sample with the values of the rate of change of the sensor, it kind of works except when the value is 0.01 (no movement) but the sample is triggered/audible anyways. This happens on two out of three samples I am using. Here is an example:

//macaw
(
~macaw = {
	arg tri = 0.5, dur = 5, pos =0.1, out = 0, amp = 0.2, mixR = 0.4, room = 0.3, damp = 0.2;
	var sig, verb;
		sig = GrainBuf.ar(
		2,
		Dust.ar([tri, tri*2]),
		dur,
		c,
		1,
		LFNoise1.ar(pos).range(0,1),
		2,
		0,
		-1,
		512
	);
	verb = FreeVerb.ar(sig, mixR, room, damp);
	sig = XFade2.ar(sig, verb, mixR);
	sig = sig*amp;
	Out.ar(out,sig);

}.play;
)

//control macaw :heart:

(
Tdef(\control, {
	{
	~macaw.set(\tri, ~val.lincurve(0.00, 0.08, 0, 0.5); \pos, ~val; \dur, ~val.lincurve(0.00, 0.08, 0.02, 5),\amp, ~val.lincurve(0.00, 0.08, 0.00, 0.2)) ;
	0.01.wait;
	}.loop;
}).play
)

Is there a way for it to be silent on 0.00 and 0.01 values?
Maybe lincurve is not the method to use, but I am unaware of how I could change it.

Any directions welcome!
Thank you
Carla

This gives you a signal to noise ratio of about 9db, which isn’t much.

10 * log10( 0.08 / 0.01) == ~9db

Is it possible to try making the whole thing tighter, so it moves between the range of say 0.5 - 0.8? This might improve the signal to noise ratio.

you can replace the lincurve to a higher first value to ignore lower values

~val.lincurve(0.01, 0.08, 0.00, 0.2)

Depends on what you mean by movement, rate of change is the velocity, but you could also use a leaky integrator or some combination of…

Integrator.kr( Slope.kr(in).abs, 0.99)

This will get large during moments of lots of change in position then slowly fade out as the sensors stays still, this might be what you want? You might need to scale the values and clip it.