Skip to contents

Applies a DTW alignment path to warp one waveform to match another.

Usage

dtwWarp(x, dtw_result, to = c("query", "reference"))

Arguments

x

Waveform to warp.

dtw_result

DTW result from dtwDistance().

to

Which series to warp to: "query" (index1) or "reference" (index2).

Value

Warped waveform.

References

Sakoe H, Chiba S (1978). "Dynamic programming algorithm optimization for spoken word recognition." IEEE Transactions on Acoustics, Speech, and Signal Processing, 26(1), 43-49.

Examples

x <- sin(seq(0, pi, length.out = 100)) * 30
y <- sin(seq(0, pi, length.out = 100) + 0.3) * 30
dr <- dtwDistance(x, y)
warped <- dtwWarp(x, dr)
length(warped)
#> [1] 100