Thomas Morley <thomasmorle...@googlemail.com> writes: > Hi, > > trying to write a function to construct and mix/remix some music via > `make-sequential-music' I noticed the following boiled down problem. > > The \xyz-function below should return a whole note for { b }
Why? > %%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > \version "2.14.2" > \version "2.15.43" > > xyz = > #(define-music-function (parser location) () > (make-sequential-music (list > #{ a1 #} > #{ b #}))) >From Changes: * The construct `#{ ... #}' can now be used not just for constructing sequential music lists, but also for pitches (distinguished from single note events by the absence of a duration or other information that can't be part of a pitch), > Instead a cryptic log-message is printed: > > GNU LilyPond 2.15.43 > > /home/harm/lilypond-git/build/out/share/lilypond/current/scm/music-functions.scm:35:14: > In procedure ly:music-property in expression (ly:music-property mus > (quote types)): > /home/harm/lilypond-git/build/out/share/lilypond/current/scm/music-functions.scm:35:14: > Wrong type argument in position 1 (expecting Music): (#<procedure > embedded-lilypond (parser lily-string filename line closures)> parser > " a1 " "various-tests.ly" 95 (list)) That looks more like '( #{ a1 #} ... rather than (list #{ a1 #} ... this is the unevaluated form. I get instead for xyz = #(define-music-function (parser location) () (make-sequential-music (list #{ a1 #} #{ b #}))) \xyz -*- mode: compilation; default-directory: "/tmp/" -*- Compilation started at Mon Aug 6 05:50:16 lilypond /tmp/ccc.ly GNU LilyPond 2.15.42 Processing `/tmp/ccc.ly' Parsing.../usr/local/share/lilypond/2.15.42/scm/music-functions.scm:35:14: In procedure ly:music-property in expression (ly:music-property mus (quote types)): /usr/local/share/lilypond/2.15.42/scm/music-functions.scm:35:14: Wrong type argument in position 1 (expecting Music): #<Pitch b > Compilation exited abnormally with code 1 at Mon Aug 6 05:50:17 > (with "2.14.2" the { b } defaults to a quater.) > > Intended is that the duration should change only if explicit forced. > > > What am I missing? Each #{ ... #} is executed in its own parser copy. There is no useful "default duration", so you should give an explicit duration anyway. For that reason, #{ b #} is a reasonable shortcut for specifying a naked pitch. Calling make-sequential-music is a low-level construct. If you really want this kind of thing to work, you can use #{ $@(list #{ a1 #} #{ b #}) #} But since the outer parser (which now sees a pitch second which it turns into a note event in this place) still has not seen an explicit duration, you'll get a quarter note anyhow. -- David Kastrup _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user