shithub: neindaw

ref: 66ba98f5e0f3c5e80deb909d561dbb5b872ff72f
dir: /piper/notegen/

View raw version
#!/bin/rc

awk '
	BEGIN {
		octave = -1
	}

	/#/ {
		$1 = tolower($1)
		sub("#", "")
	}

	{
		split($1, n, "")
		if(n[2] != octave){
			if(octave >= 0)
				printf "	},\n"
			printf "	[%d] = {\n", n[2]
		}
		octave = n[2]
		printf "		[''%s''-''A''] = %s,\n", n[1], $2
	}

	END {
		printf "	}\n"
	}
'