필터 지우기
필터 지우기

how to mix two audio signals

조회 수: 33 (최근 30일)
Stalin Samuel
Stalin Samuel 2015년 1월 19일
답변: suresh gunarathna 2020년 1월 29일
i have two audio signals y1 ,y2 .Now i wants y3 as mixture of y1 and y2

채택된 답변

W. Owen Brimijoin
W. Owen Brimijoin 2015년 1월 19일
편집: W. Owen Brimijoin 2015년 1월 20일
Simple mixing is just adding.
y3 = y1 + y2;
If you want to control the level of each within the mix, then you need to adjust them as follows:
y3 = (y1*y1_level) + (y2*y2_level);
where yx_level is based on the decibel conversion:
yx_level = 10^(level/20);
So to make signal 2 half the amplitude of signal 1, you'd use -6 dB as follows:
y3 = (y1*(10^(0/20)) + (y2*(10^(-6/20));
All of this assumes that the two signals are the same dimensions and have the same starting level.

추가 답변 (1개)

suresh gunarathna
suresh gunarathna 2020년 1월 29일
function [Y,f]=togau(A,B)
[x1,f1]=audioread(A);
[x2,f2]=audioread(B);
[l1,c1]=size(x1);
[l2,c2]=size(x2);
if l1 > l2
l=l2;
else
l=l1;
end
if(f1>=f2)
f=f1;
else
f=f2;
end
G=zeros(1,1);
t=0;
token=0;
for i=1:l
if t==f
if token==0
token=1;
t=0;
else
token=0;
t=0;
end
end
if(token==0)
G(i)=x1(i);
t=t+1;
else
G(i)=x2(i);
t=t+1;
end
end
Y=G;
audiowrite('out.wav',Y,f);
end

카테고리

Help CenterFile Exchange에서 Simulation, Tuning, and Visualization에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by