My OS X Programming Blog
Mac OS X Cocoa and CoreMIDI Programming
About Andrew Choi


MIDI Programs

MIDI File Player (External Device)

MIDI Destination Pop-Up Button

MIDI File Player (Internal Synth)

MusicSequence Sample Code

MIDI File Writer

MIDI Name Document Parser

NameConfigSetup

Fish Creek MIDI Framework

MidnamUtility

SysExSenderX

Other Programs

FCBlogEditor

FCBlog and Patch

Chinese Checkers Program

jyut6 ping3 Cantonese Input Method

Cocoa Sample Programs

Syntax Coloring Using Flex

NSTextField and Undo

NSToolbar

Implementing File Import

Launch Application and Open URL

Saving Uncommitted Text Field Edits

Algorithms

Jazz Chord Analysis as Optimization

Optimal Line Breaking for Music

Optimal Chord Spacing

   

A blog where I will write mostly about programming in Cocoa and CoreMIDI, and experiences from my ports of Emacs and XEmacs to the Mac OS.

Rhythmic Figures Used for Comping
Friday March 26, 2004

I was thinking about how the automatic accompaniment program might generate piano parts. Once the voicings have been determined for a chord sequence, there’s still the question of when the chords should be played. The method books I have say quite little about comping (they usually simply give an example or two). So what algorithm can one use to generate the rhythmic pattern for comping?

I studied the piano parts generated by MiBAC Jazz. The rhythmic pattern of each bar appears to be randomly selected from a collection of stored patterns. It also appears that the pattern for each bar is chosen independently. Here’re some of the patterns the program uses.

Another Band-in-a-Box File Format?
Thursday March 25, 2004

Before I finalize a list of chord types to be supported in my programs, I wanted to collect some more statistics on Band-in-a-Box files of jazz standards on this other site. To my surprise (and dismay), my BiaB file reader failed on many of these files!

On closer inspection, the problematic files have creation dates between 1987 and 1991; all of them are of length 768 bytes; and the “version” byte in them has value 0xbb (instead of a value around 0x40 or 0x50). I gather this is an older file format used by BiaB: it is older and not newer because my BiaB version 6.0 is able to read it. So I spent some time deciphering this different format. This required a bit of guess work because my version of BiaB only reads the format but does not write it. Luckily the format is quite simple and I eventually succeeded. It might be interesting to note that BiaB chord sequences can only contain 64 bars or less in those days!

Anyway I hope I can now truly say that my program can read all BiaB files. The result of this new statistical study is quite encouraging: from 917 songs, 43242 chords were collected; 59 distinct chord types were present. All those occurring 4 times or more (roughly 0.01%) are included in the list I posted earlier.

Chord Voicings
Wednesday March 24, 2004

I experimented with generating chords in different voicings programmatically today. It’s a more difficult problem than one may realize! I suppose all programs that play chords must just use some sort of libraries of all chord voicings it knows about and choose from them. But I’m interested in the problem of reasoning about chord voicings and devising algorithms to choose among them to satisfy a certain criterion, such as minimizing movement in the voice leading. Anyway I know this will be a big research project if I pursue this. So if any graduate student is reading this, work on it, write a paper, and send a copy to me :-).

To solve the immediate problem of playing chords, I wrote some code to generate “position 1” of the “basic voicing” in the book An Introduction to Jazz Chord Voicing for Keyboard by Bill Boyd. Here’s a MIDI file that contains a piano track playing chords along with a bass track for Blues for Alice. Neither sound very interesting yet because they aren’t humanized and the comping is without syncopation. Anyway, the chords let you hear the tonality much better.

Chord Type Used in Standard Jazz Tunes
Tuesday March 23, 2004

Band-in-a-Box supports roughly 129 different chord types. Among them is “7susb9#11b13”, which has the distinction of having the longest name among all supported chord types. I must confess I don’t know how to use this chord in a practical situation :-). Besides this one, the program also supports many other unusual chord types.

I considered the problem of choosing a more reasonable set of chords to be supported in my program. Not that I cannot support all the BiaB chords superficially. I’m more interested in a set of chords for which the tonality analysis algorithm can produce good, understandable results, and one for which an algorithm can generate good chord voicings. That way I can save time not working on code that will never be used.

One way to study this problem is to examine what chord types people actually use in writing chord charts. I’ve found two “real-book” collections of tunes (here and here). Together they consist of 927 songs (which might contain duplicates) in BiaB format. In them are a total of 43,469 chord symbols. Thanks to my program that reads BiaB file format and a few Unix utilities, I extracted the chords and discovered they are written in a total of 55 distinct chord types. Here’s the list. I have put similar chord types on the same line. The numbers in parentheses show the chord types’ occurrences when they are less than ten (or 0.023%). And no, 7susb9#11b13 isn’t one of the chord types found. It might be interesting to note that MiBAC Jazz supports 28 different chord types, which is more or less a subset of this set.

m, m7, m9, m11, m13
m6
mMaj7
m#5, m7#5

7, 9, 13 7b9, 13b9 7#9, 13#9 7b5, 9b5, 13b5 7#5, 9#5, 7+, 9+ 7#5#9, 7alt, 7b5b9, 7#5b9, 7b5#9, 13b5b9 7sus, 9sus, 13sus 7#11, 9#11, 13#11 7#9b13 (8) 7b13 (7) 7susb9 (3) 7b9#11 (2)

Maj, Maj7, Maj9, Maj13 6, 69 Maj9#11 2 4, sus 5 Maj7#5 (4)

m7b5

dim

+, aug

Getting the Bass Lines to “Walk”
Monday March 22, 2004

So far the bass line generation algorithm chooses notes that are harmonically correct but do not emphasize a continuous and fluent motion. I added some code today to detect cases when there is an opportunity to play preset ascending or descending lines by examining the interval between the first notes of the current and the next bars. Note that the choice of correct notes to put in the walking bass lines depends on tonality analysis of the chord sequence. In other words, a purely pattern-based/statistical method cannot avoid making some wrong choices sometimes. The result of the new version of the program is illustrated by the following two choruses generated for the tune Solar (MIDI file here):

Examples of notes generated by this new code are bars 3, 7, 8, 15, 18, and 19. My next task is to “humanize” the performance by varying the MIDI velocities and adding embellishments.

March 2004
Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
Feb  Apr

xml

Search this blog with


Lists

Less-Known Facts About Emacs

Emacs Rants

Chinese Restaurants in Calgary

Calgary/Banff Tourist Attractions

C++ Reading List

Science Fiction Series

Top-10 Reason I Stopped Working on Emacs

Top-10 Types of Questions I Get About Emacs

10 Defining Moments as Programmer


Misc

Carbon XEmacs

Emacs for Mac OS X


Copyright © 2003, 2004, 2005 Andrew Choi (Contact Information). Created with FCBlog