lilypond-user
[Top][All Lists]
Advanced

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

Input for "\chords": What data type?


From: Klaus Blum
Subject: Input for "\chords": What data type?
Date: Mon, 15 Jun 2015 15:10:05 -0700 (MST)

Dear list fellows, 

I am trying to write a function which outputs chord symbols after
transposing them. 
But what type of data do I need for the input of the "\chordmode" or
"\chords" function, i.e stuff like 
    { c1 d:m f g:7 }  
?



    \chords { c1 d:m f g:7 }

returns:
    C   Dm   F   G7
as expected.
    
    
    
    mychords =
    #(define-music-function (parser location arg) (ly:music?)
       #{
         \chords { $arg }
       #})
    \mychords { c1 d:m f g:7 }

returns:
    C   D    F    G
Additions like  ":m"  or  ":7"  are ignored and produce an error message
because they are not part of a regular music expression.


    transchordsI =
    #(define-music-function (parser location arg) (ly:music?)
       #{
         \chords { \transpose c d { $arg } }
       #})
    \transchordsI { c1 d:m f g:7 }

and

    transchordsII =
    #(define-music-function (parser location arg) (ly:music?)
       #{
         \transpose c d { \chords { $arg } }
       #})
    \transchordsII { c1 d:m f g:7 }

obviously suffer the same problem.


However,
    \trans { \chords { c1 d:m f g:7 } }
works without problems.
It seems that the OUTPUT of "\chords" is accepted as a music expression.

Surprisingly, even
    \chords { \trans { c1 d:m f g:7 } }
works, and I can't understand why...



I've tried nearly each and every data type ("predicate"). If "ly:music?"
isn't the right choice, what do I need? 
Am I missing something else?

Thanks for any hint
Klaus

chord_function_fail.ly
<http://lilypond.1069038.n5.nabble.com/file/n177895/chord_function_fail.ly>  
chord_function_fail.pdf
<http://lilypond.1069038.n5.nabble.com/file/n177895/chord_function_fail.pdf>  



--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Input-for-chords-What-data-type-tp177895.html
Sent from the User mailing list archive at Nabble.com.



reply via email to

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