Merge pull request #56 from ltcptgeneral/Nicolas-Branch

Fixed Functions Nicolas Schluep
This commit is contained in:
Nicolas Schluep 2021-12-10 22:11:07 -08:00 committed by GitHub
commit 3b32df90de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 54 additions and 18 deletions

View File

@ -15,13 +15,22 @@ function output = epic_effect_schluep(input, Fs, LOW, MED, HIGH)
% HIGH: The maximum frequency the filter will amplify. A typical value for
% this variable is 1000 Hz.
non_stereophonic = input(:, 1); % Removes the sterophonic property of the input sound
% by just taking the first column of data.
n = size(input, 2);
Len = length(non_stereophonic);
non_stereophonic = input;
if (n == 1) || (n == 2)
non_stereophonic = input(:, 1); % Removes the sterophonic property of the input sound
% by just taking the first column of data.
non_stereophonic = transpose(non_stereophonic);
end
modified_input = non_stereophonic(1, :);
Len = length(modified_input);
F = Fs * ((-Len/2) : ((Len/2) - 1)) / Len; % Creating the array of frequencies
% which the FFT Shifted version of the signal can be plotted against.
inputFreq = fftshift(fft(non_stereophonic)); % Creates the Fourier Transform of the
inputFreq = fftshift(fft(modified_input)); % Creates the Fourier Transform of the
% input signal. fftshift() makes it such that the zero frequency is at the
% center of the array.
lowAmplifyFilter = zeros(1, length(inputFreq));
@ -35,7 +44,8 @@ for i = 1:length(lowAmplifyFilter)
end
end
lowPassedInput = inputFreq .* transpose(lowAmplifyFilter); %Apply the "lowAmplifyFilter".
lowPassedInput = inputFreq .* lowAmplifyFilter; %Apply the "lowAmplifyFilter".
lowPassedInput = transpose(lowPassedInput);
% Adding the chorus effect.
realOutput = real(ifft(fftshift(lowPassedInput)));
@ -53,3 +63,7 @@ for i = 1:100
end
output = output ./ 100; % Divide by 100 to decrease the amplitude of the sound to a normal level.
output = transpose(output);
end

View File

@ -13,13 +13,22 @@ function output = muffled_effect_schluep(input, Fs, LOW, MED, HIGH)
% HIGH: The maximum frequency that the low-pass filter will let pass. A
% typical value for this variable is 1000 Hz.
non_stereophonic = input(:, 1); % Removes the sterophonic property of the input sound
% by just taking the first column of data.
n = size(input, 2);
Len = length(non_stereophonic);
non_stereophonic = input;
if (n == 1) || (n == 2)
non_stereophonic = input(:, 1); % Removes the sterophonic property of the input sound
% by just taking the first column of data.
non_stereophonic = transpose(non_stereophonic);
end
modified_input = non_stereophonic(1, :);
Len = length(modified_input);
F = Fs * ((-Len/2) : ((Len/2) - 1)) / Len; % Creating the array of frequencies
% which the FFT Shifted version of the signal can be plotted against.
inputFreq = fftshift(fft(non_stereophonic)); % Creates the Fourier Transform of the
inputFreq = fftshift(fft(modified_input)); % Creates the Fourier Transform of the
% input signal. fftshift() makes it such that the zero frequency is at the
% center of the array.
lowPassFilter = zeros(1, length(inputFreq));
@ -33,7 +42,8 @@ for i = 1:length(lowPassFilter)
end
end
lowPassedInput = inputFreq .* transpose(lowPassFilter); %Apply the low-pass filter.
lowPassedInput = inputFreq .* lowPassFilter; %Apply the low-pass filter.
lowPassedInput = transpose(lowPassedInput);
% Adding a slight reverb effect.
realOutput = real(ifft(fftshift(lowPassedInput)));
@ -50,6 +60,10 @@ output = (realOutput + delayedOutput) ./ 2.0; % Adds the "realOutput" and "de
% vectors to create a reverb effect. Divides by 2 to avoid clipping
% effects.
output = transpose(output);
end

View File

@ -14,13 +14,22 @@ function output = seperate_prevalent_schluep(input, Fs, LOW, MED, HIGH)
% not be attenuated. A good range of values is usually 250-500 Hz, but it
% depends on the input sound.
non_stereophonic = input(:, 1); % Removes the sterophonic property of the input sound
% by just taking the first column of data.
n = size(input, 2);
Len = length(non_stereophonic);
non_stereophonic = input;
if (n == 1) || (n == 2)
non_stereophonic = input(:, 1); % Removes the sterophonic property of the input sound
% by just taking the first column of data.
non_stereophonic = transpose(non_stereophonic);
end
modified_input = non_stereophonic(1, :);
Len = length(modified_input);
F = Fs * ((-Len/2) : ((Len/2) - 1)) / Len; % Creating the array of frequencies
% which the FFT Shifted version of the signal can be plotted against.
inputFreq = fftshift(fft(non_stereophonic)); % Creates the Fourier Transform of the
inputFreq = fftshift(fft(modified_input)); % Creates the Fourier Transform of the
% input signal. fftshift() makes it such that the zero frequency is at the
% center of the array.
bandPassFilter = zeros(1, length(inputFreq));
@ -53,10 +62,12 @@ for i = 1:length(bandPassFilter)
end
end
bandPassedInput = inputFreq .* transpose(bandPassFilter); %Apply the Band-Pass Filter.
bandPassedInput = inputFreq .* bandPassFilter; %Apply the Band-Pass Filter.
output = real(ifft(fftshift(bandPassedInput)));
end

View File

@ -11,17 +11,14 @@ function output = FilterSelect(input,Fs,LOW,MED,HIGH,number)
output = DarellbandpassFilter(input,Fs,LOW,MED,HIGH);
elseif(number == "AmplifyRange")
output = amplifyFreqRange(input, Fs, LOW, MED, HIGH);
%{
elseif(number == "EpicEffect")
output = epic_effect_schluep(input, Fs, LOW, MED, HIGH);
elseif(number == "MuffledEffect")
output = muffled_effect_schluep(input, Fs, LOW, MED, HIGH);
elseif(number == "SeparatePrevalent")
output = seperate_prevalent_schluep(input, Fs, LOW, MED, HIGH);
%}
elseif(number == "IdealBandReject")
output = bandreject_filter(input, Fs, LOW, HIGH);
elseif(number == "EnchanceTarget")
output = AnuragEnhanceTarget(input, Fs, LOW, MED, HIGH);
elseif(number == "DampenTarget")