denemo-devel
[Top][All Lists]
Advanced

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

[Denemo-devel] Foot Pedal Conductor


From: Richard Shann
Subject: [Denemo-devel] Foot Pedal Conductor
Date: Sat, 10 Sep 2011 17:15:40 +0100

I have just finished a nice script for use by groups rehearsing without
a conductor. The idea is that one player uses the foot pedal of the MIDI
keyboard to beat the start of each measure. The Denemo display responds
by filling in the other beats (drawing large arrows to represent the
conductor's hand movements).
It only does 2, 3 or 4 in the bar (depending on the time signature at
the cursor), but it would be easy to upgrade it.
To avoid confusion: this has nothing to do with using Denemo to write
music nor to play it back, it is a sort of user-directed metronome. In
fact, it seems very easy to perform rit. and accel. with this, the
conductor is a bit slow on the uptake, but catches on real fast :)

Enjoy,

Richard

ps I'll put this into master as soon as the release is out. I don't want
to disturb anyone's testing.


;;;;;;;;;;FootPedalConductor
;(SetMidiShortcut "FootpedalDown" "FootPedalConductor")
(define (FootPedalConductor::display text)
  (if (positive? (d-DirectiveGet-standalone-gy "Conductor"))
  (begin
    (d-DirectivePut-standalone-graphic "Conductor" (string-append "\n" text 
"\nDenemo\n512"))
    (d-RefreshDisplay))))
  
(let ((start #f) (number #f) (numerator (string->number (car (string-split 
(d-InsertTimeSig "query=timesigname") #\/)))))
(define (pedalDown? midi)
    (and (= #xB0 (bit-extract midi 0 8))  (= (bit-extract midi 8 16) #x40) (=  
(bit-extract midi 16 24) #x7F)))
(define (pedalUp? midi)
    (and (= #xB0 (bit-extract midi 0 8))  (= (bit-extract midi 8 16) #x40) (=  
(bit-extract midi 16 24) #x0)))
(define (thetime) (/ (get-internal-real-time) internal-time-units-per-second)) 
;;; time in seconds
(d-SetBackground #xB0B0E0)
(d-DirectivePut-standalone-gy "Conductor" 380)
(d-MoveCursorLeft)
(let loop ((number -2))
 (FootPedalConductor::display (string-append (number->string number) " ⬇"))
 (let ((midi (d-GetMidi)))  
 ;(disp midi)
    (if (pedalDown? midi)
        (begin
         (if start
            (let* ((now (thetime)) (interval (- now start)))
              (if (> interval (/ 1 2))
                (begin
                  (set! start now)
                    (if (> number -1)
                      (let ( (at #f) (text (string-append (number->string (+ 1 
number)) " " "⬆")))
                      (cond ((= numerator 2)
                              (set! text (string-append (number->string (+ 1 
number)) " " "⬆"))
                              (set! at (round (* interval 500)))
                              (d-OneShotTimer at (string-append 
"(FootPedalConductor::display \"" text "\")")))
                            ((= numerator 3)
                                (set! text (string-append (number->string (+ 1 
number)) " " "➨"))
                                (set! at (round (* interval 333)))
                                (d-OneShotTimer at (string-append 
"(FootPedalConductor::display \"" text "\")"))
                                (set! text (string-append (number->string (+ 1 
number)) " " "⬆"))
                                (set! at (round (* interval 666)))
                                (d-OneShotTimer at (string-append 
"(FootPedalConductor::display \"" text "\")")))
                            ((= numerator 4)
                              (set! text (string-append (number->string (+ 1 
number)) " " "⟵"))
                              (set! at (round (* interval 250)))
                              (d-OneShotTimer at (string-append 
"(FootPedalConductor::display \"" text "\")"))
                              (set! text (string-append (number->string (+ 1 
number)) " " "➨"))
                              (set! at (round (* interval 500)))
                              (d-OneShotTimer at (string-append 
"(FootPedalConductor::display \"" text "\")"))
                              (set! text (string-append (number->string (+ 1 
number)) " " "⬆"))
                              (set! at (round (* interval 750)))
                              (d-OneShotTimer at (string-append 
"(FootPedalConductor::display \"" text "\")"))))))
                  (loop (+ 1 number)))
                  (disp "finished")))
            (begin ;;; not started yet
                (set! start (thetime))
                (loop (+ 1 number)))))
          (begin
            (if (pedalUp? midi)
            (loop number)))))))
(d-SetBackground #xFFFFFF)
(d-DirectiveDelete-standalone "Conductor")






reply via email to

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