Skip to content

Commit

Permalink
Fix sort order on single notes
Browse files Browse the repository at this point in the history
The notes are supposed to be presented in the order they appear on a
keyboard, but the "scientific pitch notation" has octaves that start
with C and end with B, so we were accidentally sorting A and B for each
octave before all the other notes in the octave.
  • Loading branch information
pganssle committed Dec 1, 2024
1 parent 2a1e8b5 commit b1315a5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion _includes/note_variables.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
{% assign note_class = "note-" | append: note_base | replace: "#", "-sharp" | replace: "b", "-flat" %}
{% assign absolute_class = "note-" | append: note_base | append: number | replace: "#", "-sharp" | replace: "b", "-flat" %}

{% capture sort_key %}{{ number }}{{ letter }}{% if accidental == "#" %}1{% elsif accidental == "b" %}3{% else %}2{% endif %}{% endcapture %}
{% capture sort_key %}{{ number }}{% case letter %}{% when 'A' %}H{% when 'B' %}I{% else %}{{ letter }}{% endcase %}{% if accidental == "#" %}1{% elsif accidental == "b" %}3{% else %}2{% endif %}{% endcapture %}

{% assign note_info = "" | split: "|" %}
{% assign note_info = note_info | push : sort_key %}
Expand Down

0 comments on commit b1315a5

Please sign in to comment.