lilypond-user
[Top][All Lists]
Advanced

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

Re: Input for "\chords": What data type?


From: Thomas Morley
Subject: Re: Input for "\chords": What data type?
Date: Tue, 16 Jun 2015 00:38:51 +0200

2015-06-16 0:10 GMT+02:00 Klaus Blum <address@hidden>:
> 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 }

The above is equivalent to
\mychords \notemode { c1 d:m f g:7 }
Can't work.

You have to state \chordmode explicitly or work _inside_ chordmode.
Either of this work:

    \mychords \chordmode { c1 d:m f g:7 }


    \chordmode { \mychords { c1 d:m f g:7 } }

Ofcourse 'mychords' contains some redundancy then ;)

Below the same

HTH,
  Harm

>
> 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.
>
> _______________________________________________
> lilypond-user mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/lilypond-user



reply via email to

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