bugDenemo - Bugs: bug #28435, Transposing script

 
 

bug #28435: Transposing script

Submitter:  None
Submitted:  Wed 30 Dec 2009 03:44:39 AM UTC
   
 
Category:  Feature request Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Originator Name:  Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 30 Dec 2009 02:40:56 PM UTC, comment #2: 

I just tried this, and it worked, but I had to select a single staff at a time. That would be a single voice in fact. The script could be improved in this respect.
Be aware that there are also print transpositions, where your music is left intact, and only the print out is transposed.

Richard Shann <rshann>
Group administrator
Wed 30 Dec 2009 04:17:19 AM UTC, comment #1: 

Transposition does work. Use it like this:
Select what you want to transpose with the mouse. In the menu click on Edit->Transpose->Transpose Selection

Then in the dialog pretend that if the note "c'" appeared in the music what would it appear as once transposed. So if you are in the key of f major and you wanted to move to g major you would put it "d'". Chords can be transposed with it as well as monophonic lines.


Jeremiah Benham <jjbenham>
Group administrator
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 (&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>

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #19392:  Transpose added by None (3KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by steele (Updated the item)
  • -email is unavailable- added by rshann (Posted a comment)
  • -email is unavailable- added by jjbenham (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-12-04 steele Open/ClosedOpen Closed
    2009-12-30 rshann StatusNone Fixed
    2009-12-30 None Attached File- Added Transpose, #19392

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code