test case

This commit is contained in:
WeberJulian 2021-03-05 18:50:03 +01:00 committed by Eren Gölge
parent e954e45e57
commit f6cd8e0ecc
4 changed files with 21 additions and 5 deletions

View File

@ -1,8 +1,8 @@
import argparse
import glob
import os
import shutil
import librosa
from distutils.dir_util import copy_tree
from argparse import RawTextHelpFormatter
from multiprocessing import Pool
from tqdm import tqdm

16
tests/test_resample.sh Executable file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -xe
BASEDIR=$(dirname "$0")
TARGET_SR=16000
echo "$BASEDIR"
#run the resample script
python TTS/bin/resample.py --input_dir $BASEDIR/data/ljspeech --output_dir $BASEDIR/outputs/resample_tests --output_sr $TARGET_SR
#check samplerate of output
OUT_SR=$( (echo "import librosa" ; echo "y, sr = librosa.load('"$BASEDIR"/outputs/resample_tests/wavs/LJ001-0012.wav', sr=None)" ; echo "print(sr)") | python )
OUT_SR=$(($OUT_SR + 0))
if [[ $OUT_SR -ne $TARGET_SR ]]; then
echo "Missmatch between target and output sample rates"
exit 1
fi
#cleaning up
rm -rf $BASEDIR/outputs/resample_tests

View File

@ -4,7 +4,7 @@ import torch
import soundfile as sf
from librosa.core import load
from tests import get_tests_path, get_tests_input_path
from tests import get_tests_path, get_tests_input_path, get_tests_output_path
from TTS.vocoder.layers.pqmf import PQMF
@ -24,4 +24,4 @@ def test_pqmf():
print(w2_.max())
print(w2_.min())
print(w2_.mean())
sf.write('pqmf_output.wav', w2_.flatten().detach(), sr)
sf.write(os.path.join(get_tests_output_path(),'pqmf_output.wav'), w2_.flatten().detach(), sr)

View File

@ -4,7 +4,7 @@ import tensorflow as tf
import soundfile as sf
from librosa.core import load
from tests import get_tests_path, get_tests_input_path
from tests import get_tests_path, get_tests_input_path, get_tests_output_path
from TTS.vocoder.tf.layers.pqmf import PQMF
@ -25,4 +25,4 @@ def test_pqmf():
print(w2_.max())
print(w2_.min())
print(w2_.mean())
sf.write('tf_pqmf_output.wav', w2_.flatten(), sr)
sf.write(os.path.join(get_tests_output_path(),'tf_pqmf_output.wav'), w2_.flatten(), sr)