blob: 98826ae0b724d3e0573ccb322a1e9f37b22310b9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
import numpy as np
import pytest
from mic_clipper.vad import FRAME_SAMPLES, SileroVad
def test_bundled_silero_vad_accepts_512_samples_and_returns_probability():
vad = SileroVad()
probability = vad.probability(np.zeros(FRAME_SAMPLES, dtype=np.float32))
assert 0.0 <= probability <= 1.0
def test_bundled_silero_vad_rejects_non_512_sample_frames():
vad = SileroVad()
with pytest.raises(ValueError, match="512"):
vad.probability(np.zeros(FRAME_SAMPLES - 1, dtype=np.float32))
|