Use DTW to Compare Recordings
Import, trim, and preprocess four recordings of the first sentence of Alice in Wonderland.
show complete Wolfram Language input
In[2]:=
alice = ConformAudio[
MapThread[
AudioNormalize[
AudioChannelMix[AudioTrim[AudioResample[Import[#1], 11025], #2],
1]] &, {urls, times}]]
Out[2]=
Show the plots for the signals.
In[3]:=
AudioPlot[alice, ImageSize -> Medium]
Out[3]=
Compute and plot the MFCC features for the samples.
In[4]:=
mfcc = AudioLocalMeasurements[#, "MFCC",
PartitionGranularity -> {.05, .01}]["Values"] & /@ alice;
In[5]:=
Column[MatrixPlot[#, PlotTheme -> "Minimal", ImageSize -> Medium] & /@
Transpose /@ mfcc]
Out[5]=
Compute the dynamic time warping distance between the recordings using WarpingDistance.
In[6]:=
DistanceMatrix[mfcc,
DistanceFunction -> WarpingDistance] // MatrixPlot
Out[6]=
Compute the dynamic time warping correspondence between two of the recordings using WarpingCorrespondence.
In[7]:=
{n, m} = WarpingCorrespondence[mfcc[[1]], mfcc[[2]]];
show complete Wolfram Language input
Out[8]=