Skip to main content
Topic: ExportImportMeasures.og (Read 9650 times) previous topic - next topic

ExportImportMeasures.og

24/02/2020:
Version 2.0 is now added.
Apart from fixing some bugs, following modifications are added:
* Extending incomplete staves, not only before, but also after the import.
* Warning at the export stage for possible exceeding the maximum length for import.
* The medley title in the commnents section should be in the last line. This is now added in the help text.
----------

* With this tool you can copy all or selected measures (of all staves), including the lyrics, and pasting them in another file. A possible use is to reassemble a medley from its separate songs.

* In order to do this, you have to run the tool from a source file to 'export' a selection or all measures.
You'll be shown an output window, which you have to copy into your clipboard.

* Then you have to rerun the tool from your 'destination file' to import (append or insert after a specified measure) the exported items . An input window will be presented where you have to paste the content of your clipboard.

* The input screen for the import seems to be limited. The tool will check if the input contains the trailer line and ends with an error message if not. In that case, use smaller selections for exporting.

* In the selection box for last measure to export, a default value of 1024 is prefilled. Leave that unchanged if you want to specify the last measure of your file.

* Linking the import staves to the corresponding staves in the destination file is done by comparing the staff labels.
If no matching is found, you'll be presented two options: specify the staff to link with, or add a new staff.
If you have specified a linking staff, you'll be asked wich label has to be withheld.

* A text marker with the song title will be added in the first imported measure of the first staff. 

*It's recommended that, before importing, you add the medley title as a line in the comments section of the Song Info window. This line should start with "MedleyTitle:", without a space.
You can start with a copy of the first song as destination file. At the fist import (of the second song), the song title of the first song will be added as a text marker in the first measure, and the medley title from the comments will be used as new song title.

* The following properties of a staff will be compared with those in its corresponding imported staff: visibility, muted, layered, ending bar, volume, stereopan, channel, play back device, instrument, default dynamic velocities and trasposition.
Difference will be reported and you have the choice to proceed or cancel. If you proceed, the propertied of the destination file will be withheld.
* Before appending or inserting the imported staves, incomplete staves in the destination file will be extended with measures containins rests, up to the insertion measure.

* If a stave contains few lyric lines than the corresponding imported staff, the number of lyric lines of the destination file will be augmented and the lower boundary increased accordingly.
* Incomplete lyric lines in the destination files will be filled with underscores, separated with blanks.
Always look on the bright side of life!

Re: ExportImportMeasures.og

Reply #1
And once more:  Congratulations, Opagust -- Your refined tool works close to perfect!
I have just completed my 2nd medley out of 5 songs, with 6-8 staves.
Excellent, your handling of mismatched parameters like staff names, stereo pans etc., that saved me a lot of extra work in preparation of the files. Actually, it seems I've dumped a lot of work I didn't want to do manually, on your shoulders -- but now it is saved in your tool for further use.
I found a few glitches (if not user handling errors, who knows?), and a few potential improvements came to my mind. I'll comment on these tomorrow.
And, similar to Hydra (the classical one): One wish fulfilled, makes two or more new ones arise...
Thanks and so long,
Horst

Re: ExportImportMeasures.og

Reply #2
Hmm.  Not sure what I'm doing wrong but on a simple 2 staff, one lyric song I get the following error message when trying to import the results to a new file:

C:\ProgramData\Noteworthy Software\nwc2\UserPlugins\ExportImportMeasures.lua:121: bad argument #1 to 'sub' (string expected, got nil)


Re: ExportImportMeasures.og

Reply #3
Hmm.  Not sure what I'm doing wrong but on a simple 2 staff, one lyric song I get the following error message when trying to import the results to a new file:

C:\ProgramData\Noteworthy Software\nwc2\UserPlugins\ExportImportMeasures.lua:121: bad argument #1 to 'sub' (string expected, got nil)


I took a quick look and I think this error occurs when the comments section in the SongInfo panel is empty. I wait for the next comments of Horst to include that change. In the mean time, maybe you can just enter something in the comments section (a space would be enough). If you retry whithout the error occurring, then my suspect was right.
Always look on the bright side of life!

Re: ExportImportMeasures.og

