dynamic menu dropdowns,

renamed functions in Select,
moved not working functions to NotWorking
This commit is contained in:
Arthur Lu 2021-12-10 15:12:16 -08:00
parent ebc18b5b1d
commit 0c3ab691e1
12 changed files with 51 additions and 153 deletions

Binary file not shown.

View File

@ -2,25 +2,29 @@
% 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);
X = fft(x);
X = fftshift(X);
Y = zeros(1, len);
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);
y = ifft(Y);
y = real(y);
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

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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;

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