Re: Issue a key change in Scheme syntax
2018-04-04 17:08 GMT+02:00 David Kastrup : > Urs Liska writes: > It's confusing for experienced users but > not for beginners. > > It's designed to work as expected, for completely unrealistic > expectations. > >> Arrgh. > > You got that right. > > -- > David Kastrup ROFL ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Issue a key change in Scheme syntax
Urs Liska writes: > Am 04.04.2018 um 13:17 schrieb David Kastrup: [...] >>> Is it possible to write the Scheme function issuing the key change >>> with the pitch and the generic mode as input? >> (key-signature >> (key >> (get-meta-option base-path 'key-tonic) >> (get-meta-option base-path 'key-mode))) >> >> Obviously I am missing something here. > > No. > >> >> Of course, you can also take a look at the definition of \key in >> ly/music-function-init.ly if you want to stick with 2.18 or something. >> > > I *still* get confused by so many basic things, for example the fact > that \key, \time etc. are not (all) elements that are directly > processed by the parser but may be implemented as functions and thus > can *directly* be called through Scheme syntax. Well, they _are_ still music functions. Calling them "through Scheme syntax" only made good sense once the "parser/location" arguments were no longer needed. "key" is _not_ a proper function. It still is a music function but it now has an "apply" method that typechecks all the arguments, caters for optional arguments (if the type doesn't fit or *unspecified* is given explicitly, the default is used instead) and then extracts the music function internal function and calls it. In short: this looks quite more simple and logical and "basic" than it actually is under the hood. It's confusing for experienced users but not for beginners. It's designed to work as expected, for completely unrealistic expectations. > Arrgh. You got that right. -- David Kastrup ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Issue a key change in Scheme syntax
Am 04.04.2018 um 13:17 schrieb David Kastrup: Urs Liska writes: Hi, in my infrastructure I have a function that binds (key-signature #{ \key #(get-meta-option base-path 'key-tonic) #(get-meta-option base-path 'key-mode) #}) but I would like to also change this to Scheme syntax (if it makes any sense after all). So? Why don't you do it? The first call to get-meta-option retrieves a Pitch object, the second a list ((0 . 0) (1 . 0) (2 . 0) (3 . 0) (4 . 0) (5 . 0) (6 . 0)) which had been stored as \major. Obviously \key expects a pitch and a mode, but \displayMusic { \key d \major } returns (make-music 'SequentialMusic 'elements (list (make-music 'KeyChangeEvent 'pitch-alist (list (cons 1 0) (cons 2 0) (cons 3 1/2) (cons 4 0) (cons 5 0) (cons 6 0) (cons 0 1/2)) 'tonic (ly:make-pitch -1 1 where the steps of the scale obviously have already been "transposed" to reflect d major. So? Is it possible to write the Scheme function issuing the key change with the pitch and the generic mode as input? (key-signature (key (get-meta-option base-path 'key-tonic) (get-meta-option base-path 'key-mode))) Obviously I am missing something here. No. Of course, you can also take a look at the definition of \key in ly/music-function-init.ly if you want to stick with 2.18 or something. I *still* get confused by so many basic things, for example the fact that \key, \time etc. are not (all) elements that are directly processed by the parser but may be implemented as functions and thus can *directly* be called through Scheme syntax. Arrgh. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Issue a key change in Scheme syntax
Urs Liska writes: > Hi, > > in my infrastructure I have a function that binds > > (key-signature > #{ >\key >#(get-meta-option base-path 'key-tonic) >#(get-meta-option base-path 'key-mode) > #}) > > but I would like to also change this to Scheme syntax (if it makes any > sense after all). So? Why don't you do it? > The first call to get-meta-option retrieves a Pitch object, the second > a list ((0 . 0) (1 . 0) (2 . 0) (3 . 0) (4 . 0) (5 . 0) (6 . 0)) which > had been stored as \major. > > Obviously \key expects a pitch and a mode, but \displayMusic { \key d > \major } returns > > > (make-music > > 'SequentialMusic > > 'elements > > (list (make-music > > 'KeyChangeEvent > > 'pitch-alist > > (list (cons 1 0) > > (cons 2 0) > > (cons 3 1/2) > > (cons 4 0) > > (cons 5 0) > > (cons 6 0) > > (cons 0 1/2)) > > 'tonic > > (ly:make-pitch -1 1 > > where the steps of the scale obviously have already been "transposed" > to reflect d major. So? > Is it possible to write the Scheme function issuing the key change > with the pitch and the generic mode as input? (key-signature (key (get-meta-option base-path 'key-tonic) (get-meta-option base-path 'key-mode))) Obviously I am missing something here. Of course, you can also take a look at the definition of \key in ly/music-function-init.ly if you want to stick with 2.18 or something. -- David Kastrup ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user