denemo-devel
[Top][All Lists]
Advanced

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

[Denemo-devel] [bug #28435] Transposing script


From: anonymous
Subject: [Denemo-devel] [bug #28435] Transposing script
Date: Wed, 30 Dec 2009 03:44:41 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6

URL:
  <http://savannah.gnu.org/bugs/?28435>

                 Summary: Transposing script
                 Project: GNU Denemo, a gtk+ frontend to GNU Lilypond
            Submitted by: None
            Submitted on: Wed 30 Dec 2009 03:44:39 AM UTC
                Category: Feature request
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

Do the denemo transposition commands work?  I couldn't figure them out if so.
 This script will only transpose monophonic lines.  It makes a mess on
chords--I guess that's why the DiatonicShift command is deprecated??  Not sure
at the moment how to extend it to chords.  If the denemo commands don't work I
think this would work for now.  I'm new to scheme so maybe the defines
shouldn't be used.  

Here's the xml from the command set:

      <row>
        <action>Transpose</action>
        <scheme></scheme>
        <menupath>/ObjectMenu/NotesRests</menupath>
        <label>Transpose</label>
        <tooltip>Transposes from the cursor to the end of the staff.  Use
only on single voices-no chords.</tooltip>
      </row>

The script is attached and pasted here-Dan W.

<?xml version="1.0"?>
<Denemo>
  <merge>
    <title>A Denemo Keymap</title>
    <author>DRW</author>
    <map>
      <row>
        <action>Transpose</action>
        <scheme>(define (transpose  DiatonicInterval ChromaticInterval )
   (let ((OldNote 0)(TargetNote 0) ) 
        (set! OldNote (d-GetNoteAsMidi))
        (set! TargetNote (+ OldNote ChromaticInterval) )
        (d-DiatonicShift DiatonicInterval )
        (if (&lt; (d-GetNoteAsMidi) TargetNote ) (d-Sharpen) )
        (if (&lt; (d-GetNoteAsMidi) TargetNote ) (d-Sharpen) )
        (if (&gt; (d-GetNoteAsMidi) TargetNote ) (d-Flatten) )
        (if (&gt; (d-GetNoteAsMidi) TargetNote ) (d-Flatten) )
  )
)

(define (TransposeAll DiatonicInterval ChromaticInterval )
;       (transpose DiatonicInterval ChromaticInterval)
      (do ((i #t (d-CursorRight) ))
        ( (equal?  i #f) #f)
        (if (equal? (d-GetType)  "CHORD" ) 
          (transpose DiatonicInterval ChromaticInterval ) 
        )
      )
)


(let 
   ((X "") (IntervalStep "")(Modifier 0) (IntervalType "")(TypeString "")
(IntervalDirection "Up" )(DiatonicInterval "-1")(ChromaticInterval -2) 
      (IntervalList '(("Second"  "1"  2) ("Third"  "2" 4)("Unison"  "0"
0)("Fourth"  "3" 5)("Fifth"  "4" 7)("Sixth" "5" 9)("Seventh" "6" 11) ("Octave"
"7" 12) ))
   )
(set! IntervalStep (d-GetOption (string-append "Unison" stop "Second" stop
"Third" stop "Fourth" stop "Fifth" stop "Sixth" stop "Seventh" stop "Octave"
stop) ) )
(if (member IntervalStep '("Second" "Third" "Sixth" "Seventh" ) ) 
  (set! TypeString (string-append "Major" stop "Minor" stop )) (set!
TypeString (string-append "Perfect" stop) ) )

(set! TypeString (string-append TypeString "Augmented" stop ) )
(if (not (equal? IntervalStep "Unison" )) (set! TypeString (string-append
TypeString "Diminished" stop) ))
(set! IntervalType (d-GetOption TypeString)) 
(set! IntervalDirection (d-GetOption (string-append "Up" stop "Down" stop)))
(set! X (assoc IntervalStep IntervalList ) )
(set! DiatonicInterval (car (cdr X)) )
(set! ChromaticInterval (car (cdr  (cdr X))))
(if (equal? IntervalType "Augmented" ) (set! Modifier 1) )
(if (equal? IntervalType "Minor" ) (set! Modifier -1) )
(if (equal? IntervalType "Diminished") (set! Modifier ( if (member
IntervalStep '("Second" "Third" "Sixth" "Seventh" ) ) -2 -1 ) ) )
(set! ChromaticInterval (+ ChromaticInterval Modifier) )
(if (equal? IntervalDirection "Down" )
  (begin
    (set! DiatonicInterval (string-append "-" DiatonicInterval ))
    (set! ChromaticInterval ( * ChromaticInterval -1) )
  )
)
(TransposeAll DiatonicInterval ChromaticInterval) 
)</scheme>
        <label>Transpose</label>
        <tooltip>Transposes from the cursor to the end of the staff.  Use
only on single voices-no chords.</tooltip>
      </row>
    </map>
  </merge>
</Denemo>



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Wed 30 Dec 2009 03:44:39 AM UTC  Name: Transpose  Size: 3kB   By: None

<http://savannah.gnu.org/bugs/download.php?file_id=19392>

    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

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