Merge branch 'main' of https://github.com/ltcptgeneral/ece45-project
This commit is contained in:
commit
f4e1a0e4de
@ -10,41 +10,20 @@ function output_x = AnuragDampenTarget(x, Fs,LOW, MID, HIGH)
|
|||||||
% Detailed explanation goes here
|
% Detailed explanation goes here
|
||||||
TARGET = MID;
|
TARGET = MID;
|
||||||
AreaPercentage = 0.15;
|
AreaPercentage = 0.15;
|
||||||
[dim,len] = size(x); %get length of the input
|
len = length(x); %get length of the input
|
||||||
F = Fs * ((-len/2) : ((len/2) - 1)) / len;
|
F = Fs * ((-len/2) : ((len/2) - 1)) / len;
|
||||||
lenf = length(F);
|
lenf = length(F);
|
||||||
Mod_Freq = ifft(fft(x)); %Fourier Transform of the input signal
|
Mod_Freq = fftshift(fft(x)); %Fourier Transform of the input signal
|
||||||
output = zeros([1,lenf]); % zero array of size Mod_freq
|
output = zeros([1,lenf]); % zero array of size Mod_freq
|
||||||
if(dim == 2) %check for dual channel audio
|
|
||||||
F = [F;F];
|
|
||||||
output = [output;output];
|
|
||||||
end
|
|
||||||
%set the bounds
|
%set the bounds
|
||||||
lowerBound = (1-AreaPercentage) * TARGET;
|
lowerBound = (1-AreaPercentage) * TARGET;
|
||||||
upperBound = (1+AreaPercentage) * TARGET;
|
upperBound = (1+AreaPercentage) * TARGET;
|
||||||
%% Dampen the target frequencies and maintain the others
|
%% Dampen the target frequencies and maintain the others
|
||||||
if(dim == 2) %iterate through both channels if track is dual channel
|
for n = 1:lenf
|
||||||
for n = 1:lenf
|
if ((lowerBound < abs(F(n))) && abs(F(n)) < upperBound)
|
||||||
if ((lowerBound < abs(F(1,n))) && abs(F(1,n)) < upperBound)
|
output(n) = 0.5;
|
||||||
output(1,n) = 1;
|
else
|
||||||
else
|
output(n) = 1;
|
||||||
output(1,n) = 0.5;
|
|
||||||
end
|
|
||||||
end
|
|
||||||
for n = 1:lenf
|
|
||||||
if ((lowerBound < abs(F(2,n))) && abs(F(2,n)) < upperBound)
|
|
||||||
output(2,n) = 1;
|
|
||||||
else
|
|
||||||
output(2,n) = .5;
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else %iterate onnly once for monochannel
|
|
||||||
for n = 1:lenf
|
|
||||||
if ((lowerBound < abs(F(n))) && abs(F(n)) < upperBound)
|
|
||||||
output(n) = 1;
|
|
||||||
else
|
|
||||||
output(n) = .5;
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
%%Filter the original signal and transform
|
%%Filter the original signal and transform
|
||||||
|
@ -10,41 +10,21 @@ function output_x = AnuragEnchanceTarget(x, Fs,LOW, MID, HIGH)
|
|||||||
% Detailed explanation goes here
|
% Detailed explanation goes here
|
||||||
TARGET = MID;
|
TARGET = MID;
|
||||||
AreaPercentage = 0.15;
|
AreaPercentage = 0.15;
|
||||||
[dim,len] = size(x); %get length of the input
|
len = length(x); %get length of the input
|
||||||
F = Fs * ((-len/2) : ((len/2) - 1)) / len;
|
F = Fs * ((-len/2) : ((len/2) - 1)) / len;
|
||||||
lenf = length(F);
|
lenf = length(F);
|
||||||
Mod_Freq = ifft(fft(x)); %Fourier Transform of the input signal
|
Mod_Freq = fftshift(fft(x)); %Fourier Transform of the input signal
|
||||||
output = zeros([1,lenf]); % zero array of size Mod_freq
|
output = zeros([1,lenf]); % zero array of size Mod_freq
|
||||||
if(dim == 2) %check for dual channel audio
|
|
||||||
F = [F;F];
|
|
||||||
output = [output;output];
|
|
||||||
end
|
|
||||||
%set the bounds
|
%set the bounds
|
||||||
lowerBound = (1-AreaPercentage) * TARGET;
|
lowerBound = (1-AreaPercentage) * TARGET;
|
||||||
upperBound = (1+AreaPercentage) * TARGET;
|
upperBound = (1+AreaPercentage) * TARGET;
|
||||||
%% Amplify the target frequencies and dampen the others
|
%% Amplify the target frequencies and dampen the others
|
||||||
if(dim == 2) %iterate through both channels if track is dual channel
|
for n = 1:lenf
|
||||||
for n = 1:lenf
|
if ((lowerBound < abs(F(n))) && abs(F(n)) < upperBound)
|
||||||
if ((lowerBound < abs(F(1,n))) && abs(F(1,n)) < upperBound)
|
output(n) = 2;
|
||||||
output(1,n) = 2;
|
else
|
||||||
else
|
output(n) = 0.75;
|
||||||
output(1,n) = 0.75;
|
|
||||||
end
|
|
||||||
end
|
|
||||||
for n = 1:lenf
|
|
||||||
if ((lowerBound < abs(F(2,n))) && abs(F(2,n)) < upperBound)
|
|
||||||
output(2,n) = 2;
|
|
||||||
else
|
|
||||||
output(2,n) = 0.75;
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else %iterate onnly once for monochannel
|
|
||||||
for n = 1:lenf
|
|
||||||
if ((lowerBound < abs(F(n))) && abs(F(n)) < upperBound)
|
|
||||||
output(n) = 2;
|
|
||||||
else
|
|
||||||
output(n) = 0.75;
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
%%Filter the original signal and transform
|
%%Filter the original signal and transform
|
||||||
|
Reference in New Issue
Block a user