ECE 381: Laboratory 3 | |
Touch-tone telephone dialing and music synthesis | |
| |
|
For the rest this assignment, you will write two MATLAB functions in which you need to use control structures such as conditional statements and loops. Consult the MATLAB notes and Experiment 0 if you do not have experience with these. Also consult the background discussion to learn about the dual-tone multi-frequency (DTMF) dial signals and music synthesis. The following assignment statements are not complete without some explanations and definitions made in the background discussion.
Write a MATLAB function that constructs and plays the DTMF signal corresponding to a telephone number composed of digits 0-9, and symbols * and #. The exact specification of your function is as follows:
function dialSig = lastnameLab03Ex1(number,digitDur,silenceDur,fs) % Usage: dialSig = lastnameLab03Ex1(number,digitDur,silenceDur,fs); % Inputs: number: Vector of digits to be dialed (i.e., of integers 0, % 1, ..., 9, 10, and 11, where 10 and 11 represent the % symbols * and #, respectively) % digitDur: Duration of dual-tone signal per digit in seconds % silenceDur: Duration of silence between digits in seconds % (must be at least 0.005 seconds) % fs: Sampling frequency in Hertz % Output: dialSig: Sampled dial signal as a column vector % Side effect: Sampled dial signal is also played out ... Your implementation goes here, after one blank line following the leading comment lines. ...
In the lab, experiment with different digit and silence durations to make the sound match with your everyday experience. Your dial signal will be tested by this function:
function y = getnum(x,fs) % Y = GETNUM(X,Fs) is the telephone number extracted from the sampled % DTMF signal X, where Fs is the frequency in Hertz at which X has been % sampled. The default value of 8,192 Hz is assumed if Fs is omitted.
So, as an example, if your function is right, you will see
>> getnum(lastnameLab03Ex1([8 1 6 2 3 5 1 2 3 4],0.3,0.05,8192),8192) ans = 8162351234
as well as hear the dial signal. If you wish, you can make all but the
first input argument to your function optional.
Write a MATLAB function that plays a given sequence of notes, and returns the corresponding sampled music signal. The exact specification of your function is as follows:
function musicSig = lastnameLab03Ex2(noteSeq,durSeq,envType,f0,fs) % Usage: musicSig = lastnameLab03Ex2(noteSeq,durSeq,envType,fs); % Inputs: noteSeq: Vector of integer-encoded notes to be played % durSeq: Vector containing the duration (in seconds) of each % note in 'noteSeq' % envType: 0 for flat, 1 for woodwind, and 2 for keyboard type % envelopes % f0: base pitch in Hertz % fs: Sampling frequency in Hertz % Output: musicSig: Sampled music signal as a column vector % Side effect: Sampled music signal is also played out ... Your implementation goes here, after one blank line following the leading comment lines. ...
In the lab, play the following four sequences: (All notes, except those with a superscript "+", cover an octave within a base pitch of your choice. Those superscripted with "+" are meant to be one octave above their non-superscripted counterparts.)
1. Raga malkauns (ascending) 2. Raga malkauns (descending)
Notes: D F G A#+ C+ D+ Durations: ... equal ...
Notes: C+ A#+ G F D Durations: ... equal ...
3. Big Ben
Notes: F# D E A A E F# D Durations: 0.3 0.4 0.4 1 0.4 0.4 0.3 1
4. Pictures at an Exhibition (Mussorgsky)
Notes: A G C D G+ E D G+ E C D A G Durations: 3 3 3 2 1.5 3 2 1 3 3 3 3 3
If you are into music, feel free to play with anything you like. Try different base pitches and simulated instruments, and tune the sound to your liking. Also, try different sampling frequencies, and observe the effect.
Submit the two functions you wrote electronically.
School of Computing and Engineering University of Missouri - Kansas City |
Last updated: February 05, 2006 |