Forensic-Noise-Classifier / utils /vad_segmentation.py
Knight-coderr's picture
Upload 6 files
0f06115 verified
raw
history blame
308 Bytes
import torchaudio
from pyannote.audio import Pipeline
pipeline = Pipeline.from_pretrained("pyannote/voice-activity-detection")
def detect_speech_segments(audio_path):
vad_result = pipeline(audio_path)
return [(segment.start, segment.end) for segment in vad_result.get_timeline().support()]