Amplification correlation for signal processing

2 ビュー (過去 30 日間)
Jonathan La Combe
Jonathan La Combe 2018 年 11 月 19 日
コメント済み: Hamza Ashraf 2020 年 8 月 21 日
I'm trying to write a program that takes two audio files and matches one to the other as best it can before subtracting it. To do this I've implemented a cross correlation function to handel time shift, but I am unsure how to do something similar to that for amplification. So if I were to give the program two audio files, one of which is just a quieter version of the other one the program should amplify the quieter one to match the other, then subtract and end up with silence. What functions could I used to acheive what I am looking for?

採用された回答

Dimitris Kalogiros
Dimitris Kalogiros 2018 年 11 月 20 日
編集済み: Dimitris Kalogiros 2018 年 11 月 20 日
Suppose that you have two (discrete time) signals x[n] and y[n] where .
You can make them "unity energy" by using the following formulas:
Now these two signals x1[n] and y1[n] have equal power (=1) and you can correlate them as you've described.
Also, have a look at the following code:
pow.jpg
clearvars; clc; close all;
% creation of signals
N=1024;
n=0:N-1;
x=sin(2*pi*(2^-7).*n);
y=2*sin(2*pi*(2^-7).*n+pi/4);
% justify its power
x1=x/sqrt(mean(x.^2));
y1=y/sqrt(mean(y.^2));
%plots
figure;
subplot(2,1,1);
plot(x); hold on;
plot(y); grid on; zoom on;
legend('x', 'y');
subplot(2,1,2);
plot(x1); hold on;
plot(y1); grid on; zoom on;
legend('x1', 'y1');
  3 件のコメント
Dimitris Kalogiros
Dimitris Kalogiros 2018 年 11 月 20 日
...then "accept" my answer
Hamza Ashraf
Hamza Ashraf 2020 年 8 月 21 日
hi sir the above code reduces the signal y. i want to know how to increase amplitude of x to match y

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpectral Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by