Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

23
LINES

< > BotCompany Repo | #1024610 // audio_findSpeechPartsFromVolumeProfile

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2444L/15K).

1  
// profileSamplingInterval: seconds per profile entry
2  
static L<DoubleRange> audio_findSpeechPartsFromVolumeProfile(float[] profile, double profileSamplingInterval, O... _) {
3  
  optPar double volumeThreshold = 0.15;
4  
  //optPar double minSpeechDuration = 0.2;
5  
  optPar double minSilenceDuration = 0.5;
6  
  optPar double pre = 0.2;
7  
  optPar double post = 0.2;
8  
  
9  
  //int minSpeech = iround(minSpeechDuration/profileSamplingInterval);
10  
  int minSilence = iround(minSilenceDuration/profileSamplingInterval);
11  
  int preTicks = iround(pre/profileSamplingInterval);
12  
  int postTicks = iround(post/profileSamplingInterval);
13  
  
14  
  new BitSet bs;
15  
  for i over profile:
16  
    if (profile[i] >= volumeThreshold)
17  
      bs.set(i);
18  
  
19  
  removeNonStreaksFromBitSetShorterThan(bs, minSilence);
20  
  extendStreaksInBitSet(bs, preTicks, postTicks, l(profile));
21  
  
22  
  ret map(bitSetStreaks(bs), r -> intToDoubleRange(profileSamplingInterval, r));
23  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1024610
Snippet name: audio_findSpeechPartsFromVolumeProfile
Eternal ID of this version: #1024610/7
Text MD5: d50665368a1e3ca69e186d7ceb012462
Transpilation MD5: 87547eb884d4c6223deda325fc4f60d6
Author: stefan
Category: javax / sound
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-21 14:31:34
Source code size: 936 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 221 / 327
Version history: 6 change(s)
Referenced in: [show references]