Merge pull request #13 from ltcptgeneral/DarellsAnnex

App is partially functional. Change directory to your directory inside the app to use functions.
This commit is contained in:
darrll27 2021-12-05 00:03:35 -08:00 committed by GitHub
commit e4ac5c04c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 2 deletions

Binary file not shown.

8
src/AmpEnvelopeSelect.m Normal file
View File

@ -0,0 +1,8 @@
function output = AmpEnvelopeSelect(input, Fs, attack,decay,sustain,release,number)
if(number == "Option 1")
output = DarellAmplitudeEnvelope(input, Fs, attack,decay,sustain,release);
else
output = input;
end
end

View File

@ -3,7 +3,7 @@ function output_y = DarellbandpassFilter(y,Fs,LOW,MED,HIGH)
F = Fs * (-Len/2 : (Len/2 - 1))/Len ; F = Fs * (-Len/2 : (Len/2 - 1))/Len ;
Mod_Freq = fftshift(fft(y)); Mod_Freq = fftshift(fft(y));
lenf = length(F); lenf = length(F);
output = 0 .* Mod_Freq; % zero array of len f output = zeros([1,lenf]); % zero array of size Mod_freq
for n = 1:lenf for n = 1:lenf
if ((LOW < abs(F(n))) && HIGH > abs(F(n))) if ((LOW < abs(F(n))) && HIGH > abs(F(n)))
@ -14,7 +14,6 @@ function output_y = DarellbandpassFilter(y,Fs,LOW,MED,HIGH)
end end
filtered_Mod_Freq = fftshift(Mod_Freq .* output); filtered_Mod_Freq = fftshift(Mod_Freq .* output);
output_y = real(ifft(filtered_Mod_Freq)); output_y = real(ifft(filtered_Mod_Freq));
end end

View File

@ -0,0 +1,8 @@
function output = PitchEnvelopeSelect(input, Fs, attack,decay,sustain,release,number)
if(number == "Option 1")
output = DarellAmplitudeEnvelope(input, Fs, attack,decay,sustain,release);
else
output = input;
end
end

View File

@ -0,0 +1,13 @@
function output = SoundGeneratorSelect(amplitude, frequency, phase, fs, duration, duty,number)
if(number == "Option 1")
output = generate_sine(amplitude, frequency, phase, fs, duration, duty);
elseif(number == "Option 2")
output = generate_square(amplitude, frequency, phase, fs, duration, duty);
elseif(number == "Option 3")
output = generate_triangle(amplitude, frequency, phase, fs, duration, duty);
else
output = 0;
end
end