# Wolfram Mathematica

## Compare Audio Signals Using LPC Features

Import and preprocess two recordings.

In[1]:=
```alice1 = AudioResample[ AudioTrim[ Import["http://ia800503.us.archive.org/3/items/alices_adventures/\ aliceinwonderland_01_carroll.mp3"], {27, 27 + 60}], 11025]```
Out[1]=
In[2]:=
```alice2 = AudioResample[ AudioTrim[ Import["http://ia800306.us.archive.org/25/items/alice_wonderland_\ 0711_librivox/alice_01_carroll.mp3"], {16.5, 16.5 + 60}], 11025]```
Out[2]=

Compute the LPC features for both recordings and plot them.

In[3]:=
```{lpc1, lpc2} = AudioLocalMeasurements[#, "LPC", PartitionGranularity -> {.04, .01}]["Values"] & /@ {alice1, alice2};```
In[4]:=
```MatrixPlot[Transpose[lpc1], Frame -> True, FrameTicks -> {None, Automatic}, DataRange -> {{0, QuantityMagnitude[Duration@alice1, "s"]}, {1, 12}}, AspectRatio -> 1/8, ImageSize -> Medium]```
Out[4]=
In[5]:=
```MatrixPlot[Transpose[lpc2], Frame -> True, FrameTicks -> {None, Automatic}, DataRange -> {{0, QuantityMagnitude[Duration@alice1, "s"]}, {1, 12}}, AspectRatio -> 1/8, ImageSize -> Medium]```
Out[5]=

Compute the distance matrix for the computed features.

In[6]:=
```MatrixPlot[DistanceMatrix[lpc1, lpc2], DataRange -> {{0, QuantityMagnitude[Duration@alice1, "s"]}, {0, QuantityMagnitude[Duration@alice2, "s"]}}, ImageSize -> 300, FrameTicks -> {Automatic, Automatic}]```
Out[6]=