Mini-Project 3

horizontal rule

ece481 | doering | ece labs | ece | rhit

Home
Schedule
Course Information
Policies
Homework
Mini-Projects
Resources

MIDI File Writer

horizontal rule

Overview

The main idea of this project is to write a set of functions that will assist you to build the sequence of elements needed to make a complete MIDI file. The functions should return a row vector of integer values, so that concatenating a series of function calls will produce a single row vector corresponding to the numerical values that make up the MIDI file. Use ‘putbytes’ to write the row vector out to a file.

MATLAB commands that may come in handy: double, dec2hex, hex2dec, dec2bin, bin2dec; putbytes, getbytes, hexdmp; also see help on strfun, iofun, and ops (for bitwise operators).

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
bulletName of AFS public directory containing your MIDI files
bulletBrief write-up summarizing your results

horizontal rule

Part 1 – Chunk Preamble Generators

Write a function that generates the header chunk preamble. The function should accept format type, number of tracks, and quarter note division as input parameters.

 Write another function to generate the track chunk preamble. It should accept track length as a parameter

Part 2 – Decimal-to-VL Format Converter

Write a function that accepts a decimal number and produces the variable-length format number

Part 3 – Patch Select Function

Write a function that accepts a patch number between 1 and 128 and a MIDI channel number to produce the MIDI bank-select event codes to select a voice (patch).

Part 4 – Meta-Event Generators

Write a function that generates the “end-of-sequence” code. TIP: The end-of-sequence code is an event like any other, so remember to insert a delta time before the event. 

Write a function to generate the “set tempo” code. The function should accept an integer in units of microseconds. 

Part 5 – Note-On / Note-Off Functions

Write a pair of functions that generate note-on and note-off MIDI events, respectively. The functions should accept note number and velocity as input parameters.

Part 6 – Delta-Time Generator

Write a function which accepts a delta-time in seconds and produces the delta-time sequence in ticks (variable length format, remember).

Part 7 – Test Drive

Pull together everything you have written so far to generate a test file. For example, try an ascending scale of notes spaced 1 second apart. Use the Windows MediaPlayer (Start à Programs à Accessories à Entertainmentà MediaPlayer) to play the file. Does the timing work out correctly?

You may find it helpful to troubleshoot your test file by using a hex editor such as XVI32. Of course, you can also use a combination of getbytes and hexdmp, too.

Part 8 – Note List to MIDI Track Converter

Write a function that accepts a note list (a matrix where each row contains a delta-time and note event) and produces an appropriate sequence for the track. The function should accept MIDI channel number in addition to the note list. 

Part 9 – The Real Thing

Write a simple composition that makes use of as many features as possible. Use at least two tracks, each with a distinct channel and voice. Experiment with single-note sequences, chords, note-on velocity, etc.

Describe the goal of your composition.

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.