Wed 30 Dec 2009 03:44:39 AM UTC, original submission:
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 (< (d-GetNoteAsMidi) TargetNote ) (d-Sharpen) )
(if (< (d-GetNoteAsMidi) TargetNote ) (d-Sharpen) )
(if (> (d-GetNoteAsMidi) TargetNote ) (d-Flatten) )
(if (> (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>
|