From 8581cbcf854126bac818127b98f5c7f641b76d55 Mon Sep 17 00:00:00 2001 From: bliou000 <95387384+bliou000@users.noreply.github.com> Date: Fri, 3 Dec 2021 20:27:38 -0800 Subject: [PATCH] Update README.md added more concrete template to help people get started --- README.md | 46 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e2a7772..1807172 100644 --- a/README.md +++ b/README.md @@ -2,18 +2,56 @@ Audio synthesizer project created by ECE 45 students, written using the MATLAB language and MATLAB GUI + ## Contributors Will add member names shortly ## Function Prototypes - -function x = generate_wave(amplitude, frequency, phase, fs, duration, duty) - -fuction x = envelope(input, fs, period, attack , decay, sustain, release) +Templates to create your own functions. + + ### Wave generating function +``` +function x = generate_WAVENAME(amplitude, frequency, phase, fs, duration, duty) +% GENERATE_WAVENAME: returns a matrix of sampled WAVENAME wave + +% CONTRIBUTORS: +% Person1: how you contributed +% Person2: how you contributed +% etc + +% DOCUMENTATION: +% phase shift is in number of periods +% fs is the sampling frequency: how many sample points per second +% duration is time in seconds +% duty is a number between 0 and 1 + + % initialize local variables from input arguments + n = fs * duration; % number of samples (length of matrix) + dt = 1 / fs; % sampling period: time between two sample points + + % initialize a one dimensional zero matrix to be populated + x = zeros(1, n); + + % populate the matrix + for i = 1:n + YOUR CODE HERE + end +end +``` +NOTE: duty does not apply to some functions (such as sinusoids) + + ### Envelope function +``` +function x = envelope(input, fs, period, attack , decay, sustain, release) +``` where attack, decay, release are percentages between 0 to 1 of the period sustain is the percentage of the amplitude it should sustain for **envelope can be pitch or amplitude envelope** + +### Filter function +``` function output_timedomain = Filter(input_soundin_timedomain, Fs, LOW, MED, HIGH) +``` where LOW, MED, HIGH are user-selected variables of any value. **output should be in time domain for all functions (new sound)**