Skip to main content
Topic: Multitool PYNWC (Read 11555 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.
In order to download the installation file, you'll now have to be logged in.
You may use an account I created:
- username: 'NWC User'
- password: 'Usertools'
Or you can create your own account, so you can be informed of future updates.
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!

Re: Multitool PYNWC

Reply #7
Version 1.4: New tool added : 'Seach & Modify'

With this tool you can search a score for all objects of a given type that have some given properties.
Next you can:
    - Inspect where the occur (staff, measure number), with their nwctxt presentation.
    - Choose an action: 'Modify' or 'Delete.
    - For the action 'Modify':
        - Indicate which property(ies) you want to modify.
        - Fill in the new value(s) in a popup, that resembles the 'Notation Properties' window in NWC for the given object type.
Remarks:
    - At every moment you can leave to undo your choices or modifications.
    - On the main window, every input field is a combo box from you can select the appropriate value.
    Only those values that are of interest are presented.
    For instance: If you specified 'Clef' as object type and all clefs have the same value for 'Octave Shift',
    that property is not present in the 'condition' lines.
    .
Detailed description:
    The main window consists of following parts, from top to bottom:
        - The frame 'Make your choices' to specify:
            - Where to search (selection, active staff, all staves or visible staves).
            - The object type to search for.
        - The 'Conditions' frame where you can set up to 6 search criteria.
          If you specify more than 1 condition for the same property, then all the objects are selected that satisfy any of these criteria.
          Criteria for different properties must be satisfied separately.
          At the bottom of the conditions frame you can see a verbose description of your selection criteria.
          It's updated after every completed condition line.
        - A status line, that indicates:
            - The object type to search for.
            - The number of objects found (dynamically updated).
            - A button 'Show'.
                When clicked a popup window will show the location and nwctxt presentation of the objects that satisfy the criteria.
        - The 'Action' line, with choices 'Modify' or 'Delete'
        - The 'Modifications' frame, where (if your action = 'Modify') you have to specify at least 1 and at most 4 properties.
            Only those properties can be specified that are present in the 'Notation Properties' window for the object type.
            e.g.: for a note you can't change the position, duration, accidental, staccato,....
        - Three buttons:
            - The action button. The caption will indicate the action you chose.
                If the action is 'Modify', a popup is presented that resembles the 'Notation Properties' window of NWC,
                in which the fields contain the values of the first object found.
                Only the fields for the properties you selected in the modification frame will be enabled.
                After you entered your new values, these will be set in each found object.
                All the other properties of each object remain unchanged.
            - The 'Reset' button. When clicked, every input is cleared so you can restart your input.
            - Finally a 'Cancel' button to leave without any action taken.

Always look on the bright side of life!

Re: Multitool PYNWC

Reply #8
In order to download the installation file, you'll now have to be logged in.

You may use an account I created:
- username: 'NWC User'
- password: 'Usertools'

Or you can create your own account, so you can be informed of future updates.
Always look on the bright side of life!