Mini-Project 1

horizontal rule

ece481 | doering | ece labs | ece | rhit

Home
Schedule
Course Information
Policies
Homework
Mini-Projects
Resources

“Analog Synthesis” Using MATLAB

horizontal rule

Overview

This project will give you the opportunity to begin designing sounds in MATLAB. The project parts are laid out to give you some structure, but please feel free to expand upon the ideas.

Append all MATLAB code that you develop.

Place all generated sounds in WAV format (see wavwrite) in your AFS public directory and indicate where I can find them.

Deliverables

bulletHardcopy of all MATLAB code that you develop
bulletName of AFS public directory containing your .WAV files
bulletBrief write-up summarizing your results

horizontal rule

Part 1 - Signal Sources

Implement the functions osc(type,f,dur,fs) and noise(dur,fs), where type is a string variable indicating 'sine', 'square', 'saw', or 'pulse' (do help square), f indicates frequency in Hz, dur indicates duration in seconds, and fs indicates sampling frequency in Hz. Both functions should return a 1xN row vector with unit amplitude.

 Demonstrate the operation of your functions.

Part 2 - Envelope Generators

Implement the function adsr(atime,dtime,slevel,rtime,dur,fs) which produces an ADSR envelope as a result. Use exponential functions for the transient portions of the envelope. The maximum value of the envelope should always be unity.

dur refers to the total length of the envelope, and fs refers to the sampling frequency in Hz. atime is the percentage (0 to 100) of the total time associated with the attack phase (similarly, dtime is decay phase and rtime is release phase). slevel refers to the envelope value (also in percent of max value) during the sustain phase. [Hint: Please refer to my function adenv.m as an example of an attack/decay envelope generator. Also, look at the MATLAB function linspace].

 Show that your ADSR module functions properly by plotting the envelope for at least two distinct cases.

Part 3 - Composition

Compose a simple piece of music using analog synthesis techniques of your choice. Better compositions will include variety, e.g., different envelope parameters at different times, multiple channels (chords), stereo, etc. Write a paragraph or two that describes your compositional technique. Good compositions will be click-free.

Hints: You may wish to use a familiar melody (remember, you’ve got an equation that converts a note from the equal-tempered scale into frequency), or you may want to use a musical “experiment” based on an algorithm as the basis for your composition.

horizontal rule

Running MATLAB

There are at least four ways to access MATLAB on at Rose-Hulman:

bulletOn your own network-connected computer
bulletInstall MATLAB from TIBIA (be sure to install Signal Processing Toolbox and Image Processing Toolbox)
bulletMust be connected to network in order for MATLAB to operate
bulletOn a network-connected computer
bulletInstall "Terminal Server" client from TIBIA
bulletRun the client and connect to computer "ts2"
bulletMap your AFS directory via SAMBA (right-click on the "My Computer" icon, and select "Map Network Drive"; enter \\SAMBA\yourAFSname)
bulletRun MATLAB
bulletOn the SGI computers in the Imaging Systems Laboratory (these are presently at version 5.3, other techniques are version 6)
bulletOn your own stand-alone computer
bulletPurchase MATLAB Student Edition and Image Processing Toolbox

MATLAB Startup File

A startup.m file is useful for automatically setting up the MATLAB search path, for changing the current working directory to something other than the default, and for any other activity you would like to perform each time MATLAB starts up. You can place any valid MATLAB code inside your startup.m file. Common activities include:

  1. Append your own path to the system search path: path(path,’C:\mypath\matlab’);

  2. Change working directory: cd C:\mydir

  3. Display a message to confirm that startup.m file commands were processed (put a line such as "disp('it works!')" in your file)

A sample startup.m file is available. Please edit it to suit your needs.

Recommended methods for using a startup file:

bulletWith locally-installed MATLAB: Place startup.m file in the "work" subdirectory of the MATLAB installation directory
bulletVia Terminal Server method:
bulletPlace startup.m file in your AFS directory
bulletEach time you start MATLAB, enter "cd" followed by the mapped drive letter for your AFS directory (probably F:), then type "startup" to run the file.
bulletOn Imaging Lab SGI computers:
bulletLog in using your Imaging Systems lab account
bulletOpen a (non-console) terminal window by selecting "Desktop -> Unix Shell"
bulletOne Time Only: Copy the class startup.m file to your home directory: type the command "cd" to guarantee that your working directory is the same as your home directory, then type the command "cp ~doering/startup.m ." (the period is part of the command)
bulletStart MATLAB by typing "matlab" at the prompt

horizontal rule

Home | Schedule | Course Information | Policies | Homework | Mini-Projects | Resources

 ECE481: Electronic Music Synthesis (S 2002-03)
Department of Electrical and Computer Engineering
Rose-Hulman Institute of Technology


For questions or comments regarding this web contact:
Last updated: 03/10/05.