diff --git a/App/app.mlapp b/App/app.mlapp index 2aea4c0..ac57d04 100644 Binary files a/App/app.mlapp and b/App/app.mlapp differ diff --git a/src/NotWorking/AnuragDampenTarget.m b/src/NotWorking/AnuragDampenTarget.m index e15f1f3..3b325d3 100644 --- a/src/NotWorking/AnuragDampenTarget.m +++ b/src/NotWorking/AnuragDampenTarget.m @@ -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)); diff --git a/src/NotWorking/AnuragEnhanceTarget.m b/src/NotWorking/AnuragEnhanceTarget.m index ad2b187..97d990a 100644 --- a/src/NotWorking/AnuragEnhanceTarget.m +++ b/src/NotWorking/AnuragEnhanceTarget.m @@ -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; diff --git a/src/NotWorking/distortion_filter.m b/src/NotWorking/distortion_filter.m index e60f7cd..869aab7 100644 --- a/src/NotWorking/distortion_filter.m +++ b/src/NotWorking/distortion_filter.m @@ -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 \ No newline at end of file diff --git a/src/Select/AmpEnvelopeSelect.m b/src/Select/AmpEnvelopeSelect.m index 885204a..6f9e0aa 100644 --- a/src/Select/AmpEnvelopeSelect.m +++ b/src/Select/AmpEnvelopeSelect.m @@ -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; diff --git a/src/Select/FilterSelect.m b/src/Select/FilterSelect.m index 6e5c61c..67bd924 100644 --- a/src/Select/FilterSelect.m +++ b/src/Select/FilterSelect.m @@ -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 diff --git a/src/Select/LFOSelect.m b/src/Select/LFOSelect.m index fbe132e..b33d90e 100644 --- a/src/Select/LFOSelect.m +++ b/src/Select/LFOSelect.m @@ -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; diff --git a/src/Select/OffsetSelect.m b/src/Select/OffsetSelect.m index a8b982c..7bd053c 100644 --- a/src/Select/OffsetSelect.m +++ b/src/Select/OffsetSelect.m @@ -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; diff --git a/src/Select/PitchEnvelopeSelect.m b/src/Select/PitchEnvelopeSelect.m index 997d30f..9d65ae9 100644 --- a/src/Select/PitchEnvelopeSelect.m +++ b/src/Select/PitchEnvelopeSelect.m @@ -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; diff --git a/src/distortion_filter.m b/src/distortion_filter.m deleted file mode 100644 index 869aab7..0000000 --- a/src/distortion_filter.m +++ /dev/null @@ -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 \ No newline at end of file diff --git a/src/generate_cosine.m b/src/generate_cosine.m deleted file mode 100644 index 8a013ed..0000000 --- a/src/generate_cosine.m +++ /dev/null @@ -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 \ No newline at end of file diff --git a/src/generate_trapezoid.m b/src/generate_trapezoid.m deleted file mode 100644 index 69ce591..0000000 --- a/src/generate_trapezoid.m +++ /dev/null @@ -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 \ No newline at end of file