func (m MIDINote) ToNote() (Note, error) {
	nr := Int(m.number)
	velocity := Int(m.velocity)
	i := getInt(m.duration, true)  
	if i == 1 ||
		i == 2 ||
		i == 4 ||
		i == 8 ||
		i == 16 {
		fraction := 1.0 / float32(i)
		return MIDItoNote(fraction, nr, velocity)
	}
	n, err := MIDItoNote(0.25, nr, velocity)
	if err != nil {
		return Rest4, err
	}
	n.duration = Duration(m.duration)
	if n.duration < 0 {
		return Rest4, errors.New("MIDI duration cannot be < 0")
	}
	return n, nil
}
ToNote() is part of NoteConvertable
package core
import (
	"errors"
	"fmt"
	"time"
	"github.com/emicklei/melrose/notify"
)
type MIDINote struct {
	duration HasValue  
	number   HasValue
	velocity HasValue
}