Home » Python » numpy – Using dtw package for Python, I'm able to analyze only a small subset of a 5-sec. clip of audio – how can I analyze the whole clip?-Exceptionshub

numpy – Using dtw package for Python, I'm able to analyze only a small subset of a 5-sec. clip of audio – how can I analyze the whole clip?-Exceptionshub

Posted by: admin February 24, 2020 Leave a comment

Questions:

In Python 3, running code in a Jupyter notebook from the dtw package (https://dynamictimewarping.github.io/python/), I find that I’m only able to analyze a subset of a 5-sec. clip of audio. I’m trying to match two clips of audio saying roughly the same thing. When I select the first 40,000 points (out of 130,000) of the Numpy Array I get a reasonable result, i.e. it seems to work but when I try the full array the Kernel always crashes. Is there something I’m missing or has anyone had a similar experience? Here’s what the code looks like if that helps (after appropriate packages have been installed and libraries imported):

aligning = dtw(Spoken_Ramz, Sung_Ramz, keep_internals=True)

dtw(Spoken_Ramz, Sung_Ramz, keep_internals=True, 
step_pattern=rabinerJuangStepPattern(6, "c"))\
.plot(type="twoway",offset=-2)

wq = warp(aligning, index_reference=False)

plt.plot(Sung_Ramz);
plt.plot(Spoken_Ramz[wq]);
plt.gca().set_title("Warping Spoken_Ramz")

Again, an abbreviated section of the Numpy Array works, so aligning Spoken_Ramz[1000:40000] with Sung_Ramz[1000:40000] is fine and yields expected results:

Dtw of the two time series

Thanks in advance! 🙂

How to&Answers: