[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Denemo-devel] MIDI events for shortcuts
From: |
Richard Shann |
Subject: |
Re: [Denemo-devel] MIDI events for shortcuts |
Date: |
Thu, 25 Sep 2014 19:16:33 +0100 |
On Thu, 2014-09-25 at 19:44 +0200, Andreas Schneider wrote:
> I suggest a new feature which can enhance the usability of Denemo: the
> possibility to use MIDI events as keyboard shortcuts.
>
> Background: I have bought a master keyboard (AKAI MPK249), which I
> solely would like to use for typesetting music with Denemo. That is, I
> want to use the DAW control to navigate, the trigger pads to trigger
> certain commands, the record button to (de)activate the link to the
> keyboard (what the caps lock key now does), etc. The advantage is that I
> do not need to change to the computer keyboard or mouse which makes
> everything more efficient.
>
> The trigger pads send standard note events, but on another channel as
> the keyboard (the pitch identifies the pad). Knobs and DAW control use
> MIDI Machine Control (MMC) and MIDI CC messages.
>
> How easy or difficult would it be to implement that?
There are already examples of using the MIDI CC messages (I think it is)
in Denemo - the Mod wheel triggers the change of enharmonic range.
I don't recall the details but at a quick glance the relevant code is in
actions/denemo.scm which is executed at start up. I see that there are
some bindings there for the pitch bend controller too. I quote the bit
of relevant code below. For the other case - notes coming in on the MIDI
controller on a specific channel) you would need a simple MIDI filter
script - there are some complex MIDI filter scripts which I wrote, but
what you would need is much simpler. The ones I have written are in the
Input->MIDI menu, One (Input->MIDI->Angry Delete) inserts notes, but the
replaces the last note if the key is struck hard.
The essence of the code doing this (rather hoary old-looking code) is as
follows
(set! midi (d-GetMidi))
(set! velocity (bit-extract midi 16 24))
(set! command (bit-extract midi 0 8))
(if (and (= command #x90)(> velocity 90))
(begin
(d-PlayMidiKey #xF06001)
(if (d-GetNonprinting)
(d-PrevNote)
(d-DeletePreviousObject))))
(d-PutMidi midi)
which is doing d-GetMidi to get a keypress and then inserting or
deleting depending on the velocity. (It sounds an additional drum note
d-PlayMidiKey #xF06001 when deleting).
Below is the excerpt from denemo.scm, if that is illuminating...
Richard
(define MIDI-shortcuts::alist '(("" . "")))
(define (SetMidiShortcut shortcut command)
(set! MIDI-shortcuts::alist (assoc-set! MIDI-shortcuts::alist
shortcut command)))
(SetMidiShortcut "FootpedalUp" #f);;;set these to a command name, e.g.
InsertA for the action (d-InsertA)
(SetMidiShortcut "FootpedalDown" #f)
(define (MIDI-shortcut::controller type value)
;;(format #t "controller type ~a value ~a\n" type value)
(cond ((and (equal? type 64) (equal? value 127))
(assoc-ref MIDI-shortcuts::alist "FootpedalDown"))
((and (equal? type 64) (equal? value 0))
(assoc-ref MIDI-shortcuts::alist "FootpedalUp"))
((equal? type 1)
(let ((thestep (round(/ (- value 64) 16))))
(PlayNote
(number->string (+ 60 (* 4 thestep) ))
100)
(SetQuarterCommaMeanTone thestep)
(d-SetEnharmonicPosition thestep)
(d-RefreshDisplay)
#f)
)
(else #f)))
(define Pitchbend::commandUp "(d-CursorRight)")
(define Pitchbend::commandDown "(d-CursorLeft)")
(define Pitchbend::timer 0)
(define (MIDI-shortcut::pitchbend value)
;(format #t "pitch bend value ~a\n" value)
(cond ((> value 64)
(if Pitchbend::commandUp
(eval-string Pitchbend::commandUp)))
((< value 64)
(if Pitchbend::commandDown
(eval-string Pitchbend::commandDown)))))
>
> Andreas
>
> _______________________________________________
> Denemo-devel mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/denemo-devel
- [Denemo-devel] MIDI events for shortcuts, Andreas Schneider, 2014/09/25
- Re: [Denemo-devel] MIDI events for shortcuts,
Richard Shann <=
- Re: [Denemo-devel] MIDI events for shortcuts, Andreas Schneider, 2014/09/25
- Re: [Denemo-devel] MIDI events for shortcuts, Richard Shann, 2014/09/26
- Re: [Denemo-devel] MIDI events for shortcuts, Richard Shann, 2014/09/26
- Re: [Denemo-devel] MIDI events for shortcuts, Andreas Schneider, 2014/09/30
- Re: [Denemo-devel] MIDI events for shortcuts, Richard Shann, 2014/09/30
- Re: [Denemo-devel] MIDI events for shortcuts, Andreas Schneider, 2014/09/30