Chord recognition

Chords, scales, harmony, melody, etc.
Post Reply New Topic
RELATED
PRODUCTS

Post

Hi, I'm not sure if this is the right place to ask...
I want to write basic plugin in Reaper's JS script to look at the the midi input and figure out what chord is playing, then output it in guitar voicing as a strum. (like how realstrat does).
Does anyone know of a place on the net that describes efficient methods/algorithms for this sort of thing (the determining the chords bit)? I haven't spotted anything yet.
Cheers

Post

(don't take my word - i know very little about coding or/and theory..)

MIDI note-on messages carry the individual key number. You could use those as a building basis and create conditionals based on that.

Maybe you should try first make your script spot intervals? Then progress to chords.. (like "the first interval is 7 seminotes, the next..")

Do remember music theory is 90% math and only 10% art. (sad i suck at both, someone should explain me both things in a very naive way)
[ When chickens are cold, they roost in trees; when ducks are cold, they plunge into water ]

Post

I agree, I can easily see all the midi note numbers and the number of notes. The various chords and inversions are just different intervals, so a bit of maths should work out the most commonly used chords and inversions, and the root note. Only, I haven't sat down yet with pencil and paper (or spreadsheet) to figure out the best way to do it. Just wondering if anyone had come across an algorithm or well laid out set of rules so I could cut corners. :)

Post

I think that's one of the, um, challenges. I mean.. Ive found out that classically obsessed frown upon jazzically liberated & vice versa when considering "the theory about music".

Only the octave is decided. The debate is on how it works. Or something..
[ When chickens are cold, they roost in trees; when ducks are cold, they plunge into water ]

Post

I'm hoping I can do something really simple like add all the midi note numbers up and divide by the number of notes and the resulting number will be a 'signature' that defines chord type and root or something like that.... I'll keep hunting, there's a way for sure....

Post

RedWine wrote:I'm hoping I can do something really simple like add all the midi note numbers up and divide by the number of notes and the resulting number will be a 'signature' that defines chord type and root or something like that.... I'll keep hunting, there's a way for sure....
A chord is an ordered sequence of intervals. Each interval is important, and so is the order. I don't really see any way you can simplify that without losing the identity of the chord. What you CAN do is use simple math to handle transposition, so you only need to identify each sequence of intervals once instead of up to 128 times.

This is very primitive thinking on my part, but it's a start. Make a database of chord types where note 0 is always the lowest note. For example {0,4,7} in major scale in key 0. {0,5,8} = minor scale in key 5. So on and so forth. Let's say a person plays a midi chord where the lowest note has value X. X / 12 = the octave of X. X % 12 = how many semitones X lies above C (the note name of X, in other words). For each note N in the midi chord, N-X = the interval of that note relative to X. As long as the sequence of intervals in the played midi chord matches one of the patterns in your database, you have identified the chord type, and you have the information needed to transpose it to the correct key.

That sounds like some work, but I think compared to implementing realistic guitar strum patterns for all these chords, the chord identification should be the easy part.

Post

PG music has two programs that automatically analyze harmonic value and spit back chord names.

Band-in-a-Box and Power Tracks pro.

If your in the over 50 crowd(I'm not there yet) You'll love biab. once you get ahold of the hundreds of thousand of mgu files. It's also a fast cheesy way to compose songs by sticking in chord names and pulling up a style.

The cheaper Powertracks pro is much more resourceful in the way it handles mid's
Both products spit out a chord chart chords always suffer interpertation when dealing with a midi file as it examines the bar or half bar and makes an assumption on all the notes of the entire score. sometimes it's an inversion treating a Dmaj7 as an A6 no 5th. So you have to use your eyes, ears and brain all the same.

While the audio editing in Powertracks pro is atrocius. I really like being able to throw in a mid and being able to cover it instantly.

tapper mike

Post

thanks for the thoughts folks. There are programs out there that do this sort of thing, but it's an interesting problem to think about solving in an efficient manner. I'll play with a spreadsheet first an look for any clever tricks.

Post Reply

Return to “Music Theory”