Merge pull request #18 from ltcptgeneral/amplify

Amplify and Reverse function
This commit is contained in:
khannuuuuur 2021-12-05 22:20:39 -08:00 committed by GitHub
commit 069d7cbf0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 2 deletions

BIN
src/.DS_Store vendored

Binary file not shown.

View File

@ -32,5 +32,4 @@ release = 0.1;
x = DarellAmplitudeEnvelope(x, fs, attack,decay,sustain,release); %output new sound in time domain x = DarellAmplitudeEnvelope(x, fs, attack,decay,sustain,release); %output new sound in time domain
%play over 5 counts, should only hear 200hz %play over 5 counts, should only hear 200hz
playtime = 5; playtime = 5;
play_continuous(x, fs, playtime) play_continuous(x, fs, playtime)

8
src/amplify.m Normal file
View File

@ -0,0 +1,8 @@
function output = amplify(input, multiplier)
%input: a 1D array representing the sound signal in the time domain
%multiplier: a scalar that multiplier all values in the input array to
% amplify or decrease the volume.
%Returns: input signal scaled by the multiplier in the time domain.
%Author: Conner Hsu
output = input*multiplier;
end

6
src/reverse.m Normal file
View File

@ -0,0 +1,6 @@
function output = reverse(input)
%input: a 1D array representing the sound signal in the time domain
%returns: the input signal with its elements in reverse order.
%By Conner Hsu
output = flip(input);
end