Skip to content

Commit 918afb6

Browse files
committed
use libsoundfile
1 parent c0973c4 commit 918afb6

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

.travis.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ python:
66
- "3.5"
77

88
before_install:
9-
- pip install -U pip
9+
- sudo apt-get install -y libsndfile1
1010

1111
install:
12+
- pip install -U pip
1213
- pip install -r requirements.txt
1314
- bash download_vocoder.sh
1415
- python setup.py build_ext --inplace

demo.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
matplotlib.use('Agg') # Remove this line if you don't need them
1111
import matplotlib.pyplot as plt
1212

13-
# import soundfile as sf
14-
import librosa
13+
import soundfile as sf
14+
# import librosa
1515
import pyworld as pw
1616

1717

@@ -56,8 +56,8 @@ def main(args):
5656
rmtree('test')
5757
os.mkdir('test')
5858

59-
# x, fs = sf.read('utterance/vaiueo2d.wav')
60-
x, fs = librosa.load('utterance/vaiueo2d.wav', dtype=np.float64)
59+
x, fs = sf.read('utterance/vaiueo2d.wav')
60+
# x, fs = librosa.load('utterance/vaiueo2d.wav', dtype=np.float64)
6161

6262
# 1. A convient way
6363
f0, sp, ap, pyDioOpt = pw.wav2world(x, fs) # use default options
@@ -76,14 +76,17 @@ def main(args):
7676
_sp = pw.cheaptrick(x, _f0, t, fs)
7777
_ap = pw.d4c(x, _f0, t, fs)
7878
_y = pw.synthesize(_f0, _sp, _ap, fs, pyDioOpt.option['frame_period'])
79-
librosa.output.write_wav('test/y_without_f0_refinement.wav', _y, fs)
79+
# librosa.output.write_wav('test/y_without_f0_refinement.wav', _y, fs)
80+
sf.write('test/y_without_f0_refinement.wav', _y, fs)
81+
8082

8183
# 2-2 With F0 refinement (using stonemask)
8284
f0 = pw.stonemask(x, _f0, t, fs)
8385
sp = pw.cheaptrick(x, f0, t, fs)
8486
ap = pw.d4c(x, f0, t, fs)
8587
y = pw.synthesize(f0, sp, ap, fs, pyDioOpt.option['frame_period'])
86-
librosa.output.write_wav('test/y_with_f0_refinement.wav', y, fs)
88+
# librosa.output.write_wav('test/y_with_f0_refinement.wav', y, fs)
89+
sf.write('test/y_with_f0_refinement.wav', y, fs)
8790

8891
# Comparison
8992
savefig('test/wavform.png', [x, _y, y])

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ numpy
22
matplotlib
33
argparse
44
cython
5-
librosa
5+
pysoundfile

0 commit comments

Comments
 (0)