





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
An introduction to MIDI (Musical Instrument Digital Interface), a protocol that enables computers and synthesizers to communicate. Learn about MIDI messages, hexadecimal numbers, and data formats essential for working with MIDI. Understand MIDI channels, binary and hexadecimal number systems, and MIDI messages' structure.
Typology: Exercises
1 / 9
This page cannot be seen from the preview
Don't miss anything!
Music 208 Winter 2014 John Ellinger, Carleton College
The labs and midterm project for the first segment of MUSC 108 deal with MIDI messages and Standard MIDI files. MIDI is an acronym for Musical Instrument Digital Interface. MIDI was developed in 1983 as a hardware and software specification that enables computers and synthesizers to communicate with each other. MIDI supports up to 16 channels of simultaneous sound. Each channel can have its own melody, rhythm, and instrument. The MIDI 1.0 Specification is the definitive source on the MIDI language.
The symbol * is multiplication. The symbol ^ indicates exponentiation, 10^3 is.
Computers process numbers. Whether it's Microsoft word, Photoshop, MIDI or digital audio, the computer is processing streams of numbers. We're all familiar with the decimal, or base 10, number system that uses the digits 0-9. In the decimal system (base
Hexadecimal Number 10101 is 65,793 decimal 1 0 1 0 1 65536 +0 +256 +0 +
This chart counts from 0-15 in binary. A single one or zero is called a bit. Binary Decimal 0000 0 0001 1 0010 2 0011 3 0100 4 0101 5 0110 6 0111 7 1000 8 1001 9 1010 10 1011 11 1100 12 1101 13 1110 14 1111 15 If you've got good coordination and patience you could count from 0-1023 ( ) on your fingers.
The hexadecimal system uses 16 digits: 0-9 plus A B C D E F where A = 10, B = 11, C = 12, D = 13, E = 14, and F = 15. You can also use lower case a b c d e f. Hex numbers are usually prefixed or suffixed to distinguish them from decimal numbers. A common convention is to prefix hex numbers with a dollar sign $. Another common convention is to prefix hex numbers with zero x like 0xFAD. Still another convention is to suffix the number with h or (hex); e.g.a1a2h or 7B(hex). This section will use $ to prefix hex numbers.
A bit is a single binary digit, a one or a zero. A byte is eight bits or two hex digits. Modern computers process data most efficiently in one, two, four byte, and eight byte units. You may have heard the terms 32 bit operating system or a 64 bit operating system. That tells you the optimal data processing size of the system. A 32 bit system processes data in four byte chunks and a 64 bit system processes data in eight byte chunks.
Binary to hex conversions are easy. Given the binary number 1110100110, start by forming four bit groups from right to left: 11 1010 0110. Then convert each group of four bits to its corresponding hex digit: 11 1010 0110 = $3A6. Hex to binary conversions are just as easy. Convert each hex digit to its binary equivalent. The hex number $94 is 1001 0100 in binary.
Conversions between decimal and hex are more difficult. The Calculator applications on both Mac and Windows will do that for you.
These are the maximum values of a one byte, two byte, and four byte number in all three number systems. Binary Decimal Hexadecimal 1 byte (^) (11111111) 255 FF 2 bytes (^) (1111111111111111) 65,535 FFFF 4 bytes (^) (
The MIDI standard spells out the rules and grammar for sending MIDI messages. MIDI
messages function the same way across all operating systems (Mac, Windows, Linux). Thanks to Apple, Microsoft, and the Linux community, most of the low level details are built into the operating system and are well documented. These low level details provide MIDI programmers with routines to read the clock time, send a MIDI message, and listen for incoming MIDI without having to understand the internals of the hardware.
All MIDI messages consist of one or more bytes. The first byte in a MIDI message is called the status byte. The remaining bytes are called data bytes. Data bytes have different interpretations depending on its status byte. The distinguishing feature between data bytes and status bytes is the most significant bit (MSB) or the left most bit of the binary eight bit number. The MSB of all data bytes is zero and the MSB of all status bytes is one. The MSB determines the range of values for each type of byte. You'll always use two hex digits for a status byte and usually use decimal numbers for the data bytes. Binary Hex Decimal
The majority of MIDI messages are three bytes long: one status byte followed by two data bytes. < status > + < data 1 > + < data 2 > A few MIDI messages are two bytes long: one status byte followed by one data byte. < status > + < data 1 > Some MIDI messages vary in size: one status byte followed by zero or more data bytes. < status > + < data >...
The two MIDI messages you'll use most often are those that turn a note on (NON) and a note off (NOF). Both NON and NOF messages are three bytes long, a status byte followed by two data bytes. Each of the bytes has a specific meaning.
If the left hex digit of the status byte is an 8, it's a NOF message. If the left hex digit of the status byte is a 9, it's a NON message. The right hex digit of the status byte indicates which of the 16 MIDI channels the note is to be played on. According to users, MIDI
Eight different MIDI Status messages, $8n-$FF, are defined in the MIDI specification. The left hex digit indicates the type of message, the right hex digit indicates the MIDI channel, except for %F0-$FF. The MIDI protocol is very specific about how many data bytes follow a status byte. The most common number is two. Data bytes have different meanings depending on the status byte they're associated with. Data bytes can indicate which key was pressed down, which key was released, how loud the note is, what button was pushed, whether the sustain pedal is up or down, and the position of knobs, wheels, and sliders. We'll concentrate on the NON, NOF, Control Change, and Program Change messages in this class. Message Status 80-FF Number data bytes Data 1 (0-127) Data 2 (0-127) Note Off NOF 8n 2 Note Number Velocity (ignored) Note On NON 9n 2 Note Number Velocity Aftertouch(P oly) An 2 Note Number Pressure Value Control Change Bn 2 Control Number Control Value Program Change Cn 1 Patch Number Not Used Aftertouch (Channel) Dn 1 Note Number Pressure Value Pitch Wheel En 2 Pitch Bend LSB Pitch Bend MSB System Exclusive Fx varies Mfr. specific varies n = channels 0-F x = 0-F but is not related to channel
The MIDI specification does not say anything about scheduling when notes are turned on or off. That's left to the programmer writing the software. All computers have a really fast clock that the programmer can use to tell time. The clocks in the iMacs in the MRC lab run in the gigahertz range, over two billion cycles per second. MIDI messages are usually timed in milliseconds (thousandths of a second) or sometimes microseconds (millionths of a second). Even during the fastest most complex MIDI passages the computer is basically at idle.
Say you want to record your performance on a MIDI keyboard. When you click the Record button, the software remembers the computer clock time. When an incoming MIDI message is received, the operating system attaches a time stamp to the MIDI message. Most time stamps are in millisecond resolution, although the iMacs use microseconds. In order to play back the song, the software compares the time the record button was pressed with the time stamp of the MIDI messages and is able to play back the messages the way they were recorded. If the tempo needs to be changed during playback the time stamps may need to be recalculated. There are three common strategies used for calculating time during playback: chronological, differential, and proportional.
The clock is set to zero when you click the play button. The software continuously checks the clock to see if it matches the time stamp. When it matches the message is sent. Chronological time means "wait until the clock reaches this time and then send the message."
The clock is set to zero when you click the play button. The software keeps track of time differences between two adjacent messages, say message N and message N+1. The procedure goes something like this. Assume the MIDI time stamps are T0, T1, T2, T .... T0, the first time stamp, may not be zero, it's almost impossible to play the first note at exactly the time the record button was clicked. The first time difference is equal to T0-
PPQ (or PPQN) stands for Parts Per Quarter Note. PPQ time is very similar to musical time where all note durations are based on proportions of a quarter note. These proportions are independent of the tempo. You can assign an arbitrary value like 480 units or parts to one quarter note. Then an eighth note would get 240 parts, a sixteenth note 120 parts, a half note 960 parts, a dotted eighth note 360 parts, etc. One PPQ is called a tick. If the PPQ value is 480 and the tempo is 60, there are 480 ticks every second. The duration of each tick would be 2.0833 ms (1000/480). At a tempo of 90,there are one and a half quarter notes per second, or 720 (480+240) ticks per