I don't suppose I can test this, not having much in the way of extra MIDI controls on my keyboard. I was curious to see though, that when I play into this filter it prints out Bank 4 for the notes I play. I would have expected Bank 0. (I don't really understand banks, I thought they were some sort of meta data ...)
my message stream looks like this: command 9, bank 4, note 57, velocity 20 midi value 1325456 command 8, bank 4, note 57, velocity 0 midi value 14720 for a note on/off Richard On Sun, 2014-11-09 at 21:00 +0100, Andreas Schneider wrote: > Thank you for your help. A similar code works. My input filter is now as > follows: > > ;;; Master keyboard filter > (let ((midi "") > (command 0) > (bank 0) > (note 0) > (velocity 0) > (midivalue 0) > (keyboardactive 1) > (isstop 0) > (loop 0)) > (d-InputFilterNames (_ "Master Keyboard MIDI Filter")) > (d-SetMidiCapture #t) > (set! loop (lambda () > (begin > (set! midi (d-GetMidi #f)) > (set! command (bit-extract (list-ref midi 0) 4 8)) > (set! bank (bit-extract(list-ref midi 0) 0 4)) > (set! note (list-ref midi 1)) > (set! velocity (list-ref midi 2)) > (disp "command " command ", bank " bank ", note " note ", > velocity " > velocity) > (set! midivalue (+ (ash velocity 16) (ash note 8) (ash command > 4))) > (disp "midi value " midivalue) > (if (and (= command #x9)(= bank 0)) ; NoteOn message on bank 0 > (begin > (if keyboardactive (d-PutMidi midivalue)) > )) > (if (and (= command #x9)(= bank 1)) ; NoteOn message on bank 1 > -> > trigger pads > (begin > (disp "trigger pad " note) > (case note > ((36)(d-Set0)) > ((37)(d-Set1)) > ((38)(d-Set2)) > ((39)(d-Set3)) > ((43)(d-Set4)) > ((40)(d-SetBreve)) > ) > )) > (if (= command #x0B) ; ControlChange message > (begin > (case note > ((119)(set! keyboardactive (not > keyboardactive))) ; record button > ((118)(d-DenemoPlayCursorToEnd)) ; play button > ((117)(d-Stop)) ; stop button > ((115)(d-MoveToMeasureLeft)) ; rewind button > ((116)(d-MoveToMeasureRight)) ; forward button > ((114)(set! isstop 1)) ; loop button > (else (if keyboardactive (d-PutMidi midivalue))) > ) > )) > (if (or (= command 0) (= isstop 1)) > (display "Filter stopping") > (loop))))) > (loop)) > (d-SetMidiCapture #f) > > > Andreas > > > Am 09.11.2014 um 19:04 schrieb Richard Shann: > > On Sun, 2014-11-09 at 18:07 +0100, Andreas Schneider wrote: > >> How can I convert the byte list from (d-GetMidi #f) to something that I > >> can issue to d-PutMidi? I was not able to come up with something usable. > > > > (let* ((midi (d-GetMidi #f)) > > (value #f) > > (command (list-ref midi 0)) > > (note (list-ref midi 1)) > > (velocity (list-ref midi 2))) > > (set! value (+ (ash velocity 16) (ash note 8) command)) > > (d-PutMidi value)) > > > > I think the values required in d-PutMidi are in the opposite to expected > > order (packed inside the integer). > > It would be good to have a wrapper that takes the three numbers and > > executes d-PutMidi after doing the (set! value (+ (ash velocity 16) (ash > > note 8) command)) step, thus hiding the poor design of d-PutMidi (if I'm > > right about the order of the bytes). > > > > Richard > > > _______________________________________________ > Denemo-devel mailing list > [email protected] > https://lists.gnu.org/mailman/listinfo/denemo-devel _______________________________________________ Denemo-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/denemo-devel
