MUSC 108. Introduction to Music Technology - Fall 2013

02Lab1 Setup, MIDIDisplay, and the C Major Scale

[Overview] [Syllabus]

Hardware Setup

The computers in the MRC are setup like this.

MIDI Setup in Lab

The MIDI Controller has no sounds of its own. It simply transmits MIDI messages to the computer. The computer processes these MIDI messages and turns them into sound. You can listen through headphones available in the MRC.

Mount your network drives

Double click the Mount Network drives icon in the Dock.

Mount Network Drives Icon

Your network drives should appear on the desktop.

Network Drive Icons

Double click the courses disk icon and open the folder for Musc108. You should see this.

Course Folder Contents

Optional course downloads are in the Common folder.

Introduction To The Software You'll Be Using

During the MIDI portion of MUSC 108 you'll be dealing with three main programs: Excel, MIDIDisplay, and AU Lab. They are already installed.

Microsoft Excel

/Applications/Microsoft Office 2011/Microsoft Excel.app

Excel icon

Excel is a spreadsheet program designed to do calculations on text, date, and numerical data stored in rows and columns. It will be the main data editing program for MIDIDisplay.

AU Lab

/Applications/AU Lab.app

AuLab icon

AU Lab is part of Apples XCode development system. Documentation for AU Lab can be found in the course common folder.

MIDIDisplay

MIDIDisplay icon

MIDIDisplay was written by John Ellinger and translates MIDI text messages into sound. The Mac OSX version is written in C++ using the wxWidgets Library. The Windows version is written in Delphi 2010 using Pascal. MIDIDisplay for Mac requires AU Lab for MIDI playback and uses Apple's built in software synthesizer, the DLSMusicDevice. DLS is an acronym for DownLoadableSounds and uses sounds licensed from Roland Corporation. MIDIDisplay for Windows uses Microsoft's built in synthesizer called GS Wavetable Synthesizer. If you want to use MIDIDisplay at home, versions for Windows and Mac OS X can be found in the course common folder. Please do not distribute it.

Use Headphones Outside of Class Time

When working in the MRC lab outside of class time, you should use headphones.

Adjusting the Volume

There are two ways to adjust the volume on the iMacs

1) Use the volume control keys on the Apple keyboards.

Volume Keys

2) Use the Volume mini-menu

Volume menu

MIDIDisplay Setup and Sound Test

Step 1: Open AU Lab

Location: /Applications/AU Lab

AU Lab icon

Step 2: Open the MIDIDisplay program

IMPORTANT: AU Lab must be opened before you open MIDIDisplay.

Location: /Applications/MIDIDisplay

MIDIDisplay icon

Step 3 Choose a MIDI Device

The DLSMusicDevice will be automatically selected if available AU Lab is running.

MIDIDisplay DLSMusicDevice menu item

Step 4 Enter the MIDI Message to Play Middle C for One Second

Type these MIDI commands into the MIDIDisplay window.

0	90	60	100
1000 80 60 0

MIDIDisplay expects data in the following format:

time tab status tab data1 tab data2
decimal   hex   decimal   decimal

IMPORTANT:

MIDIDisplay does minimal error checking and expects the data to be entered error free.

Step 5 Click the Play Button

You should hear middle C played for one second.

Problems?

  1. check that AULab is open and is using the AULabDLS.trak created in AULab Setup
  2. check that MIDIDisplay is set to use the DLSMusicDevice.
  3. check the volume control on the computer is turned up

MIDI Display Controls

MIDIDisplay DLSMusicDevice menu item

Time Base menu
Determines how MIDIDisplay interprets the time in column 1.
Chronological Ms require times to be entered at a tempo of 60.
 
