Welcome, Guest! Log In | Create Account

Changeset 1974

Show
Ignore:
Timestamp:
09/16/09 09:58:49 (3 months ago)
Author:
t-anders
Message:

Changed 41 ET Lily header for HE notation

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/strasheela/contributions/anders/ET41/source/Lilyheader.ly.data

    r1944 r1974  
    1 %% see http://www.mail-archive.com/lilypond-devel@gnu.org/msg18989.html 
    2 %% and /Applications/LilyPond.app/Contents/Resources/share/lilypond/current/scm/music-functions.scm 
    3 modern = #`(Staff ,(make-accidental-rule 'same-octave 0) 
    4                   ,(make-accidental-rule 'any-octave 0) 
    5                   ,(make-accidental-rule 'same-octave 1)) 
     1 
     2%% 
     3%% Microtonal Helmholtz-Ellis notation with Lilypond 
     4%% 
     5 
     6%% Font HE put in as 2nd font, which can be accessed as \sans. 
     7\paper{ 
     8#(define fonts (make-pango-font-tree "Century Schoolbook L" 
     9                                     "HE" 
     10                                     "Bitstream Vera Sans Mono" 
     11                        1)) 
     12} 
     13 
     14%% accessing the accidental of an individual note in a 
     15%% chord and setting some properties (prop-alist) 
     16#(define (modify-accidental note-grob prop-alist) 
     17  ;; notehead before-line-breaking callback 
     18  (let ((accidental (ly:grob-object note-grob 'accidental-grob))) 
     19   (if (not (null? accidental)) 
     20    (for-each 
     21     (lambda (x) 
     22      (ly:grob-set-property! accidental (car x) (cdr x))) 
     23     prop-alist)))) 
     24 
     25%% get the X-extend of a markup used as accidental 
     26#(define (markup-X-extent markup)  
     27  (lambda (grob) 
     28   (ly:stencil-extent (grob-interpret-markup grob markup) X))) 
     29 
     30#(define (markup-X-extent markup) 
     31  (lambda (grob) 
     32   (interval-translate (ly:stencil-extent (grob-interpret-markup grob markup) X)      
     33;   -0.7 
     34    -0.5 
     35  ))) 
     36 
     37%% setting the text of a chord accidental to a given markup 
     38#(define (accidental-text markup) 
     39  (lambda (grob) 
     40   (modify-accidental grob    
     41    `(; show the markup extend as box (for debugging) 
     42      ; (stencil . ,(lambda (grob) (box-stencil (ly:text-interface::print grob) 0 0))) 
     43      (stencil . ,ly:text-interface::print) 
     44      (text . ,markup)        
     45      (X-extent . ,(markup-X-extent markup)))))) 
     46 
     47%% Sets accidental of next note to a markup created with the given string using the HE font. 
     48HE =  
     49#(define-music-function (parser location marktext) (string?) 
     50  #{ 
     51  %% all accidentals are written as markups 
     52  \once \override Accidental #'stencil = #ly:text-interface::print 
     53  %% show the markup extend as box (for debugging) 
     54%   \once \override Accidental #'stencil = #(lambda (grob) (box-stencil (ly:text-interface::print grob) 0 0)) 
     55  \once \override Accidental #'text = \markup { \sans $marktext } 
     56  \once \override Accidental #'X-extent = #(markup-X-extent (markup #:sans $marktext)) 
     57  #}) 
     58 
     59%% expects a markup and sets accidental of next note to that markup 
     60markupHE = 
     61#(define-music-function (parser location markup) (markup?) 
     62  #{ 
     63  %% all accidentals are written as markups 
     64  \once \override Accidental #'stencil = #ly:text-interface::print 
     65  %% show the markup extend as box (for debugging) 
     66%   \once \override Accidental #'stencil = #(lambda (grob) (box-stencil (ly:text-interface::print grob) 0 0)) 
     67  \once \override Accidental #'text = #$markup 
     68  \once \override Accidental #'X-extent = #(markup-X-extent $markup) 
     69  #}) 
     70 
     71%% Sets accidental of next chord note to a markup created with the given string using the HE font. 
     72%% markup. \override does not work for chords nor for accidentals, so 
     73%% a special technique is required 
     74chordHE = 
     75#(define-music-function (parser location marktext mus) (string? ly:music?)   
     76  (set! (ly:music-property mus 'tweaks)         
     77   (acons 'before-line-breaking 
     78    (accidental-text (markup #:sans marktext))                
     79    (ly:music-property mus 'tweaks))) 
     80  mus)  
     81 
     82%% expects a markup and sets accidental of next chord note to that markup 
     83markupChordAccidental = 
     84#(define-music-function (parser location mkup mus) (markup? ly:music?)   
     85  (set! (ly:music-property mus 'tweaks)         
     86   (acons 'before-line-breaking (accidental-text mkup)                
     87    (ly:music-property mus 'tweaks))) 
     88  mus)  
     89 
     90 
     91%% accidental rule set outside score so it can be defined in \layout 
    692dodecaphonic = #`(Staff ,(lambda (c p bn mp) '(#f . #t))) 
     93 
    794\layout { 
    8   \context { \Score % or Staff, or Voice 
    9              autoAccidentals = #dodecaphonic 
    10              autoCautionaries = #dodecaphonic 
    11            } 
     95  \context  
     96  { \Score 
     97    %% there is an accidental for every note  
     98    autoAccidentals = #dodecaphonic 
     99    autoCautionaries = #dodecaphonic 
     100    %% show the markup extend as box (for debugging)§ 
     101%     \override Accidental #'stencil = #(lambda (grob) (box-stencil (ly:text-interface::print grob) 0 0)) 
     102    %% by default all accidentals are written as markups 
     103    \override Accidental #'stencil = #ly:text-interface::print 
     104    %% default is the natural accidental 
     105    \override Accidental #'text = #(markup #:sans "n")    
     106    \override Accidental #'X-extent = #(markup-X-extent (markup #:sans "n"))   
     107    %% more space between all notes  
     108%     \override SpacingSpanner #'base-shortest-duration = #(ly:make-moment 1 16) 
     109  } 
    12110} 
    13111