I am working on a piece where I need many short example extracts. I thoght I could simplify this with a music-function. This is what I've got:

musicExtract = #(def-music-function (parser location music) (string?)
  (ly:parser-parse-string (ly:clone-parser parser) (string-append "
\\score {
  { " music " }
  \\layout {
    indent = 10\\mm
    raggedright = ##t
    \\context {
      \\Staff
      \\remove Time_signature_engraver
      \\remove Bar_engraver
    }
  }
}
")) (make-music 'SequentialMusic))

Running this with
\musicExtract #"a4 b c d"

gives me
<string>:3:4: error: syntax error, unexpected STRING
  {
    a4 b c d }

Now, my Scheme programming is very rusty, so I'm probably doing something silly.

Also, I'm using a string because that appeared simpler. I would really want to use ly:music as the parameter type, but then I need some code to expand the music list, and I don't have a clue as to what that would be.

--
Sven Axelsson
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to