Skip to main content
Topic: Multitool PYNWC (Read 1987 times) previous topic - next topic

Multitool PYNWC

In NWC you'll have to install PYNWC as 1 tool, but when invoking it, it's like a second layer: the PYNWC environment, where you have access to a number of tools that I developed using the Python programming language. The reason is that Python has several possibilities that are missing in the Lua language, of which on of the most important is the use of a flexible graphical user interface.

Within this environment you can:
 - see information about the score
 - see help information about the PYNWC environment
 - select a tool
 - see help information about the selected tool
 - see and change parameters for the selected tool
 - run the selected tool
 - see the results after running a tool (before saving)
 - save the changes to the score (if any) in the input file
 - depending on the tool:
   - save the changed score as another NWC file
   - save a generated report into a txt file
   - save a generated worksheet into a xlsx file

You can download the Windows installation file and a link to the full documentation (including installation instructions) in:
https://www.opagust.be/content/nwctools-environment.
Always look on the bright side of life!

 

Re: Multitool PYNWC

Reply #1
First bug found: the program went in error for a file without 'Send Bank Select' in the Instrument Properties of a staff.
Fixed in release 1.0.1
You can download the Windows installation file in:
https://www.opagust.be/content/nwctools-environment.
Always look on the bright side of life!

Re: Multitool PYNWC

Reply #2
First bug found: the program went in error for a file without 'Send Bank Select' in the Instrument Properties of a staff.
Fixed in release 1.0.1
You can download the Windows installation file in:
https://www.opagust.be/content/nwctools-environment.

