コード例 #1
0
ファイル: test_config.py プロジェクト: vskynet/fastaudio
def test_load_audio_with_basic_config():
    """
    Grab a random file, test that the n_fft are passed successfully
    via config and stored in sg settings
    """
    sg_cfg = AudioConfig.BasicSpectrogram(n_fft=2000, hop_length=155)
    a2sg = AudioToSpec.from_cfg(sg_cfg)
    audio = test_audio_tensor()
    sg = a2sg(audio)
    assert sg.n_fft == sg_cfg.n_fft
    assert sg.width == int(audio.nsamples / sg_cfg.hop_length) + 1
コード例 #2
0
def test_load_audio_with_basic_config():
    """
    Grab a random file, test that the n_fft are passed successfully
    via config and stored in sg settings
    """
    p = untar_data(URLs.SAMPLE_SPEAKERS10)
    f = p / "train/f0001_us_f0001_00001.wav"
    oa = OpenAudio([f])
    sg_cfg = AudioConfig.BasicSpectrogram(n_fft=2000, hop_length=155)
    a2sg = AudioToSpec.from_cfg(sg_cfg)
    sg = a2sg(oa(0))
    assert sg.n_fft == sg_cfg.n_fft
    assert sg.width == int(oa(0).nsamples / sg_cfg.hop_length) + 1
コード例 #3
0
def test_basic_config():
    "Make sure mel setting is passed down and is false for normal spectro"
    sg_cfg = AudioConfig.BasicSpectrogram()
    assert sg_cfg.mel == False
コード例 #4
0
def test_sg_roll():
    roll = SGRoll()
    audio = test_audio_tensor()
    a2s = AudioToSpec.from_cfg(AudioConfig.BasicSpectrogram())
    inp, out = apply_transform(roll, a2s(audio))
    _test_ne(inp, out)
コード例 #5
0
def test_signal_shift_on_sg():
    audio = test_audio_tensor()
    a2s = AudioToSpec.from_cfg(AudioConfig.BasicSpectrogram())
    shifter = SignalShifter(1, 1)
    inp, out = apply_transform(shifter, a2s(audio))
    _test_ne(inp, out)