MUSC 108. Introduction to Music Technology - Fall 2013

06Lab 1

[Overview] [Syllabus]

Lab Setup Procedure

Follow these directions LabSetup.html

Add Tempo Changes To Going For Baroque

Here's how it will sound. You can use this method in your midterm project.

Unable to play MP3
Going For Baroque score

Open Au Lab and MIDIDisplay

1. Open Au Lab.

2. Open MIDIDisplay.

Setup

Download and unzip GFB.zip.

Alternatively you could open the course common folder and drag the file GFB.xls file to the desktop of your iMac.

Open GFB.xls and create a new tab named GFBtempo.

Excel Tabs

Copy all data from the GFB tab and paste it into the GFBtempo tab. You'll be working in the GFBtempo tab.

Try these Two Excel Shortcuts For Quickly Selecting Large Blocks of Data

Excel Selection Shortcut 1

Click in A1 to select A1.

Type Shift-RightArrow until A1:H1 is selected.

Type Command-Shift-DownArrow.

Excel Selection Shortcut 2

Click in A1 to select A1.

Type F8 to turn extended selection on.

Scroll until you can see Row 360.

Click in H360.

Type F8 to turn extended selection off.

Create A New Workspace In GFBtempo.xls

Columns I and following should be blank. Starting in cell J1 create these header labels.

Labels

Create A Millisecond Time Series

Enter 0 in J2 and select J2 Use the Edit->Fill->Series menu to create a time series in column J with a step size of 1000 and ending at 23000. Insert additional note times for

Hint: You can add them at the end and then sort only Column J

Measure numbers

Convert The Ms Times To Measure Numbers

You want to correlate a millisecond time in Excel to a specific measure in the GFB score. Enter this formula in K2.

Measure number formula

Here's an explanation:

Copy K2 and paste into remaining column K cells.

Measure numbers

Convert NON times to Beat numbers

Now that you've got the measure numbers you want to correlate the millisecond time to a specific beat within the measure. Enter this formula in L2.

Beat formula

Here's an explanation:

First thing to notice is that it's a compound formula using the MOD function and the ROUNDDOWN function. The ROUNDDOWN function is the inner function, and the MOD function is the outer function. The results of the inner function are calculated first and that result is used in the outer function. Let's look at the inner function first.

ROUNDDOWN(number, decimal places)

MOD( number, modulus)

Copy L2 and paste into the remaining cells of column L. The results should look like this.

Beat numbers

Tempo Map

A tempo map is a list of all tempo changes in the song. The tempo map contains the measure and beat number where the tempo change occurs and the new tempo value. The starting tempo of GFB is 100 beats per minute. Here's a textual description of where the tempo changes occur in the GFB audio example.

Add these tempo comments in column N. Then fill in these tempo changes in column M.

Tempo Plan

Note: These are exaggerated tempo changes designed to make them apparent while listening.

Insert The Tempo Changes

Select M8:M13 and choose Fill->Series from the Edit menu. Click OK.

fillSeries 1

Select M14:M18 and choose Fill->Series from the Edit menu. Click OK.

fillSeries2

Select M18:M28 and choose Fill->Series from the Edit menu. Click OK.

fillSeries3

The results should look like this.

fillSeries4

You need to get rid of the decimal places. You've used the ROUNDDOWN formula before. This time, with cells M18:M28 selected, choose Cells from the Format menu. Select Number in the list on the left and set the Decimal places to zero. Click OK.

fillSeries5

The final result should look like this.

fillSeries6

Remove Duplicate Tempo Values

Create a new called "scratch." Paste the above data into scratch at cell A1.

Select D1:D28

Unique step 1

Choose Advanced Filter from the Data menu.

Check the Unique records only box and click OK.

Unique step 2

You should see this. Notice the row numbers in blue are no longer consecutive. The duplicate data has been hidde.

Unique step 3

Copy the unique data.

Unique step 4

Go back to the GFBTempo tab and paste the unique data into J1. Remove data after J22.

Before After
fillSeries6 After removing duplicate tempos

Add The Tempo Events To Track 1

Track 1 can contain multiple Tempo meta events called a tempo map. Currently there is only one tempo meta event that sets the tempo at the start of the song. It occurs at PPQ = 0 and represents a tempo of 100. The song will stay at that tempo from beginning to end.

The format of a single tempo meta event is:

tempo meta event format