MIDI Device menu
MIDIDisplay supports any MIDI system installed on your computer. In the lab use the DLSMusicDevice.
PPQ menu
This setting is only in effect when the Time Base is Difference PPQ. This setting determines the number "Parts Per Quarter Note" used to calculate rhythm.
Tempo Slider
The tempo slider changes the tempo. Tempo changes are accurate only if the data was entered using a tempo of 60 bpm.
Status Header
The status header reminds you that MIDIDisplay expects each MIDI message to be entered in a specific format described below.
Play Button
Plays the MIDI messages in the window
Stop Button
Sends a NOF message to notes 0-127 on all 16 MIDI channels. This command takes about three seconds to complete. The three second delay happens because MIDI can only send a a certain number of messages per millisecond. Sending all the messages at once could cause a "MIDI log jam."
Data Entry Area
The main window area is a text editor where you can enter MIDI data.

MIDIDisplay Help Files

Some MIDI documentation is available from the Help menu in MIDI Display.

MIDIDisplay Help topics

Unit 2 Labs - Excel Spreadsheet Setup

Open Excel. There are six labs in Unit 2. You'll need to create six worksheet tabs by choosing the Worksheet command from the Insert menu. Follow a similar procedure in all future labs.

1. Open a new Excel spreadsheet. Name it Lab02-FirstNameLastName.xls.

Excel title

2. Create a total of six worksheet tabs. Name the tabs 02Lab1 through 02Lab6. Double click the tab to edit the name.

Excel tab names

3. Label the four columns of row 1 as shown below.

Excel 1

The C Major Scale

Data Entry 1 - The Hard Way - Type The Data Directly Into MIDIDisplay

This method works for short fragments of music, but quickly becomes tedious for longer pieces. Type the following data into MIDIDisplay. Type TAB not SPACE between numbers.

MIDIDisplay window

Play

Click the Play Button. You should hear the C Major scale. Adjust the tempo as desired.

1b. C major Scale - The Easy Way - Enter Data In Microsoft Excel, Copy To MIDIDisplay

You can automate many note entry tasks in Excel. These concepts will pay off when working with large amounts of data.

Select the 02Lab worksheet tab 02-1. The first row holds the labels: time status data1 data2.

Cut, Copy, and Paste in Excel

Important Shortcut: Learn to use the keyboard shortcuts in Excel. Position your left hand thumb on the Apple key. Position your left hand index, middle, and ring fingers on the keys for v, c, and x respectively. Using the menu takes too long.

1. Column A - Time

Enter a zero into cell A2 and then select A2.

Excel 1

Use the Fill->Series item in the Edit menu to quickly enter the millisecond times 0, 1000, 2000, 3000 up to 7000.

Excel 2

2. In the series dialog, make these choices

Excel 3

3. Click OK. Column A should look like this

Excel 4

4. Column B - Status

The status byte of a MIDI message is used for several types of MIDI messages. The NON (note on) status byte falls in the range $90-$9F. It is sometimes defined as $9n where 9 is the NON message and n is the MIDI channel number. The sixteen MIDI channels are zero based from $0-$F in hex.

Create the NON (Note On) commands first. Once these are done you can do the NOF (note off commands).

Play the C Major Scale on MIDI channel 1. That means you need to fill column B with 90 (without the $)

Important: MIDIDisplay requires status bytes in hex.

Enter 90 in cell B2.

Copy B2.

Excel 5

Then select cells B3:B9

Excel 6

and paste. Column B should be filled with 90.

Excel 7

5. Column D - Data2

The data2 byte of a MIDI message represents velocity which translates to loud and soft. The range is 0-127 with higher numbers being louder.

Type 100 into cell D2 and select D2.

This time you'll use a shortcut to copy and paste 100 into the remaining cells. Position the cursor over the "handle" at the lower right corner of the cell D2.

Excel 8

Click and drag the outline to cell D9 and and release the mouse button. Column D should be filled with 100.

Copy paste in Excel by click drag

6. Column C - Data1

The data1 byte of a midi message indicates the note to play. Middle C on the piano is note number 60. Here are the MIDI note numbers for the notes Middle C to the C one octave higher.

