dynamic menu dropdowns,
renamed functions in Select, moved not working functions to NotWorking
This commit is contained in:
54
src/NotWorking/AnuragDampenTarget.m
Normal file
54
src/NotWorking/AnuragDampenTarget.m
Normal file
@@ -0,0 +1,54 @@
|
||||
function output_x = AnuragDampenTarget(x, Fs,LOW, MID, HIGH)
|
||||
%Dampen a range of frequencies a percentage around the target frequency
|
||||
%Also maintain the other frequencies so that the target is muted
|
||||
%percentage is expressed as a number between 0 and 1.
|
||||
%target is the midpoint of the frequency range to dampen
|
||||
%x and Fs are the signal and frequency
|
||||
% CONTRIBUTORS:
|
||||
% Anurag Jadhav: function creator
|
||||
|
||||
% Detailed explanation goes here
|
||||
TARGET = MID;
|
||||
AreaPercentage = 0.15;
|
||||
[dim,len] = size(x); %get length of the input
|
||||
F = Fs * ((-len/2) : ((len/2) - 1)) / len;
|
||||
lenf = length(F);
|
||||
Mod_Freq = ifft(fft(x)); %Fourier Transform of the input signal
|
||||
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
|
||||
lowerBound = (1-AreaPercentage) * TARGET;
|
||||
upperBound = (1+AreaPercentage) * TARGET;
|
||||
%% Dampen the target frequencies and maintain the others
|
||||
if(dim == 2) %iterate through both channels if track is dual channel
|
||||
for n = 1:lenf
|
||||
if ((lowerBound < abs(F(1,n))) && abs(F(1,n)) < upperBound)
|
||||
output(1,n) = 1;
|
||||
else
|
||||
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
|
||||
%%Filter the original signal and transform
|
||||
filtered_Mod_Freq = fftshift(Mod_Freq .* output);
|
||||
output_x = real(ifft(filtered_Mod_Freq));
|
||||
|
||||
end
|
54
src/NotWorking/AnuragEnhanceTarget.m
Normal file
54
src/NotWorking/AnuragEnhanceTarget.m
Normal file
@@ -0,0 +1,54 @@
|
||||
function output_x = AnuragEnchanceTarget(x, Fs,LOW, MID, HIGH)
|
||||
%Amplify a range of frequencies a percentage around the target frequency
|
||||
%Also damnpen the other frequencies so that the target is easier to hear
|
||||
%percentage is expressed as a number between 0 and 1.
|
||||
%target is the midpoint of the frequency range to amplify
|
||||
%x and Fs are the signal and frequency
|
||||
% CONTRIBUTORS:
|
||||
% Anurag Jadhav: function creator
|
||||
|
||||
% Detailed explanation goes here
|
||||
TARGET = MID;
|
||||
AreaPercentage = 0.15;
|
||||
[dim,len] = size(x); %get length of the input
|
||||
F = Fs * ((-len/2) : ((len/2) - 1)) / len;
|
||||
lenf = length(F);
|
||||
Mod_Freq = ifft(fft(x)); %Fourier Transform of the input signal
|
||||
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
|
||||
lowerBound = (1-AreaPercentage) * TARGET;
|
||||
upperBound = (1+AreaPercentage) * TARGET;
|
||||
%% Amplify the target frequencies and dampen the others
|
||||
if(dim == 2) %iterate through both channels if track is dual channel
|
||||
for n = 1:lenf
|
||||
if ((lowerBound < abs(F(1,n))) && abs(F(1,n)) < upperBound)
|
||||
output(1,n) = 2;
|
||||
else
|
||||
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
|
||||
%%Filter the original signal and transform
|
||||
filtered_Mod_Freq = fftshift(Mod_Freq .* output);
|
||||
output_x = real(ifft(filtered_Mod_Freq));
|
||||
|
||||
end
|
@@ -1,26 +1,30 @@
|
||||
% An audio is distorted based on the value of HIGH. Nothing of a certain
|
||||
% threshold should be played above this constant, or they are simply clipped to this
|
||||
% value. Inspired from Meghaj_Echo.m and epic_effect_schluep.m.
|
||||
% Author: Jason Liang
|
||||
|
||||
function y = distortion_filter(x, HIGH)
|
||||
len = length(X);
|
||||
X = fft(x);
|
||||
X = fftshift(X);
|
||||
Y = zeros(1, len);
|
||||
|
||||
for ind = 1:len
|
||||
if (X(ind) > HIGH)
|
||||
Y(ind) = HIGH;
|
||||
elseif (X(ind) < -HIGH)
|
||||
Y(ind) = -HIGH;
|
||||
else
|
||||
Y(ind) = X(ind);
|
||||
end
|
||||
end
|
||||
|
||||
Y = fftshift(Y);
|
||||
y = ifft(Y);
|
||||
y = real(y);
|
||||
|
||||
end
|
||||
% An audio is distorted based on the value of HIGH. Nothing of a certain
|
||||
% threshold should be played above this constant, or they are simply clipped to this
|
||||
% value. Inspired from Meghaj_Echo.m and epic_effect_schluep.m.
|
||||
% Author: Jason Liang
|
||||
% Mekhi Ellington: Added some comments and editted formatting
|
||||
|
||||
function y = distortion_filter(x, HIGH)
|
||||
len = length(X); %Storing length of X.
|
||||
X = fft(x); %X is the Fourier Transform of x.
|
||||
X = fftshift(X); %Shifts X.
|
||||
Y = zeros(1, len); %Matrix of length containing zeros.
|
||||
|
||||
for ind = 1:len
|
||||
if (X(ind) > HIGH)
|
||||
Y(ind) = HIGH;
|
||||
|
||||
elseif (X(ind) < -HIGH)
|
||||
Y(ind) = -HIGH;
|
||||
|
||||
else
|
||||
Y(ind) = X(ind);
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
Y = fftshift(Y); %Shifts Y.
|
||||
y = ifft(Y); %Inverse Fourier Transform of Y.
|
||||
y = real(y); %Stores only the real part of the complex y.
|
||||
|
||||
end
|
Reference in New Issue
Block a user