File size: 511 Bytes
262d511
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import auditok


def segment_audio(audio_name):
    audio_regions = auditok.split(audio_name,
    min_dur=2,     # minimum duration of a valid audio in seconds
    max_dur=8,       # maximum duration of an audio segment
    max_silence=0.8, # maximum duration of tolerated continuous silence within an event
    energy_threshold=55, # threshold of detection
    sampling_rate=16000
)

    for i, r in enumerate(audio_regions):
        filename = r.save(audio_name[:-4]+"_{meta.start:.3f}-{meta.end:.3f}.wav")