blob: 7c75358d55935e6104e71619052bcaa032e37b6f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
from pathlib import Path
import sys
import numpy as np
import pytest
import soundfile as sf
# Support running the suite before the project is installed.
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src"))
from voiceforge.config import resolve
from voiceforge.setup import ensure_ffmpeg
@pytest.fixture
def progress():
return lambda *_: None
@pytest.fixture
def wav(tmp_path):
def write(samples=None, *, rate=48000, name="input.wav"):
if samples is None:
time = np.arange(rate * 3) / rate
samples = 0.15 * np.sin(2 * np.pi * 440 * time)
path = tmp_path / name
sf.write(path, np.asarray(samples), rate, format="WAV", subtype="FLOAT")
return path
return write
@pytest.fixture
def bypass():
return resolve(profile="cleanup-only", overrides={"denoiser": "none", "highpass": False})
@pytest.fixture
def ffmpeg():
try:
return ensure_ffmpeg()
except RuntimeError as error:
pytest.skip(str(error))
|