How to play and merge/mix 2 wav files
조회 수: 4 (최근 30일)
이전 댓글 표시
Hi,
Basically I want to merge the two wav files so that both music or voice annotates and play the a sound(i.e., you can hear both the voice and the music), and than save as a new wav file.
I am thinking of creating a merge/play button, but I do not know how to go about it. Any help would be much appreciated. Thank you.
댓글 수: 0
채택된 답변
Walter Roberson
2016년 11월 29일
Please review http://www.mathworks.com/matlabcentral/answers/313351-how-can-i-merge-two-audio-files-mp3-wav-to-be-able-to-hear-them-playing-both-together-in-the-same for information on merging sounds.
With regards to a Merge/Play button: create the button ahead of time in GUIDE, but set the default properties for it as 'Visible', 'off' . Then, in your code, as soon as you have verified that you have both inputs so the conditions are right for allowing merging, set the button 'Visible' property to 'on'.
댓글 수: 2
Walter Roberson
2016년 11월 29일
You should not use two audio players at the same time, as you have little control over synchronizing them. If your input is at two different sampling frequencies then you should resample() the lower rate one to a higher rate.
nrow = max(size(data1, 1), size(data2, 1));
out = zeros(nrow, 2);
out(1 : size(data1, 1), 1) = data1(:,1);
out(1 : size(data2, 1), 2) = data2(:,1);
now you can play out and the two will appear on left and right ear.
Walter Roberson
2016년 11월 30일
Please post your current version.
Are you input sounds mono or stereo?
Are they to be played one on the left channel and one on the right channel, or are they to be averaged together?
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Audio and Video Data에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!