diff --git a/.travis/unittest.sh b/.travis/unittest.sh index ad223eb4a9c1f57896762ad38d0b3fa5de5c496b..4195a441eac5f091e49b6203dbd2c637fee6ab69 100755 --- a/.travis/unittest.sh +++ b/.travis/unittest.sh @@ -10,6 +10,7 @@ unittest(){ cd $1 > /dev/null if [ -f "setup.sh" ]; then sh setup.sh + export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH fi if [ $? != 0 ]; then exit 1 diff --git a/deep_speech_2/README.md b/deep_speech_2/README.md index 3010c0e536da732f1c4f042c82badaae21179f87..22d0c5386c54c23966cfc9355d1d67756a37b594 100644 --- a/deep_speech_2/README.md +++ b/deep_speech_2/README.md @@ -8,9 +8,6 @@ Please replace `$PADDLE_INSTALL_DIR` with your own paddle installation directory sh setup.sh export LD_LIBRARY_PATH=$PADDLE_INSTALL_DIR/Paddle/third_party/install/warpctc/lib:$LD_LIBRARY_PATH ``` - -For some machines, we also need to install libsndfile1. Details to be added. - ## Usage ### Preparing Data diff --git a/deep_speech_2/requirements.txt b/deep_speech_2/requirements.txt index 721fa2811081e530a9cec3b2e403ad2372b59269..3f73ea8b8085324b3691c6af44915f0d09888221 100755 --- a/deep_speech_2/requirements.txt +++ b/deep_speech_2/requirements.txt @@ -1,5 +1,6 @@ wget==3.2 scipy==0.13.1 resampy==0.1.5 -https://github.com/kpu/kenlm/archive/master.zip +SoundFile==0.9.0.post1 python_speech_features +https://github.com/kpu/kenlm/archive/master.zip diff --git a/deep_speech_2/setup.sh b/deep_speech_2/setup.sh index 8cba91ecdb68b42125181331471f9ee323062a24..4d451a6f16ab56bb52bdf3cf0998e680b6d3b243 100644 --- a/deep_speech_2/setup.sh +++ b/deep_speech_2/setup.sh @@ -9,22 +9,21 @@ if [ $? != 0 ]; then exit 1 fi -# install package Soundfile -curl -O "http://www.mega-nerd.com/libsndfile/files/libsndfile-1.0.28.tar.gz" +# install package libsndfile +python -c "import soundfile" if [ $? != 0 ]; then - echo "Download libsndfile-1.0.28.tar.gz failed !!!" - exit 1 -fi -tar -zxvf libsndfile-1.0.28.tar.gz -cd libsndfile-1.0.28 -./configure && make && make install -cd - -rm -rf libsndfile-1.0.28 -rm libsndfile-1.0.28.tar.gz -pip install SoundFile==0.9.0.post1 -if [ $? != 0 ]; then - echo "Install SoundFile failed !!!" - exit 1 + echo "Install package libsndfile into default system path." + curl -O "http://www.mega-nerd.com/libsndfile/files/libsndfile-1.0.28.tar.gz" + if [ $? != 0 ]; then + echo "Download libsndfile-1.0.28.tar.gz failed !!!" + exit 1 + fi + tar -zxvf libsndfile-1.0.28.tar.gz + cd libsndfile-1.0.28 + ./configure && make && make install + cd .. + rm -rf libsndfile-1.0.28 + rm libsndfile-1.0.28.tar.gz fi # prepare ./checkpoints diff --git a/deep_speech_2/tests/test_setup.py b/deep_speech_2/tests/test_setup.py new file mode 100644 index 0000000000000000000000000000000000000000..18b9c1a0ce5333f559383b18704edf7270457fcf --- /dev/null +++ b/deep_speech_2/tests/test_setup.py @@ -0,0 +1,23 @@ +"""Test Setup.""" +import unittest +import numpy as np +import os + + +class TestSetup(unittest.TestCase): + def test_soundfile(self): + import soundfile as sf + # floating point data is typically limited to the interval [-1.0, 1.0], + # but smaller/larger values are supported as well + data = np.array([[1.75, -1.75], [1.0, -1.0], [0.5, -0.5], + [0.25, -0.25]]) + file = 'test.wav' + sf.write(file, data, 44100, format='WAV', subtype='FLOAT') + read, fs = sf.read(file) + self.assertTrue(np.all(read == data)) + self.assertEqual(fs, 44100) + os.remove(file) + + +if __name__ == '__main__': + unittest.main()