!7 import static x30_pkg.x30_util.VF1; sclass ListenOnNoise > DynPrintLog { float threshold = 20f; transient VF1 audioListener; transient float lastVolume; transient Q q; void start { ownTimer(q = startQ()); audioListener = voidfunc(short[] data) { // Quickly calculate the volume final float vol = shortSamplesToPercentVolume(data); // Do everything else in our own thread q.add(r { //print("vol: " + vol); if (vol >= threshold && lastVolume < threshold) { printWithTime("Got noise (" + iround(vol) + "%)"); O katze = dm_getModule(dm_requireModule("#1016461/Katze")); call(katze, 'listenJustOnce); } lastVolume = vol; }); }; // Link to audio input module dm_addAudioListener(audioListener); } }