# Guitar Chord Recognition

Started by May 4, 2011
Hi!

I would like to ask questions regarding some possible algorithms for Guitar Chord recognition.

Currently, what I have is that I am using 'Chroma Vectors', in which I use the results of my FFT to construct a chroma vector (of the current block) and then use compare-and-contrast of the result with actual chroma vectors containing actual chord representations (e.g. a CMajor chroma vector would be [1,0,0,0,1,0,0,1,0,0,0,0]). Then the one with the least 'error' would be considered the chord for that block. I have tested it (both using generated sound and real sound) and it seems successful.

However, there is a problem with this since, computationally, this may be a bit expensive, since it works on a brute-force concept. Aside from this, I have also encountered a problem that I have tried to search for solutions but found none that are clear.

So with that:

1. Are there some possible algorithms for knowing if a sound produced is a chord or not? (e.g. single A note as opposed to A chord) This part is really problematic for me, and one of the solutions I think would be to build a neural net or something, but I do not yet want to resort to that.

2. Other possible algorithms with regards to chord-labeling or determining which notes comprise a chord.

Thank you very much! I would be glad to provide further information on what I have currently if needed.
Blood-

> I would like to ask questions regarding some possible
> algorithms for Guitar Chord recognition.
>
> Currently, what I have is that I am using 'Chroma Vectors',
> in which I use the results of my FFT to construct a chroma
> vector (of the current block) and then use
> compare-and-contrast of the result with actual chroma
> vectors containing actual chord representations (e.g. a
> CMajor chroma vector would be [1,0,0,0,1,0,0,1,0,0,0,0]).
> Then the one with the least 'error' would be considered
> the chord for that block. I have tested it (both using
> generated sound and real sound) and it seems successful.
>
> However, there is a problem with this since, computationally,
> this may be a bit expensive, since it works on a brute-force
> concept. Aside from this, I have also encountered a problem
> that I have tried to search for solutions but found none that
> are clear.
>
> So with that:
>
> 1. Are there some possible algorithms for knowing if a sound produced is a chord or not? (e.g. single A note as
> opposed to A chord) This part is really problematic for me, and one of the solutions I think would be to build a
> neural net or something, but I do not yet want to resort to that.

I know DSP but not music), so please pardon me if this advice is off target.

Are chords not defined by harmonic relationships? A basic web search indicates this... if so, can you not identify
the first 'major energy' in the spectrum and look for energy at specific harmonics of that energy, and also look for
lack of energy everywhere else? My guess is that this might work for a basic lab experiment, but the complexity of
actual music gets in the way, for example simultaneous sounds and mixing. Vocals are probably not helpful, as speech
has a particularly 'non harmonic' structure (look up "formants").

> 2. Other possible algorithms with regards to chord-labeling
> or determining which notes comprise a chord.

It seems there is substantial work on the problem. If I Google for:

chord recognition

chord transcription

I can find papers and other research discussing the problem.

-Jeff
Blood-

> Alright, I'll try working and experimenting with the
> harmonic relationships. Sorry, Im fairly new to the
> DSP field so I may have some inexperience with regards
> to working with signals and their attributes.
>
> Yes, I have read papers and the Chroma Vector algorithm
> came from one of them. I also tried using Neural Nets
> (as per in one of the papers) but had little success
> with it ... it took to long to train the neural net
> given the data that I presented.

Yes training time is important. In a practical system, dynamic/adaptive training is key to improving performance, so
you'd want it to train quickly.

> There are others working with Hidden Markov Models and
> others but I have yet to try them. It seems that Im
> tackling too many things at the same time.
>
> Just for additional information, I am currently working
> on Note Onset Detection, Pitch Detection, Chord
> Detection and Labeling, and Beat and Tempo Estimation.
> So if any other people would like to offer their help,

It sounds like you're on the right track. It's not an easy project, but seems that you have dived in and got a good
start. I suggest that you also post on comp.dsp, if you've not already done so.

-Jeff
> --- In a..., "Jeff Brower" wrote:
>>
>> Blood-
>>
>> > I would like to ask questions regarding some possible
>> > algorithms for Guitar Chord recognition.
>> >
>> > Currently, what I have is that I am using 'Chroma Vectors',
>> > in which I use the results of my FFT to construct a chroma
>> > vector (of the current block) and then use
>> > compare-and-contrast of the result with actual chroma
>> > vectors containing actual chord representations (e.g. a
>> > CMajor chroma vector would be [1,0,0,0,1,0,0,1,0,0,0,0]).
>> > Then the one with the least 'error' would be considered
>> > the chord for that block. I have tested it (both using
>> > generated sound and real sound) and it seems successful.
>> >
>> > However, there is a problem with this since, computationally,
>> > this may be a bit expensive, since it works on a brute-force
>> > concept. Aside from this, I have also encountered a problem
>> > that I have tried to search for solutions but found none that
>> > are clear.
>> >
>> > So with that:
>> >
>> > 1. Are there some possible algorithms for knowing if a sound produced is a chord or not? (e.g. single A note as
>> > opposed to A chord) This part is really problematic for me, and one of the solutions I think would be to build a
>> > neural net or something, but I do not yet want to resort to that.
>>
>> I know DSP but not music), so please pardon me if this advice is off target.
>>
>> Are chords not defined by harmonic relationships? A basic web search indicates this... if so, can you not identify
>> the first 'major energy' in the spectrum and look for energy at specific harmonics of that energy, and also look for
>> lack of energy everywhere else? My guess is that this might work for a basic lab experiment, but the complexity of
>> actual music gets in the way, for example simultaneous sounds and mixing. Vocals are probably not helpful, as
>> speech
>> has a particularly 'non harmonic' structure (look up "formants").
>>
>> > 2. Other possible algorithms with regards to chord-labeling
>> > or determining which notes comprise a chord.
>>
>> It seems there is substantial work on the problem. If I Google for:
>>
>> chord recognition
>>
>> chord transcription
>>
>> I can find papers and other research discussing the problem.
>>
>> -Jeff
>>