Open wbsoft opened 9 years ago
I've started to make a simple translator from REAPER selected items, formatted in Reaper's notation view, and discovered the same issue as described here.
But then I've found the python folder in the original LilyPond repository. It seems it has the same structural classes as ly.music.items
but better implemented and with possibility to render a tree.
Can the team consider using the original LilyPond repo implementation inside this library? I can try to integrate it when have a spare week
I think python-ly is essentially deprecated. The quick-ly
project is the successor, with a two-way connection between source text and tree-structured musical representation. However, for creating LilyPond source from a music structure LilyPond's own musicexp.py can be used perfectly.
@wbsoft , quickly
is the tool I need, thank you so much!)))
quickly is not yet complete, it is rather in its infancy and very much in flux, but I have some time to devote to it, and eventually it will become the new engine for Frescobaldi's understanding of LilyPond text input.
Thanks, maybe I'll find time to help with it. As I much more prefer to have a package-like tool on PyPi that can be mentioned in requirements than a single-folder from the big LilyPond repository)))
Dear friends, I want to take the lead for redesigning
ly.music
. This issue is to continue the thread at wbsoft/frescobaldi#492, which I'll close.ly.music
currently has two shortcomings:It was initially designed to create a tree structure from an existing document, which is done in the
ly.music.read
module.@crantila emphasizes on the fact that basing
ly.music
aroundxml.etree
orlxml
would make it much faster as not a python object is created for every single tree item, and we would have powerful search possibilities for free.I am willing to design the
ly.music
tree such that it adheres to simple principles, maybe even without creating a class for every type of element.We need the following:
ly.document.Document
) and have all tree items know the originating tokens (and thus source position, as every token has the position in the source file in thepos
attribute)Functions like transpose or translate currently iterate over tokens, but they should operate on the tree in the future, and simply change the tree.
When the tree was built from a tokenized source (i.e. the originating tokens are attached to the tree nodes, while their current value has changed) a dedicated module should be able to find out which changes need to be done to the originating document to have it reflect whatever is changed in the tree. (We won't dump a new LilyPond document because that would bluntly overwrite things that a user might have done different, like whitespace or comments that may or may not be present in the tree, and also that would destroy markings or cursor positions for point-and-click when a document is overwritten inside an editor such as Frescobaldi.)