]> git.cworth.org Git - scherzo/blobdiff - pitch.h
Spell input notes according to key
[scherzo] / pitch.h
diff --git a/pitch.h b/pitch.h
index 3d1dd2e125b98cda6cc4c2ecfe150c54278258db..ffe9782c54b50cac05ba3470477f079afe31ddd6 100644 (file)
--- a/pitch.h
+++ b/pitch.h
@@ -110,4 +110,26 @@ pitch_raise_by_octaves (pitch_t pitch, int octaves);
 pitch_t
 pitch_lower_by_octaves (pitch_t pitch, int octaves);
 
+/* Number of half steps from 'root' up to 'pitch' (that is, counting
+ * the steps up a chromatic scale), within the same octave. */
+int
+pitch_from_root_in_half_steps (pitch_t pitch, pitch_t root);
+
+/* Respell 'pitch' to have a name that matches the (diatonic) scale
+ * 'degree' from 'root'.
+ *
+ * If the pitch is too distant from the specified degree to be
+ * respelled, the original pitch will be returned unmodified.
+ */
+pitch_t
+pitch_spell_as_degree (pitch_t pitch, pitch_t root, int degree);
+
+/* Return a MIDI note value corresponding to 'pitch' */
+unsigned char
+pitch_to_midi (pitch_t pitch);
+
+/* Return the pitch_t value corresponding to the given MIDI note value. */
+pitch_t
+pitch_from_midi (unsigned char midi_note);
+
 #endif /* PITCH_H */