combine 2 audio sounds together
Show older comments
I have two audio files with the same length and sample rate. I would like to sum these two signals together to create a new signal: sum[n] = audio1[n] + audio2[n]*(-1)^n.
I would like to know how to implement these operations using MATLAB.
thank!
Answers (1)
Image Analyst
on 26 Feb 2023
Don't use "sum" as the name of your variable since that is a very important function that you'll no longer be able to use if you do that.
theSum = mean([audio1; audio2]);
If you want you can transform audio2 like
weights = (-1) .^ (1:n)
audio2 = audio2 .* weights;
before you do the sum
Categories
Find more on Audio I/O and Waveform Generation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!