Closed kylebgorman closed 4 years ago
Hi @kylebgorman, is this the full error you encountered?
$ env PATH=/tmp/htk-build/bin.cpu:$PATH python3 -m aligner -a /tmp/align -d skunk.dict
Resampling '/tmp/align/redwall-test.wav'.
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/skunk/prog/prosodylab-aligner/aligner/__main__.py", line 126, in <module>
corpus = Corpus(args.align, opts)
File "/home/skunk/prog/prosodylab-aligner/aligner/corpus.py", line 91, in __init__
self._prepare_audio(audiofiles)
File "/home/skunk/prog/prosodylab-aligner/aligner/corpus.py", line 210, in _prepare_audio
w.resample_bang(self.samplerate)
File "/home/skunk/prog/prosodylab-aligner/aligner/wavfile.py", line 79, in resample_bang
self.signal = self._resample(Fs_out)
File "/home/skunk/prog/prosodylab-aligner/aligner/wavfile.py", line 72, in _resample
resampled_signal = resample(self.signal, ratio * len(self))
File "/usr/lib/python3/dist-packages/scipy/signal/signaltools.py", line 2234, in resample
Y = zeros(newshape, 'D')
TypeError: 'float' object cannot be interpreted as an integer
Assuming the error is the same, PR #77 should fix it.
Closed in #77.
There's no real reason one would want the aligner to try to upsample, since that's just adding notional zeros, but it will attempt to do so if the sample rate in the configuration file is set higher than the input audio.
This appears to break the resampling code itself. For instance I get this error when the input audio is 8kHz but the desired samplerate is 16kHz:
File "/home/kbg/.venv/python3.6/lib/python3.6/site-packages/scipy/signal/signaltools.py", line 1889, in resample Y = zeros(newshape, 'D')
The obvious solution is to check that nobody's trying to do this before resampling.