Skip to content

Commit

Permalink
always show octave when recording
Browse files Browse the repository at this point in the history
  • Loading branch information
schollz committed Sep 23, 2020
1 parent 56c88f6 commit eadd4f2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions src/record/record.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func Record(fname string) (err error) {
currentState := ""
previousNote := music.NewNote("C", 4)
go func() {
ticker := time.NewTicker(500 * time.Millisecond)
ticker := time.NewTicker(400 * time.Millisecond)
notes := []midi.Event{}
for {
select {
Expand Down Expand Up @@ -63,12 +63,12 @@ func Record(fname string) (err error) {
for _, e := range notes {
log.Debugf("e: %+v", e)
note := music.MidiToNote(e.MIDI)
closestNote := music.ClosestNote(note.Name, previousNote)
if closestNote.Octave == note.Octave {
currentState += fmt.Sprintf("%s", note.Name)
} else {
currentState += fmt.Sprintf("%s%d", note.Name, note.Octave)
}
// closestNote := music.ClosestNote(note.Name, previousNote)
// if closestNote.Octave == note.Octave {
// currentState += fmt.Sprintf("%s", note.Name)
// } else {
currentState += fmt.Sprintf("%s%d", note.Name, note.Octave)
// }
previousNote = note
}
currentState += " "
Expand Down
2 changes: 1 addition & 1 deletion src/rtmidi/midiin.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func ReadAll(finished chan bool) (events chan Event, err error) {
log.Tracef("setting up %s", name)
ins[j].SetListener(func(data []byte, deltaMicroseconds int64) {
if len(data) == 3 {
log.Tracef("[%s] %d %+v", name, data)
log.Tracef("[%s] %+v", name, data)
events <- Event{int(data[1]), data[0] == 144, name, time.Now()}
}
})
Expand Down

0 comments on commit eadd4f2

Please sign in to comment.