I would like to concatenate two audio files such that a new audio signal is created whereby the first audio plays and this is then immedialely followed by the second.
[y1,Fs] = audioread('sample1.wav');
y1_sample_rate = 8000;
[y2,Fs] = audioread('sample2.wav');
y3 = [y1(1:y1_sample_rate,:); y2;];
What am I doing wrong?
Thank you.

1 件のコメント

Walter Roberson
Walter Roberson 2019 年 8 月 19 日
We as outside observers have no reason to expect that the two audios will be at the same rate. You should be using resample() to bring them to a common rate.
We as outside observers also have no reason to expect that the two audios will have the same number of channels.

サインインしてコメントする。

 採用された回答

Adam Danz
Adam Danz 2019 年 8 月 17 日
編集済み: Adam Danz 2019 年 8 月 19 日

0 投票

If your intentions are to subsample every 8000 values in y1 and then concatenate y2 to the end,
y3 = [y1(1:y1_sample_rate:numel(y1)); y2];
% |________| ^ no need for semicolon

その他の回答 (0 件)

タグ

質問済み:

2019 年 8 月 17 日

コメント済み:

2019 年 8 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by