LilyPond parsing in Haskell

83 views
Skip to first unread message

Martin Finke

unread,
Apr 15, 2015, 3:45:44 AM4/15/15
to music-sui...@googlegroups.com, ha...@hanshoglund.se
Hello,

I just found out about Music Suite and it looks very nice, but it says that LilyPond input isn't supported yet. I'm looking for something that can parse the LilyPond chord syntax (like c2:m f4:aug …). Do you know of a Haskell package that can do this?

Best Regards
Martin

Hans Höglund

unread,
Apr 15, 2015, 5:43:47 PM4/15/15
to Martin Finke, music-sui...@googlegroups.com
Hi Martin,

As far as I know there are no such libraries yet. I don't have any plan adding it soon, but if you want to try it out yourself, feel free. Here is a rough guide on how:

In the lilypond2 library on Hackage (written by me) you will find a big data type representing the syntax tree of lilypond expressions. It's necessary to write a parser for this structure, as described in http://book.realworldhaskell.org/read/using-parsec.html. You want to construct a value of type (Text.Parsec.Parser Music.Lilypond.Music) . Then you need to implement a function (fromLilypond :: Music.Lilypond.Music -> Score StandardNote) or similar, which should be simple at least as far as pitch and duration is concerned.

If you have any success with this I'd be happy to help you integrate your code into the libraries.

Best wishes,
Hans

Reply all
Reply to author
Forward
0 new messages