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개)

카테고리

도움말 센터 및 File Exchange에서 Audio Processing Algorithm Design에 대해 자세히 알아보기

태그

질문:

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