]> git.cworth.org Git - scherzo/commitdiff
Fix chord analysis for intervals larger than an octave
authorCarl Worth <cworth@cworth.org>
Wed, 18 Sep 2013 03:21:00 +0000 (20:21 -0700)
committerCarl Worth <cworth@cworth.org>
Wed, 18 Sep 2013 03:21:00 +0000 (20:21 -0700)
By simply repeatedly subtracting 12 from any larger-than-octave intervals.

scherzo.c

index 676f5b459001412ad4ce7c4605dbc07e007cba8c..a13196e5b802563f7f8906e7cd42157e5c7ed7c0 100644 (file)
--- 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++) {