A tempo map contains multiple tempo meta events. The FF  51  3 signature never changes. What does change is the PPQ time for the measure and beat number where the tempo change occurs and the three hex bytes that represent the new tempo in microseconds per quarter note.

Calculate The PPQ Values For The Tempo Events

The first NON occurs at time 0. Enter 0 in N2. The remaining PPQ times can be calculated using the same formula you used in Lab5. Enter this formula in O3 and press Enter.

PPQ formula

Copy O3 and paste into remaining cells of column O.

PPQ nums

Tempo Events Must Occur Before The NON

This one's easy. Subtract 1 or 2 PPQs from the first non zero PPQ. All other PPQ's stay the same.

PPQs decremented by 1

Calculate The Tempo Changes In Microseconds Per Quarter Note

Use this formula:

Microseconds per quarter note formula

Enter this formula in P2 and press Enter.

Microseconds formula

Copy P2 and paste into the remaining cells in column P.

Microseconds numbers

Convert The Microsecond Values To Hex

If you just needed to convert one tempo to hex, you could do it in Google.

Google calculator

This time we'll use the Excel function DEC2HEX( ) because there are several tempos to convert. Enter this formula into Q2 and press enter.

Hex formula

Select and copy P2 and paste into the remaining cells in column P.

Hex numbers

Split The Microsecond Hex Value Into Three Bytes

The Standard MIDI File meta event for Tempo expects the hex number to be split into three parts.

Five Hex Digits  

Six Hex Digits

Hex Number Converted Hex Number Converted
A2C2B
A   2C   2B
99BEEF
99   BE   EF

Use the Excel formula MID(cell, start, end)

MID formula help

Enter this formula intoR2.

Microseconds hex byte 1

Enter this formula into S2

Microseconds hex 2

Enter this formula into T2

Microseconds hex 3

Copy these three formulas down their respective columns. The results should look like this.

Microsecond three bytes

Correct The Last Hex Value

The MID formula you used works correctly on hex numbers with five digits. You'd need a different formula for six hex digits. The last microsecond value had six hex digits and needs to be changed. Change hex1, hex2, hex3 for the 10A55D value to this:

usec good

Delete The Current Tempo In Track 1

You're going to delete the one existing tempo event and replace it with 21 new ones. Select entire row 25 by clicking on the number 25. Right click and choose Delete.

t1

Insert rows for the new Tempo meta events

You'll need to insert 21 additional rows in track 1 for the new tempo events. You can use the right click Insert option 21 times or you can do this. Select the same number of blank cells in Column I as there are values in column J.

Important: All cells in column I must be blank.

t2

Select entire row 25. Right click and choose Insert Copied Cells.

t3

You should see 21 blank rows appear above the old row 25.

t4

Copy the PPQ times from column O and Paste Special by Values in column A25.

t5

Copy the three hex digits from R2:T23 and Paste Special by Values into E25.

t6

Fill in B25:D25 with the tempo meta event signature FF 51 3. Copy and paste into B26:D45. The finished tempo map should look like this.

t7

Export As SMF

Copy the SMF data in columns A through H. Paste into MIDIDisplay and export as a Standard MIDI File.

Paste into MIDIDisplay and export.

Export SMF

Save

Save As GFB.mid to the Desktop. If there are errors MIDIDisplay will report them by line number. The line number should be close to the line number in the Excel spreadsheet.

Play the SMF

Select the SMF file on the Desktop and press the space bar to play it. You should be able to hear the tempo changes.

Debugging a SMF

If you have problems with your SMF you can use a debugging tool I wrote called "debugSMF."

Open the Terminal application.

Type debugSMF followed by a space.

Drag the icon of the MIDI file unto the Terminal window and type Enter.

You'll see a text version of the MIDI file. You can copy and paste it into Excel. It can help you discover what's wrong if your SMF export isn't working.

debugSMF tool

Here's some explanation.

label hex decimal tempo in bpm
Tempo:

927c0

600000

[M.M. = 100]
 
PPQ Bn data 1 data 2 is valid
1 Ctrl 7 OK
 
PPQ Cn data 1 data 2 is valid
1 PrgC 10 OK
 
PPQ 9n data 1 data 2 is valid
24 NON 72 OK
 
PPQ 8n data 1 data 2 is valid
456 NOF 72 OK

[Overview] [Syllabus]

Revised John Ellinger, January - September 2013