|
From: | Jacques Menu |
Subject: | Re: musicxml2ly in python |
Date: | Fri, 25 Feb 2022 16:17:57 +0100 |
Hello Sebastian, This can also be done with a make file, but maybe that is not your use case. Doing so offers means to place the generated files in sub-folders and to remove them seamlessly. Also, only the .xml files modified or created since the last ‘make’ execution are converted. Attached is an example Makefile, which I use to convert all the .xml files in a folder with my xml2ly. It can be used with musicxml2ly too: drop this Makefile in the given folder and use it as shown below. ‘OPTIONS=...‘ is neccesary in this case because there is otherwise a default ‘-q’ (quiet) to be used by xml2ly. It can be as simple as ‘OPTIONS=‘. HTH! JM — jacquesmenu@macmini: ~/musicformats-git-dev/files/musicxmlfiles/keys > make help Makefile for converting MusicXML files to LilyPond scores. Supplied as part of the MusicFormats library, thanks to Dom Fober for providing it. Output files are written in sub-folders of the current folder. Available targets are: 'all' (default) : call the 'lily' target. 'lily' : converts the set of MusicXML files to lilypond in folder 'pnglily' : converts the output of 'lily' target to png in folder pnglily 'pdflily' : converts the output of 'lily' target to pdf in folder pdflily 'midilily' : converts the output of 'lily' target to pdf in folder midilily 'clean' : removes the sub-folders containing the results Options: 'XML2LY=/path/to/xml2ly 'OPTIONS=... 'LILYPOND=/path/to/lilypond When those options are not specified, the tools are taken from the current PATH variable, and OPTIONS contains '-q' (quiet mode) for xml2ly. jacquesmenu@macmini: ~/musicformats-git-dev/files/musicxmlfiles/keys > make XML2LY=musicxml2ly OPTIONS=--midi XML2LY = musicxml2ly OPTIONS = --midi LILYPOND = /Applications/LilyPond/lilypond-2.23.6/bin/lilypond musicxml2ly version is: musicxml2ly (LilyPond) 2.22.1 lilypond version is: GNU LilyPond 2.23.6 (running Guile 2.2) musicxml2ly --midi -o "lilypond/HumdrumScotKeys.ly" "HumdrumScotKeys.xml" musicxml2ly: Reading MusicXML from HumdrumScotKeys.xml ... musicxml2ly: Converting to LilyPond expressions... musicxml2ly: Output to `lilypond/HumdrumScotKeys.ly' musicxml2ly: Converting to current version (2.22.1) notations ... /Applications/LilyPond/lilypond-2.23.6/bin/lilypond --pdf -l NONE -s -o "pdflily/HumdrumScotKeys" "lilypond/HumdrumScotKeys.ly" Contents of lilypond sub-folder: 8 -rw-r--r-- 1 jacquesmenu staff 1708 Feb 25 16:14 lilypond/HumdrumScotKeys.ly Contents of pdflily sub-folder: 88 -rw-r--r-- 1 jacquesmenu staff 42039 Feb 25 16:14 pdflily/HumdrumScotKeys.pdf jacquesmenu@macmini: ~/musicformats-git-dev/files/musicxmlfiles/keys > ls -salR total 24 0 drwxr-xr-x 7 jacquesmenu staff 224 Feb 25 16:14 . 0 drwxr-xr-x 108 jacquesmenu staff 3456 Feb 25 07:46 .. 16 -rw-r--r--@ 1 jacquesmenu staff 6148 Feb 25 12:51 .DS_Store 8 -rw-r--r-- 1 jacquesmenu staff 2634 Apr 22 2021 HumdrumScotKeys.xml 0 lrwxr-xr-x 1 jacquesmenu staff 11 Feb 25 14:12 Makefile -> ../Makefile 0 drwxr-xr-x 3 jacquesmenu staff 96 Feb 25 16:14 lilypond 0 drwxr-xr-x 4 jacquesmenu staff 128 Feb 25 16:14 pdflily ./lilypond: total 8 0 drwxr-xr-x 3 jacquesmenu staff 96 Feb 25 16:14 . 0 drwxr-xr-x 7 jacquesmenu staff 224 Feb 25 16:14 .. 8 -rw-r--r-- 1 jacquesmenu staff 1708 Feb 25 16:14 HumdrumScotKeys.ly ./pdflily: total 96 0 drwxr-xr-x 4 jacquesmenu staff 128 Feb 25 16:14 . 0 drwxr-xr-x 7 jacquesmenu staff 224 Feb 25 16:14 .. 8 -rw-r--r-- 1 jacquesmenu staff 170 Feb 25 16:14 HumdrumScotKeys.midi 88 -rw-r--r-- 1 jacquesmenu staff 42039 Feb 25 16:14 HumdrumScotKeys.pdf jacquesmenu@macmini: ~/musicformats-git-dev/files/musicxmlfiles/keys > make clean jacquesmenu@macmini: ~/musicformats-git-dev/files/musicxmlfiles/keys > ls -sal total 24 0 drwxr-xr-x 5 jacquesmenu staff 160 Feb 25 15:57 . 0 drwxr-xr-x 108 jacquesmenu staff 3456 Feb 25 07:46 .. 16 -rw-r--r--@ 1 jacquesmenu staff 6148 Feb 25 12:51 .DS_Store 8 -rw-r--r-- 1 jacquesmenu staff 2634 Apr 22 2021 HumdrumScotKeys.xml 0 lrwxr-xr-x 1 jacquesmenu staff 11 Feb 25 14:12 Makefile -> ../Makefile |
Makefile
Description: Binary data
[Prev in Thread] | Current Thread | [Next in Thread] |