feat(tracker): implement basic tracker keys

This commit is contained in:
Matias Lahti
2020-11-08 02:36:24 +02:00
parent 77949bdc17
commit 9b6249a1a7
3 changed files with 105 additions and 2 deletions

View File

@ -19,6 +19,7 @@ var notes = []string{
"B-",
}
// valueAsNote returns the textual representation of a note value
func valueAsNote(val byte) string {
octave := (val - baseNote) / 12
oNote := (val - baseNote) % 12
@ -27,3 +28,8 @@ func valueAsNote(val byte) string {
}
return fmt.Sprintf("%s%d", notes[oNote], octave)
}
// noteValue return the note value for a particular note and octave combination
func getNoteValue(octave, note byte) byte {
return baseNote + (octave * 12) + note
}