diff --git a/src/AnuragDampenTarget.m b/src/AnuragDampenTarget.m index 29d3576..41b529b 100644 --- a/src/AnuragDampenTarget.m +++ b/src/AnuragDampenTarget.m @@ -1,4 +1,4 @@ -function output_x = AnuragDampenTarget(x, Fs,TARGET, AreaPercentage) +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. @@ -8,6 +8,8 @@ function output_x = AnuragDampenTarget(x, Fs,TARGET, AreaPercentage) % 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); diff --git a/src/AnuragEnchanceTarget.m b/src/AnuragEnhanceTarget.m similarity index 94% rename from src/AnuragEnchanceTarget.m rename to src/AnuragEnhanceTarget.m index 33923ce..9a348b0 100644 --- a/src/AnuragEnchanceTarget.m +++ b/src/AnuragEnhanceTarget.m @@ -1,4 +1,4 @@ -function output_x = AnuragEnchanceTarget(x, Fs,TARGET, AreaPercentage) +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. @@ -8,6 +8,8 @@ function output_x = AnuragEnchanceTarget(x, Fs,TARGET, AreaPercentage) % 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); diff --git a/src/Filter/bandreject_filter.m b/src/Filter/bandreject_filter.m index 8073a9e..9d089b9 100644 --- a/src/Filter/bandreject_filter.m +++ b/src/Filter/bandreject_filter.m @@ -1,4 +1,4 @@ -function output_y = bandreject_filter(Input, Fs, Low, High) +function Output = bandreject_filter(Input, Fs, Low, High) % A filter that lets through most frequencies unaltered % but attentuates the frequencies in the specified range to % very low levels diff --git a/src/Filter/epic_effect_schluep.m b/src/NotWorking/epic_effect_schluep.m similarity index 100% rename from src/Filter/epic_effect_schluep.m rename to src/NotWorking/epic_effect_schluep.m diff --git a/src/NotWorking/generate_cosine.m b/src/NotWorking/generate_cosine.m new file mode 100644 index 0000000..8a013ed --- /dev/null +++ b/src/NotWorking/generate_cosine.m @@ -0,0 +1,25 @@ +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/NotWorking/generate_pulse.m b/src/NotWorking/generate_pulse.m new file mode 100644 index 0000000..2f9c316 --- /dev/null +++ b/src/NotWorking/generate_pulse.m @@ -0,0 +1,33 @@ +function x = generate_pulse(amplitude, frequency, phase, fs, duration, duty) +% GENERATE_puse: returns a matrix of sampled pulse wave + +% CONTRIBUTORS: +% Brian Tran: Created the wave + +% 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); + f0=1e+6; % 1MHz + Fs=3e+6; + Tf=0.001; % 1 millisecond + t=0:1/Fs:Tf-1/Fs; + td=0.1; % duty cycle + A0=10; % 10 Volts + F=0; + N=1000; % Number of points + + % populate the matrix + for n = 1:N + F=F+(1/n)*cos(n*2*pi*f0*t).*sin(n*pi*td); + end + F=F*(2*A0/pi); + F=F+A0*td; +end \ No newline at end of file diff --git a/src/NotWorking/generate_trapezoid.m b/src/NotWorking/generate_trapezoid.m new file mode 100644 index 0000000..69ce591 --- /dev/null +++ b/src/NotWorking/generate_trapezoid.m @@ -0,0 +1,55 @@ +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 diff --git a/src/Filter/muffled_effect_schluep.m b/src/NotWorking/muffled_effect_schluep.m similarity index 100% rename from src/Filter/muffled_effect_schluep.m rename to src/NotWorking/muffled_effect_schluep.m diff --git a/src/Filter/seperate_prevalent_schluep.m b/src/NotWorking/seperate_prevalent_schluep.m similarity index 100% rename from src/Filter/seperate_prevalent_schluep.m rename to src/NotWorking/seperate_prevalent_schluep.m diff --git a/src/Select/FilterSelect.m b/src/Select/FilterSelect.m index 659a0d1..6e5c61c 100644 --- a/src/Select/FilterSelect.m +++ b/src/Select/FilterSelect.m @@ -19,6 +19,10 @@ function output = FilterSelect(input,Fs,LOW,MED,HIGH,number) output = seperate_prevalent_schluep(input, Fs, LOW, MED, HIGH); elseif(number == "Option 6") 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); else output = input; end