Mini-Project 5

horizontal rule

ece481 | doering | ece labs | ece | rhit

Home
Schedule
Course Information
Policies
Homework
Mini-Projects
Resources

MIDI-Based FM Synthesizer

horizontal rule

Overview

Part 1 of this project gives you a chance to experiment with the basic FM sound synthesis equation.

 Part 2 demonstrates how making the modulation index track the amplitude envelope can produce sounds that are similar to brass instruments, woodwinds, and some types of percussion instruments.

 Part 3 ties together FM synthesis with MIDI-based notelists. Notelists can be rather tedious to generate by hand, so I have written a set of MATLAB functions which can be used to read individual tracks from a MIDI file and convert them into the standard notelist format used in MiniProject 3. The notelist can be turned into one large sound vector by making repeated calls to the functions you will write in Part 2.

Deliverables

One-page memo detailing your results, plus additional attachments as needed. Be sure to include the following:

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

horizontal rule

Part 1 – FM Sounds

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).

Part 2 – FM Instruments

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.

Part 3 – FM Composition a la MIDI

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.

Example:

The following example details the procedure needed to play the peanuts.mid standard MIDI file in MATLAB.

  1. 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

  2. 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.
     

  3. 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

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.