![]() ece481 | doering | ece labs | ece | rhit |
|
![]() | Hardcopy of all MATLAB code that you develop |
![]() | Hardcopy of signal spectra |
![]() | Name of AFS public directory containing your .WAV files |
![]() | Brief write-up summarizing your results |
Experiment with the FM synthesis equation and listen to the results. Try various combinations of fc, I (modulation index), and H (harmonicity ratio; H=fm/fc). Try H=N and 1/N where N is an integer; also try irrational numbers for H such as 1/sqrt(2).
Write a summary of your findings (explain the effect of each of the three parameters fc, I, and H).
Write a set of functions that generate the sounds specified on pp. 327 329 in the text (horn, bassoon, clarinet, bell, and gong). The function should accept two parameters: the first parameter is a 1x3 vector consisting of duration (in s), frequency (in Hz), and amplitude (usually a value between 0 and 1); the second parameter is sampling frequency in Hz.
You will need to spend some time learning enough cmusic syntax to extract the parameters from the note statements. See p. 184 and p. 514 of the text to learn about the gen4 envelope generator (I have written a MATLAB implementation of gen4 that you may use see gen4.m). Also see horn.m for an example translation of the HORN instrument on p. 327 of the text.
Experiment with each of the functions (e.g., consider variations in pitch, duration, etc.). Pick two or three of your favorite sounds and save them as a .wav file.
Find a multi-track MIDI file (zillions are available on the web) and follow the procedure below to render the MIDI file into a sound vector. Use three or more of the instruments you created in Part 2 to form the voices of a multi-instrument composition.
The following example details the procedure needed to play the peanuts.mid standard MIDI file in MATLAB.
Obtain Piet van Oostrum's MIDI-to-text conversion software mf2t.zip (http://www.cs.uu.nl/pub/MIDI/PROGRAMS/MSDOS/mf2t.zip). You need to run the mf2t.exe program in a DOS window to convert a standard .MID file into a human-readable text version. For example, open a DOS window ("Start -> Run.." and then enter "CMD"). run the following command:
mf2t peanuts.mid peanuts.txt
In MATLAB, use midinote.m to read the MIDI text file and produce a notelist in the same format that you used in MiniProject 3. midinote.m stores its results in a .MAT file that can be retrieved later using the MATLAB 'load' function. Please note that it is necessary to run midinote.m one time only:
midinote('peanuts')
Pay attention to the output of 'midinote' to determine
which MIDI channels are being used. You can then associate a particular MIDI
channel with its own instrument (or voice). MIDI channel 10 is percussion.
Still in MATLAB, use play.m
to convert the MIDI notelist using one or more instruments into a sound vector.
The peanuts.m script illustrates how to do
this for the horn.m instrument (you also need
note2hz.m):
peanuts
|