|
From: | Urs Liska |
Subject: | Re: Import, edit and export a Lilypond file using Python |
Date: | Sun, 06 Apr 2014 17:35:38 +0200 |
User-agent: | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 |
Am 06.04.2014 17:19, schrieb Joachim Jablon:
Le 06/04/2014 15:56, Urs Liska a écrit :It's not fully clear what you mean yet, but it sounds that you might be _much_ better off when you simply create different .ly files with "scores" just displaying the voices you want. UrsYes, that's where I'm headed for, but it must be in a completely automated way, from a MusicXML file... The question is (probably better worded as) *how* would you create a .ly file with a single voice from a file (MusicXML or .ly) containing multiple voices, using a (Python) script...
I can't check right now, but I _assume_ that musicxml2ly will produce a file with a number of variables containing the music and a \score block.
Furthermore I assume your variables will always be the same (e.g. "sopranoMusic" or whatever).
Then you could - run musicxml2ly on your xml file - purge the \score block from it (check if that always comes last in the file, then it should be very easy) - write different .ily ("include ly") files containing (only) different \score structures, one for each kind of output you want to have. (this should be done beforehand and only once) - create different .ly files, one for each type of output. This should first include the generated and stripped conversion file and then the desired score block. creating these .ly files could be done programmatically by using a template file. Doing all this with a Python script seems quite straightforward. And I'm not sure whether you need to mangle the XML files first. HTH UrsPS: Please always reply to the list or to all, so that everyone can share the discussion (I have already done this for the current message).
So for now, I' following David Kastrup's advice and working with the MusicXML file directly... -- Joachim Jablon
-- Urs Liska www.openlilylib.org
[Prev in Thread] | Current Thread | [Next in Thread] |