From 936c8b69ec6177d82b1905ed555dc8fbe1f32283 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 17 Sep 2013 20:21:00 -0700 Subject: [PATCH] Fix chord analysis for intervals larger than an octave By simply repeatedly subtracting 12 from any larger-than-octave intervals. --- scherzo.c | 2 ++ 1 file changed, 2 insertions(+) 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++) { -- 2.43.0