## Extract the root note of a chord ?

Oct 23 2015 | 2:49 pm
Hi ! does anyone know an algorithm or, better, a patch that finds the root note in a chord ?
i am looking to do a patch that generates a bass line based on a chord played on top, if anyone has ideas or know some patches !
thanks !

• Oct 23 2015 | 3:22 pm
as it happens, I made this while teaching a Max class last year:
• Oct 23 2015 | 3:47 pm
you can build that around [minimum]
• Oct 25 2015 | 12:02 am
Marcel - your patch is brilliant, thanks so much for sharing that.
• Oct 25 2015 | 4:58 am
A much simpler way to obtain the lowest note in a chord:
Getting a root note isn't that straightforward, and for most chords there is more than one proper solution.
• Oct 25 2015 | 8:42 am
Nice patch AK, I had forgotten about the bag object. There's a problem if you start by playing just one note though.
And indeed, finding the root of a chord instead of just the lowest note would be an interesting exercise!
• Oct 25 2015 | 9:48 am
Thank you all, but i am interested in finding the root note. The lowest note is indeed not a problem.
i think i might need to reduce the choice to a few combinations of intervals and apply different rules to different combinations. Not as elegant as a global algo, but could be at least working.
• Oct 25 2015 | 10:33 am
I would analyse the intervals to find the chord position. Then the root note can be derived. Example for major triads: intervals (4,3) -> root position -> lowest note intervals (3,5) -> 1. inversion -> highest note intervals (5,4) -> 2. inversion -> middle note
• Oct 25 2015 | 1:16 pm
@Marcel Yes indeed, it chokes on the first note (or any subsequent single note higher than played before). [prepend list] before [minimum] solves the issue. Thank you for pointing out.
@OP Worth looking up: V.J.Manzo's Modal Object Library (http://www.eamir.org/developers/modal-object-library), and PC tools in Bach library (http://bachproject.net).
• Oct 25 2015 | 4:58 pm
Thanks. Broc, that's the way i'm going. Extract the intervals into a list, then compare with several lists and apply one scenario for each matching list.
• Oct 25 2015 | 9:24 pm
if you really want to limit your horizon to traditional chords^^... i would suggest to collect their structure in a table, this seems more appropiate than building a complex expression.
look for lowest note, then transpose all members so that the lowest note is"0", then compare the chord with stored presets. (in a second branch you will store and compare the key, i.e. an offset factor between 0 and 11). thats how i am doing it in my processors.
0 4 7 4 7 11 7 11 15
0 3 7 ...
• Oct 26 2015 | 4:32 am
This is not Max-specific, but you might also check out Robert Rowe's book "Machine Musicianship". It presents and explains several algorithms for these types of symbolic listening tasks.
• Oct 26 2015 | 10:13 am
I haven't had a chance yet to look at the patches posted here, but I made this Max for Live device that does exactly what you're describing, the way it works is similar to what Roman offered.
It relies on a database of chord voicings (there's most definitely a better way to search and append to a database than the way I used, it just wasn't that important for me at the time).
I'll admit I thought it would be a much simpler task than it ended up being, having to account for inversions, adding/subtracting of notes etc.