inplemented add_sine

This commit is contained in:
Arthur Lu 2021-12-12 21:58:42 -08:00
parent d1707c95a4
commit 9218db1b6d
3 changed files with 11 additions and 0 deletions

BIN
app.mlapp

Binary file not shown.

View File

@ -28,6 +28,17 @@ function output = SoundGeneratorSelect(amplitude, frequency, phase, fs, duration
output = generate_cosine(amplitude, frequency, phase, fs, duration, duty);
elseif(number == "Heartbeat")
output = generate_heartbeat(amplitude, frequency, phase, fs, duration, duty);
elseif(number == "Harmonics")
u = floor(phase);
o = floor(duty);
undertones = zeros(1, u);
overtones = zeros(1, o);
for i=1:u
undertones(i) = 1/i;
overtones(i) = i;
end
harmonics = [undertones, overtones];
output = add_sine(amplitude, frequency, harmonics, fs, duration);
% instruments:
elseif(number == "ArcoStrings")