Skip to main content
Topic: Multitool PYNWC (Read 1743 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!