Merge branch 'main' into AnuragFilters

This commit is contained in:
TurtleEmperorx 2021-12-10 15:35:19 -08:00 committed by GitHub
commit b5f5ac0b23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 52 additions and 154 deletions

Binary file not shown.

View File

@ -26,7 +26,6 @@ function output_x = AnuragDampenTarget(x, Fs,LOW, MID, HIGH)
output(n) = 1; output(n) = 1;
end end
end end
%%Filter the original signal and transform %%Filter the original signal and transform
filtered_Mod_Freq = fftshift(Mod_Freq .* output); filtered_Mod_Freq = fftshift(Mod_Freq .* output);
output_x = real(ifft(filtered_Mod_Freq)); output_x = real(ifft(filtered_Mod_Freq));

View File

@ -15,6 +15,7 @@ function output_x = AnuragEnchanceTarget(x, Fs,LOW, MID, HIGH)
lenf = length(F); lenf = length(F);
Mod_Freq = fftshift(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
%set the bounds %set the bounds
lowerBound = (1-AreaPercentage) * TARGET; lowerBound = (1-AreaPercentage) * TARGET;
upperBound = (1+AreaPercentage) * TARGET; upperBound = (1+AreaPercentage) * TARGET;

View File

@ -2,25 +2,29 @@
% threshold should be played above this constant, or they are simply clipped to this % 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. % value. Inspired from Meghaj_Echo.m and epic_effect_schluep.m.
% Author: Jason Liang % Author: Jason Liang
% Mekhi Ellington: Added some comments and editted formatting
function y = distortion_filter(x, HIGH) function y = distortion_filter(x, HIGH)
len = length(X); len = length(X); %Storing length of X.
X = fft(x); X = fft(x); %X is the Fourier Transform of x.
X = fftshift(X); X = fftshift(X); %Shifts X.
Y = zeros(1, len); Y = zeros(1, len); %Matrix of length containing zeros.
for ind = 1:len for ind = 1:len
if (X(ind) > HIGH) if (X(ind) > HIGH)
Y(ind) = HIGH; Y(ind) = HIGH;
elseif (X(ind) < -HIGH) elseif (X(ind) < -HIGH)
Y(ind) = -HIGH; Y(ind) = -HIGH;
else else
Y(ind) = X(ind); Y(ind) = X(ind);
end end
end end
Y = fftshift(Y); Y = fftshift(Y); %Shifts Y.
y = ifft(Y); y = ifft(Y); %Inverse Fourier Transform of Y.
y = real(y); y = real(y); %Stores only the real part of the complex y.
end end

View File

@ -7,7 +7,7 @@
%Pass-through function used by app %Pass-through function used by app
function output = AmpEnvelopeSelect(input, Fs, attack,decay,sustain,release,number) function output = AmpEnvelopeSelect(input, Fs, attack,decay,sustain,release,number)
if(number == "Option 1") if(number == "Linear")
output = DarellAmplitudeEnvelope(input, Fs, attack,decay,sustain,release); output = DarellAmplitudeEnvelope(input, Fs, attack,decay,sustain,release);
else else
output = input; output = input;

View File

@ -7,22 +7,26 @@
%Pass-through function used by app %Pass-through function used by app
function output = FilterSelect(input,Fs,LOW,MED,HIGH,number) function output = FilterSelect(input,Fs,LOW,MED,HIGH,number)
if(number == "Option 1") if(number == "IdealBandPass")
output = DarellbandpassFilter(input,Fs,LOW,MED,HIGH); output = DarellbandpassFilter(input,Fs,LOW,MED,HIGH);
elseif(number == "Option 2") elseif(number == "AmplifyRange")
output = amplifyFreqRange(input, Fs, LOW, MED, HIGH); output = amplifyFreqRange(input, Fs, LOW, MED, HIGH);
elseif(number == "Option 3") %{
elseif(number == "EpicEffect")
output = epic_effect_schluep(input, Fs, LOW, MED, HIGH); output = epic_effect_schluep(input, Fs, LOW, MED, HIGH);
elseif(number == "Option 4") elseif(number == "MuffledEffect")
output = muffled_effect_schluep(input, Fs, LOW, MED, HIGH); output = muffled_effect_schluep(input, Fs, LOW, MED, HIGH);
elseif(number == "Option 5") elseif(number == "SeparatePrevalent")
output = seperate_prevalent_schluep(input, Fs, LOW, MED, HIGH); output = seperate_prevalent_schluep(input, Fs, LOW, MED, HIGH);
elseif(number == "Option 6") %}
elseif(number == "IdealBandReject")
output = bandreject_filter(input, Fs, LOW, HIGH); output = bandreject_filter(input, Fs, LOW, HIGH);
elseif(number == "Option 7") %{
output = AnuragEnhanceTarget(input, Fs, LOW,MID, HIGH); elseif(number == "EnchanceTarget")
elseif(number == "Option 8") output = AnuragEnhanceTarget(input, Fs, LOW, MED, HIGH);
output = AnuragDampenTarget(input, Fs, LOW,MID, HIGH); elseif(number == "DampenTarget")
output = AnuragDampenTarget(input, Fs, LOW, MED, HIGH);
%}
else else
output = input; output = input;
end end

View File

@ -9,9 +9,9 @@
function output = LFOSelect(amplitude, frequency, phase, fs, duration, input,number) function output = LFOSelect(amplitude, frequency, phase, fs, duration, input,number)
%UNTITLED Summary of this function goes here %UNTITLED Summary of this function goes here
% Detailed explanation goes here % Detailed explanation goes here
if(number == "Option 1") if(number == "Sawtooth")
output = lfo_sawtooth(amplitude, frequency, phase, fs, duration, input); output = lfo_sawtooth(amplitude, frequency, phase, fs, duration, input);
elseif(number == "Option 2") elseif(number == "Sine")
output = lfo_sine(amplitude, frequency, phase, fs, duration, input); output = lfo_sine(amplitude, frequency, phase, fs, duration, input);
else else
output = input; output = input;

View File

@ -7,9 +7,9 @@
%Pass-through function used by app %Pass-through function used by app
function output = OffsetSelect(input,value,number) function output = OffsetSelect(input,value,number)
if(number == "Option 1") if(number == "Echo")
output = Meghaj_Echo(input, value); output = Meghaj_Echo(input, value);
elseif(number == "Option 2") elseif(number == "PitchOffset")
output = Petha_Hsu_PitchOffset(input, value); output = Petha_Hsu_PitchOffset(input, value);
else else
output = input; output = input;

View File

@ -7,9 +7,9 @@
%Pass-through function used by app %Pass-through function used by app
function output = PitchEnvelopeSelect(input, Fs, attack,decay,sustain,release,number) function output = PitchEnvelopeSelect(input, Fs, attack,decay,sustain,release,number)
if(number == "Option 1") if(number == "Logarithmic")
output = DarellAnnePitchEnvelope(input, Fs, attack,decay,sustain,release); output = DarellAnnePitchEnvelope(input, Fs, attack,decay,sustain,release);
elseif(number == "Option 2") elseif(number == "Linear")
output = DarellAnneLinearPitchEnvelope(input, Fs, attack,decay,sustain,release); output = DarellAnneLinearPitchEnvelope(input, Fs, attack,decay,sustain,release);
else else
output = input; output = input;

View File

@ -1,30 +0,0 @@
% 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

View File

@ -1,25 +0,0 @@
function x = generate_cosine(amplitude, frequency, phase, fs, duration, duty)
% GENERATE_WAVENAME: returns a matrix of sampled WAVENAME wave
% CONTRIBUTORS:
% Mekhi Ellington: Original Creator
% DOCUMENTATION:
% phase shift is in number of periods
% fs is the sampling frequency: how many sample points per second
% duration is time in seconds
% duty is a number between 0 and 1
% initialize local variables from input arguments
n = fs * duration; % number of samples (length of matrix)
dt = 1 / fs; % sampling period: time between two sample points
% initialize a one dimensional zero matrix to be populated
x = zeros(1, n);
% populate the matrix
for i = 1:n
t = i * dt;
x(i) = amplitude * cos(2*pi*frequency*t-phase);
end
end

View File

@ -1,55 +0,0 @@
function x = generate_trapezoid(amplitude, frequency, phase, fs, duration, duty)
% GENERATE_TRAPEZOID: returns a matrix of sampled square wave
% CONTRIBUTORS:
% Daniel Doan: Author
% DOCUMENTATION:
% phase shift is in number of periods
% fs is the sampling frequency: how many sample points per second
% duration is time in seconds
% duty cycle should be a number between 0 and 1.
% duty of 0.5 would have 2 trapezoids in first half of each cycle
% example of wave with duty of 0.5, where the peaks are amplitude/2:
%
% ____
% / \
% / \ ________________
% \ /
% \____/
%
% initialize local variables from input arguments
n = fs * duration; % number of samples (length of matrix)
dt = 1 / fs; % sampling period: time between two sample points
% initialize a one dimensional zero matrix to be populated
x = zeros(1, n);
% populate the matrix
for i = 1:n
t = i * dt;
% periodic ramp from 0 to 1
% progression through a cycle
st = mod(frequency * t - phase, 1);
slope = (amplitude/2) / (duty/8);
if(st < duty)
if(st < duty/8 || st > 7*duty/8)
x(i) = slope * st;
else
if(st < 5*duty/8)
x(i) = amplitude/2 - slope * (st-(3*duty/8));
end
if(st < 3*duty/8)
x(i) = amplitude/2;
end
if(st > 5*duty/8)
x(i) = -amplitude/2;
end
end
end
end
end