Pitch C C#/Db D D#/Eb E F F#/Gb G G#/Ab A A#/Bb B C
MIDI 60 61 62 63 64 65 66 67 68 69 70 71 72
C Major Scale C   D   E F   G   A   B C
C Major Scale MIDI 60   62   64 65   67   69   71 72

Enter the MIDI note numbers for the C major scale in column C. When you're finished, the NON part of the worksheet should look like this.

Excel 9

7. Create the NOF (Note off) messages

The plan is to copy the existing data and paste it into a new set of cells. You can use a formula to create the NOF messages. Once that is done you can sort the NON and NOF messages into chronological order.

Make a copy of cells A2:D9 and paste them into cells A11:D18.

Excel 10

8. Determine the NOF times

You can use a formula to automatically add 1000 to each NON time. That will make the duration of each note exactly 1000 ms, the duration of a full quarter note at a tempo of 60.

Select cell A11, enter the following formula and then press the Enter key. Note that all formulas begin with an = sign. Once you type the = sign you can click in cell A2 and A2 will be automatically entered into the formula. Continue to type "+1000" and the press the Enter key. The Enter key evaluates the formula.

Excel 11

9. Copy the formula in A11 and paste it into cells A12:A18

Excel 12

NUISANCE: If you tried to sort the NON and NOF values now, you'd get a lot of un-referenced cell errors (REF#). To prevent this, you need to use an Excel command called Paste Special.

10. Change the formulas in cells A11:A18 to values

Select and copy cells A11:A18.

Then right click cell A11 and choose Paste Special from the popup menu. You could also choose it from the Edit menu.

Excel 13

When the Paste Special dialog appears select Values and click OK. The formula in the cells will be replaced by the values.

Paste Special Dialog

11. Change the NOF status to 80

Change status byte to 80

12. Select cells A1:D18.

Excel 15

13. Choose Sort from the Data menu and the Sort dialog will appear

To produce the results you want, you need to sort using two filters, first by time ascending, and second by status ascending. Because row 1 is a header row make sure that the Header row button is selected.

Excel 16

15. Click OK and the data should sorted into the proper order for MIDIDisplay to play

Excel 17

Here's how to interpret the time + MIDI message (status data1 data1)

  1. Time - Wait this number of milliseconds.
  2. MIDI message - send the message when the wait time is over.

In programming terms there are two methods of waiting: synchronous and asynchronous. In the synchronous method all computer processing stops until the time is up. This usually means unresponsive menus and mouse movements. The asynchronous method is preferred. The software starts a timer in the background that will go off at a given time. While the timer is running the computer is free to do other things. As soon as the time goes off the MIDI message is sent and the timer is reset for the next message.

Play In MIDIDisplay

Copy A1:D17 data from Excel.

Switch to the MIDIDisplay program.

Erase any data that is present. Shortcut: Apple-A (Edit menu - Select All), then press the delete key.

Paste the Excel data into MIDIDisplay

Click the Play button.

Adjust the tempo as desired.

Note Off (NOF) Methods

There are two methods used to turn a note off.

  1. Status 8n where the velocity (data2) is ignored
  2. Status 9n with a velocity (data2) is set to 0.

Let's try it.

Change the data2 bytes for all 80 status messages to 0.

Note off method 1

Copy A1:D17 data from Excel and paste it into MIDIDisplay.

Click the Play button.

Note off method 2

Copy A1:D17 data from Excel and paste it into MIDIDisplay.

Click the Play button.

MUSC 108 Preferred Method for NOF

Use 80 status and 0 velocity (data2).

Convert back to that format.

SPEED HINT:

  1. Enter 80 into B3.
  2. Down arrow to B4 (right hand)
  3. Up arrow back to B3 (right hand)
  4. Copy B3 with Apple-C (left hand)
  5. Down arrow to B5. (right hand)
  6. Apple-V for paste(left hand)
  7. Two down arrows (right hand)
  8. Apple-V for paste(left hand)

It's really fast.

preferred NOF format

Continue with 02Lab2.

[Overview] [Syllabus]

Revised John Ellinger, January - September 2013