# Computationally Determine 'Color Notes' of a Chord [closed]

If I have an arbitrary set of `n` notes of a chord to play, but can only play `k` of them, is there some way to programmatically determine which notes I could remove while maintaining most of the chord 'flavor'?

My first guess is to compare the ratios of the frequencies of the notes, and keep the notes with the most dissonant frequencies, but I can't figure out how to determine that either, as I tune with `f*2^(m/12)`, and thanks to floating point error, all of the frequencies except octaves of the base frequency will be pretty ugly.

When executing the compuation, I know the note names in question, but I have very little music theory knowledge and have no idea how to solve this problem with just the note names.

Does anybody have any thoughts/suggestions?

Thanks!

## closed as too broad by Dom♦Feb 16 at 21:12

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• Buy a portable keyboard with an ABC [auto bass chord] system. Study it for years to see exactly how it handles these situations. It requires as much musicality as it does engineering skill to make that kind of structure not sound very very poor. If you get it for one chord, how will you handle transposition, leading voices? Parallel with roll-over, nearest note, 5th to root? There are many ways to do it & each part can require different rules. Bass is different to main chord, etc. – Tetsujin Feb 16 at 17:23
• I think you'd need learn some music theory and make it rule-based and take context into account. For instance, the 3rd and 7th are important for determining the quality while the 5th can frequently be omitted. Context also matters. What was the last chord and what is the next chord? You'll want to take voice-leading into account. And a note that wasn't in the previous chord will tend to sound more colorful and defining because it's new to the ear. – user37496 Feb 16 at 17:31
• How this question is currently worded, it's way to open and there can be many possible first steps as many have mention all with their own effects. If you have a specific question related to this goal instead of asking for "thoughts/suggestions?" we would be very happy to help address those specific questions. – Dom Feb 16 at 21:15
• @Dom As I read it, there's a reasonably specific question right there at the top, : is there some way to programmatically determine which notes I could remove while maintaining most of the chord 'flavor'? – topo morto Feb 16 at 22:44
• @topomorto as you point out in your answer, there's a lot of detail left out and as I point out and others there's a lot that goes into the decision. One of the tasks of a programmer is to break tasks into smaller manageable chunks and this question as currently worded is massive. – Dom Feb 16 at 22:50

For a single chord considered out of context, a starting point would be :

• work out the frequencies of 'strong' harmonics (according to some threshold) that are present in each of the notes you're playing (the relative strengths of each harmonic is a part of what makes up the timbre of the notes - so this will be different for every instrument)
• work out the full set of strong harmonics playing in the chord
• choose notes to remove based on which removals affect that full set the least. The basis of this logic is that some harmonics' frequencies might be in common (or nearly in common) to 2 or more notes.

This ignores a lot of the detail of what affects the way notes sound together (such as the way harmonics' amplitudes will change over time, for example) - it's only a starting point. A bit of advice I've seen given on this site is that you can often remove the fifth, as many of its harmonics tend to duplicate those in other notes. Do the maths and see if it's right!

In a musical context, you may have different considerations - e.g. you may find that the root is important to play to maintain the harmonic foundation of the piece; you may need to retain some notes to keep the voice-leading intact; or you may find that you can miss out a note that has been played recently (which is why pianists sometimes break up chords that they can't play as a block). These are all probably considerations you could also incorporate into an algorithm, but it wouldn't be a simple one!

• Thanks for the answer! Is finding the strong harmonic frequencies a matter of taking a fourier transform of the waveform? – mjkaufer Feb 17 at 0:12
• @mjkaufer yes, that's a way to do it - or (you can see a theme developing here :) at least it's a good starting point. Unfortunately, Fourier transforms will tend to lack precision in either the time or frequency dimensions (depending on the size of your window), so it can be hard to really pin down the harmonic structure of higher-pitched notes. Spear is a great bit of software that identifies the 'tracks' taken by individual harmonics, which can give a further level of insight. – topo morto Feb 17 at 0:29

No knowing music theory is going to make this very hard. It is like saying i am a computer programmer, how hard could it be to program this rocket guidance system but you don't know anything about physics.

in general if you are removing chord tones, start with removing the 5th. then the root (especially if there is another instrument, like a bass, playing the root).

beyond that you may be able to remove the 3rd or a tension but this will depend.

Of course this can all change depending on context.

• This doesn't even begin to cover the complexity. – Tetsujin Feb 16 at 19:49