Skip to main content
Glama
emicklei

melrōse musical expression player

by emicklei
pedal_event.go932 B
package midi import ( "time" "github.com/emicklei/melrose/core" "github.com/emicklei/melrose/midi/transport" "github.com/emicklei/melrose/notify" ) type pedalEvent struct { goingDown bool channel int out transport.MIDIOut mustHandle core.Condition } func (p pedalEvent) NoteChangesDo(block func(core.NoteChange)) {} func (p pedalEvent) Handle(tim *core.Timeline, when time.Time) { if p.mustHandle != nil && !p.mustHandle() { return } // 0 to 63 = Off, 64 to 127 = On var onoff int64 = 0 if p.goingDown { onoff = 127 } // MIDI CC 64 Damper Pedal /Sustain Pedal status := controlChange | int64(p.channel-1) _ = p.out.WriteShort(status, sustainPedal, onoff) if notify.IsDebug() { msg := "down" if !p.goingDown { msg = "up" } notify.Debugf("midi.pedal channel=%d bytes=[%b(%d),%b(%d),%b(%d)] sustain=%s", p.channel, status, status, sustainPedal, sustainPedal, onoff, onoff, msg) } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/emicklei/melrose'

If you have feedback or need assistance with the MCP directory API, please join our Discord server