// 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 pre = 0.2; optPar double post = 0.2; //int minSpeech = iround(minSpeechDuration/profileSamplingInterval); int minSilence = iround(minSilenceDuration/profileSamplingInterval); int preTicks = iround(pre/profileSamplingInterval); int postTicks = iround(post/profileSamplingInterval); new BitSet bs; for i over profile: if (profile[i] >= volumeThreshold) bs.set(i); removeNonStreaksFromBitSetShorterThan(bs, minSilence); extendStreaksInBitSet(bs, preTicks, postTicks, l(profile)); ret map(bitSetStreaks(bs), r -> intToDoubleRange(profileSamplingInterval, r)); }