Hi all,
I would like to ask for some wisdom on best ways to deal with the input of a simple piezo (contact) microphone to be used as a trigger.
I’m working on an interactive sound installation which will be based on the Bela board. However, I’m currently prototyping the system at my desk, connecting the piezo to my PC through a jack.
The final project will have different mics attached on the backside of CNC-milled wooden boards. These piezo are meant to capture the vibrations produced by a person exploring haptically these wooden interfaces, and trigger grains of a GrainBuf accordingly.
I’m currently trying to transform the noisy input of the contact mic into an effective and reliable trigger signal spiking only when there is a touch-based interaction, and somehow I managed to obtain that behaviour through the following synth, responsible for collecting audio input, processing it, and sending it to the sound synth through a bus:
(SynthDef(\dataCollection, {
var signalIn, controlSig;
signalIn = SoundIn.ar;
signalIn = BLowShelf.ar(signalIn, 150);
controlSig = signalIn * Changed.ar(signalIn, 0.0015);
controlSig = Compander.ar(controlSig, controlSig, 0.000065, 15, clampTime:0.065, relaxTime:0.1);
controlSig = Compander.ar(Impulse.kr(50), controlSig, 0.0005, 15, clampTime:0.06, relaxTime:0.8);
Out.ar(~triggerBus, controlSig);
}).add;)
Whilst this code—whose values were admittedly tweaked through a trial-and-error approach—produces nice spikes quite precisely when I touch my wooden board, within the GrainBuf object in the sound Synth I have to write, for the trigger parameter,
trigger: controlSig * Impulse.kr(1),
where controlSig is the piezo input processed by the dataCollection Synth posted above. If I keep controlSig alone, GrainBuf “fails” telling me that there are “Too Many Grains!” *
I was wondering whether someone has suggestions or experience in dealing with piezo mics and transform their input into effective triggers
Thanks a lot!
*I’m planning to replace the GrainBuf object with a granulator with supplied envelope