denemo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Denemo-devel] [bug #44820] MIDI output is very basic


From: anonymous
Subject: [Denemo-devel] [bug #44820] MIDI output is very basic
Date: Mon, 13 Apr 2015 20:45:15 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0 Iceweasel/31.6.0

Follow-up Comment #5, bug #44820 (project denemo):

An enhanced version of a Scheme script handling MIDI in from a master keyboard
is:

;;; Master keyboard filter
(let ((midi "")
      (command 0)
      (channel 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! channel (bit-extract(list-ref midi 0)  0 4))
                (set! note (list-ref midi 1))
                (set! velocity (list-ref midi 2))
                (disp "command " command ", channel " channel ", note " note ", 
velocity "
velocity)
                (set! midivalue (+ (ash velocity 16) (ash note 8) (ash command 
4)))
                (disp "midi value " midivalue)
                (if (and (= command #x9)(= channel 0)) ; NoteOn message on 
channel 0
                (begin
                        (if keyboardactive (d-PutMidi midi) (d-OutputMidi 
midivalue))
                ))
                (if (and (= command #x9)(= channel 1)) ; NoteOn message on 
channel 1 ->
trigger pads
                (begin
                        (disp "trigger pad " note)
                        (if keyboardactive
                                (case note
                                        ((36)(d-Set0))
                                        ((37)(d-Set1))
                                        ((38)(d-Set2))
                                        ((39)(d-Set3))
                                        ((40)(d-SetBreve))
                                        ((41)(d-AddDot))
                                        ((42)(d-Set5))
                                        ((43)(d-Set4))
                                        ((44)(d-AddDot))
                                        ((45)(d-RemoveDot))
                                        ((46)(d-Diminish))
                                        ((47)(d-Augment))
                                        ((48)(d-ToggleBeginSlur))
                                        ((49)(d-ToggleEndSlur))
                                        ((50)(d-StartBeam))
                                        ((51)(d-EndBeam))
                                )
                        )
                ))
                (if (= command #x0B) ; ControlChange message
                (begin
                        (case note
                                ((119)(begin
                                  (set! keyboardactive (not keyboardactive)) ; 
set variable
                                  (if keyboardactive (d-InputFilterNames (_ 
"Master Keyboard MIDI
Filter")) (d-InputFilterNames (_ "Master Keyboard MIDI Filter (offline)"))) ;
update status bar
                                )) ; 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 midi))) ; 
other control change
message
                        )
                ))
                (if (or (= command 0) (= isstop 1))
                        (begin
                         (display "Filter stopping")
                         (d-InputFilterNames (_ "No MIDI filter active")) ; 
update status bar (code
from MidiFilterOff)
                        )
                        (loop)))))
     (loop))
(d-SetMidiCapture #f)

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?44820>

_______________________________________________
  Nachricht gesendet von/durch Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]