Merging two wav files different lengths

How can I make the length number of two wav files the same, so the wav files can be merged?
[y1,fs1] = audioread('happy.wav');
[y2,fs2] = audioread('sad.wav');
S1=length(y1);
S2=length(y2);

Answers (1)

Adam
Adam on 14 Dec 2016
Edited: Adam on 14 Dec 2016
doc interp1
if you need them the same length, but still covering the same time span. If you gave Signal Processing Toolbox then
doc resample
probably works fine too.

Asked:

on 14 Dec 2016

Edited:

on 14 Dec 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!