// profileSamplingInterval: seconds per profile entry static L audio_findSpeechPartsFromVolumeProfile(float[] profile, double profileSamplingInterval, O... _) { optPar double volumeThreshold = 0.15; //optPar double minSpeechDuration = 0.2; optPar double minSilenceDuration = 0.5; optPar double attack = 0.2; optPar double release = 0.2; //int minSpeech = iround(minSpeechDuration*profileSamplingInterval); int minSilence = iround(minSilenceDuration/profileSamplingInterval); new BitSet bs; for i over profile: if (profile[i] >= volumeThreshold) bs.set(i); removeNonStreaksFromBitSetShorterThan(minSilence); ret map(bitSetStreaks(bs), r -> intToDoubleRange(profileSamplingInterval, r)); }