提交 57e58ef0 编写于 作者: T Tao Luo 提交者: GitHub

Merge pull request #177 from luotao1/setup

update installation of libsndfile, add unitest of soundfile
...@@ -10,6 +10,7 @@ unittest(){ ...@@ -10,6 +10,7 @@ unittest(){
cd $1 > /dev/null cd $1 > /dev/null
if [ -f "setup.sh" ]; then if [ -f "setup.sh" ]; then
sh setup.sh sh setup.sh
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
fi fi
if [ $? != 0 ]; then if [ $? != 0 ]; then
exit 1 exit 1
......
...@@ -8,9 +8,6 @@ Please replace `$PADDLE_INSTALL_DIR` with your own paddle installation directory ...@@ -8,9 +8,6 @@ Please replace `$PADDLE_INSTALL_DIR` with your own paddle installation directory
sh setup.sh sh setup.sh
export LD_LIBRARY_PATH=$PADDLE_INSTALL_DIR/Paddle/third_party/install/warpctc/lib:$LD_LIBRARY_PATH 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 ## Usage
### Preparing Data ### Preparing Data
......
wget==3.2 wget==3.2
scipy==0.13.1 scipy==0.13.1
resampy==0.1.5 resampy==0.1.5
https://github.com/kpu/kenlm/archive/master.zip SoundFile==0.9.0.post1
python_speech_features python_speech_features
https://github.com/kpu/kenlm/archive/master.zip
...@@ -9,22 +9,21 @@ if [ $? != 0 ]; then ...@@ -9,22 +9,21 @@ if [ $? != 0 ]; then
exit 1 exit 1
fi fi
# install package Soundfile # install package libsndfile
curl -O "http://www.mega-nerd.com/libsndfile/files/libsndfile-1.0.28.tar.gz" python -c "import soundfile"
if [ $? != 0 ]; then if [ $? != 0 ]; then
echo "Download libsndfile-1.0.28.tar.gz failed !!!" echo "Install package libsndfile into default system path."
exit 1 curl -O "http://www.mega-nerd.com/libsndfile/files/libsndfile-1.0.28.tar.gz"
fi if [ $? != 0 ]; then
tar -zxvf libsndfile-1.0.28.tar.gz echo "Download libsndfile-1.0.28.tar.gz failed !!!"
cd libsndfile-1.0.28 exit 1
./configure && make && make install fi
cd - tar -zxvf libsndfile-1.0.28.tar.gz
rm -rf libsndfile-1.0.28 cd libsndfile-1.0.28
rm libsndfile-1.0.28.tar.gz ./configure && make && make install
pip install SoundFile==0.9.0.post1 cd ..
if [ $? != 0 ]; then rm -rf libsndfile-1.0.28
echo "Install SoundFile failed !!!" rm libsndfile-1.0.28.tar.gz
exit 1
fi fi
# prepare ./checkpoints # prepare ./checkpoints
......
"""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()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册