OOPS!
The bug fix contained a bug!  :-[
New installation file for version 1.0.1 in https://www.opagust.be/content/nwctools-environment.
Always look on the bright side of life!

Re: Multitool PYNWC

Reply #3
I corrected several image links in the documentation:
The tools
Always look on the bright side of life!

Re: Multitool PYNWC

Reply #4
Version 1.1 added wit a new tool 'Construct a medley'


Combine several song files into 1 medley file.

    To create a medley file, you have to start this tool from a blank score:
    Choose 'File/New' and select <blank score> from the 'Song Templates/General' tab and save it before you go to 'Tools/User Tools'.
    This file will be the destination file, in which you add the songs that will make up the medley.
    You can create the medley file in several steps, so you can also start this tool from an earlier created medley file.
    (The tool checks the presence of 'song lines'(1) in the Comments section of the Song Info to decide whether it's a valid medley file.)

    Via the tool parameters you can specify:
   
     - Include song titles at the start of each song (top staff).
     - Position, scale and font for the Song Title text objects.
     - Type of separation bar between the songs (except when the previous song ends with a Repeat Close): Single, Double or Section Close.
     - Page break, System Break or no break between the songs.

    The tool consists of several stages:

     - A popup window 'Select Songs'.
        - If you press 'Add a file', a Windows Explorer window will be opened.
        - Important: Only files in NWC Text format can be processed. So maybe you'll have to open and 'save as' one or more of your songs first.
        - A selected song can be removed from the list by clicking on it.
        - In this stage you can also set or change the Medley Title.
        - 'Cancel' will exit the tool without any changes.
        - If you have chosen your files, press 'Continue >'.

     - A popup window 'Arrange Staves'. Via this window you can:
        - Reorder the staves
        - Change song titles(2)
        - Change staff names and labels
        - Join staves (by assigning the same name and label)
        - Press '?' to see more detailed help info
        - Press '< Back' to return to the 'Adding Songs' window.

     - Review of the staff properties:
        - For each staff that appears in several songs, the properties from the different songs are compared.
          For each mismatch(except for 'visibility' and 'muted'), a popup window is presented where you can choose which values to retain(2).
          If there are to many mismatches, you may want to  press 'Cancel', in which the tool is ended without any change.
          When there's a mismatch for 'visibility', the part of the song with property invisible will be collapsed.
          When there's a mismatch for 'muted', the appropriate notes will be muted.

     - Construction of the medley, according the choices in the Tool Parameters:
        - Adding 'song lines(1)' to the Comments Section of the Song Info.
        - Adding song titles at the start of each song.
        - Creating delimiter objects: separation bar, new system or new page.
        - Inserting rests measures in staves that aren't part of every song, surrounded by boundary collapse and end collapse objects (3).

    Notes:
        (1) A 'song line' is of the form "Song:{song title}#{starting measure}-{ending measure}"
        (2) Changing the song titles and/or staff properties has only effect in the destination file. The original song files will not be modified.
        (3) The inserted boundary changes don't always give the expected result between the songs, so may be you'll have to delete or replace some of them.

See link in original post
Always look on the bright side of life!

Re: Multitool PYNWC

Reply #5
    Version 1.2:

        - Redesign of the tool parameter handling (Existing configuration files become obsolete).
            - New option in the 'tool parameters' window: 'Always show this window when selecting this tool.'
            - New directory for the configuration file: '%LOCALAPPDATA%\PYNWC' (previously in the same directory as the input score).
            - New name for the configuration file: 'pynwc.cfg' (previously: 'config.txt').
       
       - Tool 'audit score' added:

Before running this tool, be sure to select in the tool parameter window the audit you want to be performed.
Also specify the process mode: all staves, visible staves, active staff or the selection.
Depending on the audit you choose, additional options will be shown. See below for details per audit.

- Audit accidentals:
    Via the tool parameters you can select one of this options for handling natural accidentals:

        - Leave naturals unchanged
        - Make courtesy accidentals
        - Remove accidentals

    This audit acts on any unnecessary accidentals assigned to notes.
    It compares a note with an accidental with the 'running' key signature, which is determined by the previous key
    signature + the preceding accidentals in the measure.
    If the accidental matches the running signature, and it's not a courtesy accidental, it will be removed if it's
    not a natural.
    For naturals the action taken depends on the option in the tool parameters.

- Audit bar lines:
    Audits the bar line alignment.
    In the tool parameters you can indicate whether you want to admit a short first measure (anacrusis).
    If the audit finds a standard bar line that is not aligned properly, it is removed and a new bar line is added in
    the proper place. As a result, notes and chords can be split and tied.

    * Measures with a special ending that is not at the beginning of the measure, are not audited.

- Audit enharmonic spelling:
    Replaces notes with their enharmonic equivalents.
    There are several options you can choose from (see below), via the tool parameters.
    If your process mode = 'Process selection', and an enharmonic change is to be done on a note, the following notes
    in the same measure or which are tied to the changed note, are investigated to determine if they need to be changed
    also. If affirmative, they will be added to the selection.

    Available options:
     - 'No sharps': All sharps are replaced.
     - 'No flats': All flats are replaced.
     - 'Reverse sharps/flats'.
     - 'No doubles': All double sharps and double flats are replaced.
     - 'Preferably naturals': If a enharmonic equivalent without accidental is possible, it's used.
     - 'No forced naturals':
        If a natural accidental is caused by an preceding note with an accidental, this preceding note is replaced by
        its enharmonic equivalent.
     - 'Common preferred accidentals': A# -> Bb, Db -> C#, D# -> Eb, Gb -> F#, Ab -> G#.
     - 'Sharps up, flats down':
        If the next note is a tone or a semitone higher, a sharp is used; if it is a tone or a semitone lower, a flat is
        used (not applicable to chords and restchords).
     - 'Custom changes': You can choose one or more items from a list of all possible enharmonic changes.

- Audit note length and beaming:
    Splits notes and group beamings, according to the time signatures.
    Upon start, a window is shown with the default groupings for note length and beaming, for each found time signature.
    You can accept or modify them.

    The specifications mainly come from @hmmueler
    (see https://forum.noteworthycomposer.com/?topic=10050.msg72212#msg72212).

    - Note, chord and rest lengths are distributed in each measure according to standard rules(see e.g. Elaine Gould, Behind Bars, pp. 160-164, 166-169, 171).

        * Rest chords, chords with different durations, triplets, or notes with a 'Staccato', 'Staccatissimo', 'Accent' or 'Marcato' articulations will not be split.

    - Beams connect notes and chords according to standard rules (see e.g. Elaine Gould, Behind Bars, pp. 153-155).

    - The main and secondary beat patterns are derived from the currently active time signature.

    - It 's possible to specify alternative beat patterns for a time signature, both for the note lengths and beams.

    - A long note that starts at a beat and spans over several beats, will not be split.

    - If the first measure of the score or selection is a short measure, it is treated as the right part of the full beat pattern.

    - When a special ending is found that's not at the beginning of the measure, the remaining of the measure is not audited.

    - A measure that is longer than the current time signature indicates causes an error message.

 - Audit note stems:
    Removes unnecessary stem up or down attributes and resets stem directions for note beams and triplets.


SEE LINK IN ORIGINAL POST
Always look on the bright side of life!

Re: Multitool PYNWC

Reply #6
Version 1.3, new tools added:
- Configure new song
- Show collapsible sections

Tool 'Configure new song':
Run this tool after you created and saved a new file from a template, and before you start changing staff labels, channels,
..., removing some staves, inserting tempo, key and time signatures, dynamics, copying and pasting...
All that can be done in one go, with this tool.

On the main dialog window, you see on the left a list of all the staves with attributes name, label, group, channel, volume, stereo pan, muted and visible.
Each of these attributes is changeable. In front of each staff line is a checked check box. Unchecking a box will remove the corresponding staff from the file (1).

Via the buttons at the right you can configure the properties of objects you want to be inserted.
Clicking one of them will open a dialog window, similar to the correspondent 'Notation Properties' window of NWC.
They have 4 buttons at the right; 'Create', 'Modify', 'Remove' and 'Cancel'.
    - With 'Create you schedule the insertion of the correspondent object.
    - With 'Modify' you can change the properties of a scheduled object.
    - With 'Remove' you undo a scheduled insertion.
    - With 'Cancel' you quit the window without any resulting action.
At the bottom of the main window is indicated which objects are scheduled for insertion.

When clicking the 'OK' button at the bottom of the main dialog window (2):
    - the staff changes will be carried out (3);
    - the unchecked staves will be removed;
    - the scheduled objects will be created and inserted in every staff, after the clef;

(1) Hint: You may want to use a template with all the staves that you'll ever be needing, and uncheck those that  you
don't want to be present in the new file.

(2) As in every other tool, the changes will not be saved until after your confirmation.

(3) As a next step you may want to run the tool 'Set staff properties' to carry out within one dialog window all
other needed staff changes (general, visual, midi, instrument, default dynamic velocities).

Tool 'Show collapsible sections':
In NWC you can mark collapsible sections with the boundary objects 'Start a collapsible section' and 'Cancel/forbid collapse from this bar'.
But then it's very hard to see them in the editor, you'll have to use 'Print preview' to see the effect.

This tool is intended to solve that problem by coloring the notes, chords and rests of a collapsible section with a color of your choice.
After that it's easy to locate these sections in the editor.

Remark: You still have to do a print preview to see the real effect, since collapsing will only start and end at system breaks.
But at least now you know in what part of your score they occur.

The tool show a window consisting of 4 frames:
    - 'Collapsible sections': Shows the staves with collapsible sections and the measures from - to.
    - 'Choose Collapse Color'
    - 'Colors in collapsible sections': Shows which colors are now present in the collapsible sections for the notes, chords and rests.
    - 'Options': If there's both 'Default' and at least 1 'Highlight' color in the collapsible sections, you can indicate:
        - Change the color of all notes/chords/rests in the collapsible sections.
        - Keep the non default color(s) unchanged.

You can click 'OK' to do the changes, or 'Cancel' to leave without changing anything.
Always look on the bright side of life!