shithub: mst

Download patch

ref: 74a87e0582e0549e6e21568b8c68ebbdecdec48a
parent: a54b3cc31a0711e96c03e309613adfc3726695d1
author: qwx <qwx@sciops.net>
date: Sat Dec 5 09:44:59 EST 2020

fix note labels: midi range is c-1 to g9, not c0 to g10

--- a/mst.c
+++ b/mst.c
@@ -173,8 +173,9 @@
 	}
 	s = p;
 	o = strtol(s, &p, 10);
-	if(p == s || o < 0 || o > 10)
+	if(p == s || o < -1 || o > 9)
 		sysfatal("line %d: invalid octave number", line);
+	o++;
 	n += 12 * o;
 	if(n < 0 || n > 127)
 		sysfatal("line %d: invalid note number", line);
--- a/tomst.c
+++ b/tomst.c
@@ -16,6 +16,7 @@
 uvlong T;
 
 char *ntab[] = {
+	"c-1","c♯-1","d-1","d♯-1","e-1","f-1","f♯-1","g-1","g♯-1","a-1","a♯-1","b-1",
 	"c0","c♯0","d0","d♯0","e0","f0","f♯0","g0","g♯0","a0","a♯0","b0",
 	"c1","c♯1","d1","d♯1","e1","f1","f♯1","g1","g♯1","a1","a♯1","b1",
 	"c2","c♯2","d2","d♯2","e2","f2","f♯2","g2","g♯2","a2","a♯2","b2",
@@ -25,8 +26,7 @@
 	"c6","c♯6","d6","d♯6","e6","f6","f♯6","g6","g♯6","a6","a♯6","b6",
 	"c7","c♯7","d7","d♯7","e7","f7","f♯7","g7","g♯7","a7","a♯7","b7",
 	"c8","c♯8","d8","d♯8","e8","f8","f♯8","g8","g♯8","a8","a♯8","b8",
-	"c9","c♯9","d9","d♯9","e9","f9","f♯9","g9","g♯9","a9","a♯9","b9",
-	"c10","c♯10","d10","d♯10","e10","f10","f♯10","g10"
+	"c9","c♯9","d9","d♯9","e9","f9","f♯9","g9"
 };
 char nts[512], *ntp = nts;