[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: instrumentSwitch and addInstrumentDefinition use
From: |
Jan-Peter Voigt |
Subject: |
Re: instrumentSwitch and addInstrumentDefinition use |
Date: |
Tue, 13 Jan 2015 08:05:19 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 |
Hi Keith,
thanks for that snippet! It should be possible to add KeySignatures to
the edition-engraver ... and to automatically create a KeySig on change
of instrument transposition ...
Cheers,
Jan-Peter
Am 12.01.2015 um 06:28 schrieb Keith OHara:
> ...
>
> \version "2.19.15"
> transpositionUpdateKey =
> #(define-music-function (parser location new-transposition) (ly:pitch?)
> (_i "Set instrument transposition and, based on the previous
> transposition and key, generate the key-change to keep the sounding key.")
> (define (generate-key-change c)
> (define (same-scale-step? a b) (= (car a) (car b)))
> (let* ((old-alt (delete-duplicates!
> (append (ly:context-property c 'keyAlterations)
> major)
> same-scale-step?))
> (old-tonic (ly:context-property c 'tonic (ly:make-pitch 0 0
> 0)))
> (old-transp (ly:context-property c 'instrumentTransposition
> (ly:make-pitch 0 0 0)))
> (delta (ly:pitch-diff old-transp new-transposition))
> (new-alt (ly:transpose-key-alist old-alt delta))
> (new-tonic (ly:pitch-transpose old-tonic delta))
> (sev (ly:make-stream-event `(key-change-event)
> `((pitch-alist . ,new-alt)
> (tonic . ,new-tonic)))))
> (ly:broadcast (ly:context-event-source c) sev)))
> #{
> \applyContext #generate-key-change
> \transposition $new-transposition
> #} )
>
>
> prepClarinet = { \set Staff.shortInstrumentName="Clar"
> <>^\markup\italic\center-align "pick up clarinet" }
> clarinet = { <>^\markup\bold"Clarinet"
> \once\set Staff.whichBar = "||"
> \transpositionUpdateKey bes }
>
> concertBandEdition = {
> s1*3 \tag#'Sue \prepClarinet
> s1 \mark"All Reeds" \tag#'Sue \clarinet}
>
> tune = { \key c\major \repeat unfold 4 {c'4 e' g' b' R1} }
> backup = { \key c\major \repeat unfold 8 {c'4 e' g' b' } }
> \addQuote "tune" \tune
>
> << \new Staff \with { instrumentName="horn in F" }
> \keepWithTag#'Sue <<
> \concertBandEdition \transposition f
> \quoteDuring "tune" #(skip-of-length tune) >>
> \new Staff \with { instrumentName="alto clarinet" }
> \keepWithTag#'Joe <<
> \concertBandEdition \transposition es
> \transpose es c' \backup >>>>
>
- Re: instrumentSwitch and addInstrumentDefinition use, (continued)
- Re: instrumentSwitch and addInstrumentDefinition use, Kieren MacMillan, 2015/01/19
- Re: instrumentSwitch and addInstrumentDefinition use, Keith OHara, 2015/01/20
- Message not available
- Re: instrumentSwitch and addInstrumentDefinition use, Kieren MacMillan, 2015/01/12
- Re: instrumentSwitch and addInstrumentDefinition use, Keith OHara, 2015/01/13
- Re: instrumentSwitch and addInstrumentDefinition use, Kieren MacMillan, 2015/01/13
- Re: instrumentSwitch and addInstrumentDefinition use, Keith OHara, 2015/01/18
- Re: instrumentSwitch and addInstrumentDefinition use, Kieren MacMillan, 2015/01/18
- Re: instrumentSwitch and addInstrumentDefinition use, Keith OHara, 2015/01/20
- Re: instrumentSwitch and addInstrumentDefinition use, Kieren MacMillan, 2015/01/20
- Re: instrumentSwitch and addInstrumentDefinition use, Keith OHara, 2015/01/25
- Re: instrumentSwitch and addInstrumentDefinition use,
Jan-Peter Voigt <=
- Re: instrumentSwitch and addInstrumentDefinition use, Paul Scott, 2015/01/12
Re: instrumentSwitch and addInstrumentDefinition use, Flaming Hakama by Elaine, 2015/01/14
Re: instrumentSwitch and addInstrumentDefinition use, Flaming Hakama by Elaine, 2015/01/14