Merge branch 'main' into AnuragFilters
This commit is contained in:
commit
b5f5ac0b23
BIN
App/app.mlapp
BIN
App/app.mlapp
Binary file not shown.
@ -26,7 +26,6 @@ function output_x = AnuragDampenTarget(x, Fs,LOW, MID, HIGH)
|
||||
output(n) = 1;
|
||||
end
|
||||
end
|
||||
|
||||
%%Filter the original signal and transform
|
||||
filtered_Mod_Freq = fftshift(Mod_Freq .* output);
|
||||
output_x = real(ifft(filtered_Mod_Freq));
|
||||
|
@ -15,6 +15,7 @@ function output_x = AnuragEnchanceTarget(x, Fs,LOW, MID, HIGH)
|
||||
lenf = length(F);
|
||||
Mod_Freq = fftshift(fft(x)); %Fourier Transform of the input signal
|
||||
output = zeros([1,lenf]); % zero array of size Mod_freq
|
||||
|
||||
%set the bounds
|
||||
lowerBound = (1-AreaPercentage) * TARGET;
|
||||
upperBound = (1+AreaPercentage) * TARGET;
|
||||
|
@ -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
|
@ -7,7 +7,7 @@
|
||||
%Pass-through function used by app
|
||||
|
||||
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);
|
||||
else
|
||||
output = input;
|
||||
|
@ -7,22 +7,26 @@
|
||||
%Pass-through function used by app
|
||||
|
||||
function output = FilterSelect(input,Fs,LOW,MED,HIGH,number)
|
||||
if(number == "Option 1")
|
||||
if(number == "IdealBandPass")
|
||||
output = DarellbandpassFilter(input,Fs,LOW,MED,HIGH);
|
||||
elseif(number == "Option 2")
|
||||
elseif(number == "AmplifyRange")
|
||||
output = amplifyFreqRange(input, Fs, LOW, MED, HIGH);
|
||||
elseif(number == "Option 3")
|
||||
%{
|
||||
elseif(number == "EpicEffect")
|
||||
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);
|
||||
elseif(number == "Option 5")
|
||||
elseif(number == "SeparatePrevalent")
|
||||
output = seperate_prevalent_schluep(input, Fs, LOW, MED, HIGH);
|
||||
elseif(number == "Option 6")
|
||||
%}
|
||||
elseif(number == "IdealBandReject")
|
||||
output = bandreject_filter(input, Fs, LOW, HIGH);
|
||||
elseif(number == "Option 7")
|
||||
output = AnuragEnhanceTarget(input, Fs, LOW,MID, HIGH);
|
||||
elseif(number == "Option 8")
|
||||
output = AnuragDampenTarget(input, Fs, LOW,MID, HIGH);
|
||||
%{
|
||||
elseif(number == "EnchanceTarget")
|
||||
output = AnuragEnhanceTarget(input, Fs, LOW, MED, HIGH);
|
||||
elseif(number == "DampenTarget")
|
||||
output = AnuragDampenTarget(input, Fs, LOW, MED, HIGH);
|
||||
%}
|
||||
else
|
||||
output = input;
|
||||
end
|
||||
|
@ -9,9 +9,9 @@
|
||||
function output = LFOSelect(amplitude, frequency, phase, fs, duration, input,number)
|
||||
%UNTITLED Summary of this function goes here
|
||||
% Detailed explanation goes here
|
||||
if(number == "Option 1")
|
||||
if(number == "Sawtooth")
|
||||
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);
|
||||
else
|
||||
output = input;
|
||||
|
@ -7,9 +7,9 @@
|
||||
%Pass-through function used by app
|
||||
|
||||
function output = OffsetSelect(input,value,number)
|
||||
if(number == "Option 1")
|
||||
if(number == "Echo")
|
||||
output = Meghaj_Echo(input, value);
|
||||
elseif(number == "Option 2")
|
||||
elseif(number == "PitchOffset")
|
||||
output = Petha_Hsu_PitchOffset(input, value);
|
||||
else
|
||||
output = input;
|
||||
|
@ -7,9 +7,9 @@
|
||||
%Pass-through function used by app
|
||||
|
||||
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);
|
||||
elseif(number == "Option 2")
|
||||
elseif(number == "Linear")
|
||||
output = DarellAnneLinearPitchEnvelope(input, Fs, attack,decay,sustain,release);
|
||||
else
|
||||
output = input;
|
||||
|
@ -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
|
@ -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
|
@ -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
|
Reference in New Issue
Block a user