added amplifier function
This commit is contained in:
parent
7764118c60
commit
52b8f0fc22
BIN
Mariya Takeuchi - September.wav
Normal file
BIN
Mariya Takeuchi - September.wav
Normal file
Binary file not shown.
38
src/Main_test.asv
Normal file
38
src/Main_test.asv
Normal file
@ -0,0 +1,38 @@
|
||||
%Basic Example test
|
||||
%Written by Darell
|
||||
amplitude = 1;
|
||||
frequency = 200;
|
||||
phase = 0;
|
||||
fs = 44800;
|
||||
duration = 1;
|
||||
duty = 0;
|
||||
|
||||
%example Sine Generation
|
||||
x = generate_sine(amplitude, frequency, phase, fs, duration, duty);
|
||||
x = x + generate_sine(amplitude, (frequency+5), phase, fs, duration, duty);
|
||||
|
||||
size(x)
|
||||
|
||||
%play over 5 counts, should hear both frequencies, 5 beats per second between the 2 frequencies
|
||||
playtime = 5;
|
||||
play_continuous(x, fs, playtime)
|
||||
|
||||
LOW = 0;
|
||||
HIGH = frequency + 1;
|
||||
MED = "unused";
|
||||
x = DarellbandpassFilter(x,fs,LOW,MED,HIGH);
|
||||
|
||||
%play over 5 counts, should only hear 200hz
|
||||
playtime = 5;
|
||||
play_continuous(x, fs, playtime)
|
||||
|
||||
attack = 0.2;
|
||||
decay = 0.2;
|
||||
sustain = 0.2;
|
||||
release = 0.1;
|
||||
|
||||
x = DarellAmplitudeEnvelope(x, fs, attack,decay,sustain,release); %output new sound in time domain
|
||||
%play over 5 counts, should only hear 200hz
|
||||
playtime = 5;
|
||||
play_continuous(x, fs, playtime)
|
||||
|
@ -11,6 +11,8 @@ duty = 0;
|
||||
x = generate_sine(amplitude, frequency, phase, fs, duration, duty);
|
||||
x = x + generate_sine(amplitude, (frequency+5), phase, fs, duration, duty);
|
||||
|
||||
size(x)
|
||||
|
||||
%play over 5 counts, should hear both frequencies, 5 beats per second between the 2 frequencies
|
||||
playtime = 5;
|
||||
play_continuous(x, fs, playtime)
|
||||
|
5
src/amplify.m
Normal file
5
src/amplify.m
Normal file
@ -0,0 +1,5 @@
|
||||
function output = amplify(input, multiplier)
|
||||
%Amplifies the signal by multiplier
|
||||
%By Conner Hsu
|
||||
output = input*multiplier;
|
||||
end
|
Reference in New Issue
Block a user