From: Carl Worth Date: Wed, 18 Sep 2013 03:21:00 +0000 (-0700) Subject: Fix chord analysis for intervals larger than an octave X-Git-Url: https://git.cworth.org/git?p=scherzo;a=commitdiff_plain;h=936c8b69ec6177d82b1905ed555dc8fbe1f32283;hp=f9ffdfde546d16f24ab5d30ed9caef2c687b4755 Fix chord analysis for intervals larger than an octave By simply repeatedly subtracting 12 from any larger-than-octave intervals. --- diff --git a/scherzo.c b/scherzo.c index 676f5b4..a13196e 100644 --- a/scherzo.c +++ b/scherzo.c @@ -521,6 +521,8 @@ scherzo_analyze_chord (scherzo_t *scherzo) for (i = 0; i < num_notes; i++) { notes[i].relative_pitch = notes[i].midi_pitch - bass_pitch; + while (notes[i].relative_pitch > 12) + notes[i].relative_pitch -= 12; } for (i = 0; i < ARRAY_SIZE (intervals); i++) {