Reply #4
Soundcheck of the new medley ran flawlessly, as expected. Now, my comments:
First__ I am very happy with this new tool!
Second__ A few glitches were encountered that appear to me as resulting from little bugs:
1. The MedleyTitle mechanism:
a)  I didn't understand from the description that the MedleyTitle apparently has to appear in the comment section of one of the imported files. Intuitively, I had first put it in the comments of the destination file, but there it had no effect. Perhaps the description/Help text could be amended to reflect this.
b) Unlike the title of the first song, the MedleyTitle should not appear in the score as a text marker.
c) The MedleyTitle swallows too much information. Preferably, it should get just the text folllowing the 'MedleyTitle' keyword in line.
However, in all of my attempts it grabbed much more: Up to the 2nd filled line of the comments, and even more, the complete content of the 'Author' field in the File info box.
2. Extending incomplete staves:
On a hidden staff existing but empty in the destination file, on the first import extension ran smoothly, perfectly handling even repeats, time sig changes and the like. However, it didn't account for a time sig change that occurred in the very last measure of the destination file, thereby causing a half-measure shift of everything following on that staff. (In the imported file, that staff started with a long MMR; that, by itself, was handled perfectly, even through an interruption due to overrun-induced sectioning.)

Third__Let's now proceed to department NTH (nice to have):
1)  I had a few failed attempts starting the tool, with aborts and cryptic error messages, until I recognized it required, upon installation, to have all 3 ticks on the right of the user tool box *set*, i.e. Input Type: *File Text*, Options: *Returns File Text* & *Prompts for User Input* . If this advice could be added to the heading message of this thread, this could save some not-everyday-users of user tools from frustration.
2)  Avoid to set another text marker in the score with the 2nd (and following) section of a file. (This might be handled by recognizing a start measure of '0' as indicating the start section of a file).
3)  Could the double bar inserted on extension of an empty staff be avoided?
4)  The appearence of the resulting score could be improved through once more checking for incomplete staves, and extending them, after the import. Possibly, this could be done only with the last imported section of a file, indicated by 'last measure=1024'.
5)  Clipboard overflow is not detected until the final step of import. Could that be detected earlier, preferably in the export phase?

Before this runs into a never-ending story (Hydra is still lurking!  ;)  ), I better stop it here,
once more leaving all the work to the master  (Working material in PM).
Horst

Re: ExportImportMeasures.og

Reply #5
Version 2.0 is now available (see original post).
It has been thorougly test by Horst H., thanks!

Apart from fixing some bugs, following modifications are added:
* Extending incomplete staves, not only before, but also after the import.
* Warning at the export stage for possible exceeding the maximum length for import.
* The medley title in the commnents section should be in the last line. This is now added in the help text.
Always look on the bright side of life!

Re: ExportImportMeasures.og

Reply #6
Thank you, Opagust, for developing this superb new user tool! It saved my day (or, to be precise: a couple of nights)  :)
Let me point out just 2 features I like most with it:
-  It is one single tool, carrying both the export and import functions. So, though it needs to be called separately for each
export and import step of every file to be added, you can take advantage of the 'CTRL-ALT-F8' shortcut for 'Repeat Last Tool
Used' over and over again (and just adding an 'i' takes you into import mode).
-  It is very forgiving w.r.t. all sorts of inconsistencies between the files to be processed.

After (re-)assembling 4 medleys out of 24 single choir song files with accompaniment, I'd like to give a few pieces of advice
for smooth operation:
-  Each staff in any of the single files should find a corresponding staff in the destination file, preferably with a consistent staff
name. Though the tool automagically resolves all such mismatches, clearing them in advance saves time by avoiding many
queries in the process.
-  With each staff of the destination file, establish in advance the max. number of lyrics lines that may occur in a
corresponding staff of any of the single files. Otherwise, some lyrics content might get lost on import.
-  On processing long files section-wise (due to clipboard size restrictions), be sure not to hit a hyphen in any line of lyrics, with a section border (by selecting 'end measure'). Presently, this might disrupt the lyrics line affected.
-  If any of the files to be processed contains text items, make sure the associated fonts are properly assigned in the destination file.

Wishing everyone concerned 'Happy Medley-Building!',
Horst

Re: ExportImportMeasures.og

Reply #7
Thanks Horst, for these useful remarks.

Just one small clarification: the size restriction is not on the clipboard, but on the input box of the user tool environment, during import. After some trial and error, I found that the maximum size was something above 5000 characters. Since the output size during export doesn't have that restriction, my tool now checks for that limit in the export phase (after a suggestion of you, Horst).
Always look on the bright side of life!