Created
June 19, 2022 12:28
-
-
Save egorsmkv/6d1f6d7cf8a05dd9b42d2e3f4d628847 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torchaudio | |
from speechbrain.pretrained import VAD | |
VAD = VAD.from_hparams(source="speechbrain/vad-crdnn-libriparty", savedir="pretrained_models/vad-crdnn-libriparty") | |
test_file = 'a.wav' | |
boundaries = VAD.get_speech_segments(test_file) | |
segments = VAD.get_segments(boundaries, test_file) | |
for idx, s in enumerate(segments): | |
segment_file = f'segments-dir/segment_{idx}.wav' | |
torchaudio.save(segment_file, s.cpu(), 16000) | |
print(segment_file, 'saved') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment