Skip to main content

Topics

This section allows you to view all Topics made by this member. Note that you can only see Topics made in areas you currently have access to.

Topics - Randy Williams

2
User Tools / bug in NWC2ClipItem?
With the recent expansion from "clip text" to "file text", I wonder if the intention is to allow use of NWC2ClipItem for file properties, staff properties, and staff lyrics, in addition to the staff notations it was originally designed for.  It is basically already there as far as I can tell, except for one "bug".  I've noticed that if I set the Title/Author/Lyricist/etc to an empty string in an NWC2ClipItem object and then ReconstructClipText, the empty string value gets dropped.  For example, "Title" => "" becomes simply '|Title' instead of '|Title:""' as expected.  Then NWC sees a text label with no field value and does not overwrite the value it has.  This prevents a file text script from clearing a SongInfo field.  [Interestingly, if NWC sees even just '|Title:' it clears the field, so the colon is the key, not the quotes.]

The problem is that ReconstructClipText assumes that an empty string value is indicative of a "flag" field, and just moves the key into the nwctxt without any value.  Only after that does it test the opt tag classification for text and add quotes if so.  If the empty string handling could be suppressed for text opt tags, the subsequent quoting code would do what we want I think.  [As an alternative fix, NWC could change its behaviour upon a field label with no text value, and assume that means to set the field to an empty string, rather than simply ignoring the field label.  The text staff notations (e.g. Instrument/Name) seem to already have this behaviour.]

Bottom line: I'd like to be able to set any text-based field to an empty string in a clip item object, and have that make it back to NWC as a "clear field" operation.
3
User Tools / easier editing of nwctxt?
Hi all,

I think several of us sometimes select objects in NWC and copy and paste them into an editor (like Notepad), so we can change the nwctxt and copy and paste them back.  For example, this can be really handy to change individual notes within a chord, to change a position and/or to add/change/delete accidentals, ties, noteheads, colors, etc.

Borrowing heavily on nwsw_SimpleEditor.wxphp and on nwsw_nwctxtFileExplorer.wxphp, I have created a simple editor designed to edit nwctxt (clip or file).  The editor automatically removes the header and footer, and any comments (file), and any fake/context items (clip), and presents the selected objects in a WYSIWYG editor.

Within the editor, the standard copy/cut/paste actions are available, as well as undo/redo.  There are find and find-next actions, and also replace and replace-next.  A select-all is there, but you shouldn't need it, as all of the text is automatically passed back to NWC upon exit.  I don't currently see any need for new/open/save.

I am looking into adding an "nwctxt lexer", to add some color to the nwctxt.  This can make it easier to read, and to spot syntax errors in your changes, before exiting back to NWC with them.  I will wait to see if there is any interest in this editor, before putting any more than today's work into it.

Invoking the editor is just like invoking the existing explorer.  Create one shortcut for "clip" mode and another for "file" mode.  Simply copy the existing explorer entries and tweak them, to create the new editor entries.  (Btw, the new copy command in the user tools box is a good way to see built-in command info, since you can't edit them any more.)

The "file" mode for this editor could be particularly handy I think, to edit song and staff header information.  I don't know of any other way to cut and paste file nwctxt to an editor, so making such changes to file nwctxt previously involved saving the file and later reloading it (or exporting and reimporting), which probably was never worth doing previously.

HTH,
Randy

P.S.  Conventionally, you should rename the ".v#.php" script to be ".wxphp", but it should work as ".php" too - the forum allows a "php" extension but not a "wxphp" one.

Edit - [red]You can download the latest NWC and User Tool Kit betas here: https://forum.noteworthycomposer.com/?board=8.0[/red]
4
Tips & Tricks / Audit Bar Lines and Pickup Notes
A problem with audit bar lines occurs when there are pickup notes at the beginning of a piece, and the bar lines are added/changed to wrong positions throughout.  (And even with this fixed, when there is an associated shortened measure at the end of the piece, extra unwanted rests are added.)

Rick pointed out the two solutions to this problem here http://my.noteworthysoftware.com/?topic=6119.0, but I thought there might be benefit to spelling them out in a tips and tricks item.  The examples below assume the piece is in 4/4 time with a single quarter note pickup, but other combinations can easily be supported in the same way.

Option 1:  Prepend invisible rests to pickup notes to pad first measure to full beat count, for example, add 3 hidden quarter rests before a quarter note pickup in 4/4 time.  Also optionally append invisible rests to final notes to pad last measure to full beat count, for example, add 1 hidden quarter rest after a dotted half final note in 4/4 time.

Option 2: Surround pickup notes with invisibile time signatures to effect actual beat count, for example, add a hidden 1/4 time signature before a quarter note pickup in 4/4 time, and a hidden 4/4 time signature after it.  Also optionally add an invisible time signature at the beginning of the final measure, for example, add a hidden 3/4 time signature before a dotted half final note.

Option 2 is better than option 1 in that it does not delay playback any at the start of the piece (or hold it over any at the end).  Option 1 can be better than option 2 in that it can be done in one fewer added hidden item (e.g. use a dotted half rest rather than 3 quarter rests).

Apologies in advance if I am not correct in any of the above, or if this is all already spelled out somewhere else that I did not find.
5
User Tools / Script to print to PDF
I doubt anyone will have a need for this script, as I did, but thought I'd post it anyway.  Apologies in advance if wasting your time.  And if someone has a similar script done with "AutoIt" instead of VBScript, I'd be interested in it.

Attached script automates key sequences needed to print current song in NWC to PDF file (song need not be saved to a file).  Script was written to expect PDFCreator 0.9.6, but I believe it can easily be modified for other PDF printers if needed.  Script allows for an optional command-line option which becomes a differentiating suffix for the PDF file.

Script does "inject" key presses, which I'm not a big fan of, but it has some safeguards.  It only does key presses, and never does mouse clicks.  It makes every attempt to ensure correct application has focus before injecting key presses.  It does nothing to the NWC session (or the original file), but instead spawns a separate NWC Viewer (via a temporary file) to do the printing (script can be greatly simplified if one is comfortable injecting to NWC itself - I was not).

I use this script in conjunction with "Run User Tool", so that a single user tool invocation can sequence some automated conversions and then print the result to a PDF, followed by a revert and running another similar user tool to create and print an alternate version, and so on.  Each top-level user tool automatically does everything needed to create and print its specific version.

Invocation command for general use is: wscript scripts\prw_PrintToPdf.vbs "<PROMPT:Suffix:=*>"

Drop ".txt" from file name after downloading.  Specify "File Text" for "Input Type".  Specify "Long Task Handling" option.
6
General Discussion / Rehearsal letters?
I was wondering if anyone wanted to comment on what rehearsal letters would look like, if they were ever to be supported natively in NWC.  I think everyone would agree they would be a property of a bar line, but I have some other questions:

  • Would the rehearsal letter for each bar line be limited to a single character?  (e.g. would some want AA, BB, etc for a large piece with more than 26 rehearsal points?)
  • Would the rehearsal letter(s) be limited to uppercase letters?  Should lowercase letters be allowed?  Should numbers be allowed?  Should all ASCII letters be allowed?
  • Could rehearsal letters be allocated automatically, A and up, from start to end, via a simple checkbox?  Inserting a new rehearsal letter could automatically bump up all following letters.
  • Would an offset be needed, to vary the height of the rehearsal letter above the staff?  There is currently no such control for measure numbers.
  • Would the font for rehearsal letters have to be specified separately, or could a common one be used (like measure numbers)?
  • Would circles and/or boxes around rehearsal letters be required as options?
  • If a bar line that has a rehearsal letter happens to fall at a system break (randomly, or purposely via the break property), would the rehearsal letter go over the line before the automatic clef (as with measure numbers) or after the automatic clef and key signature (if not key of C) or somewhere in between?  Depending on where it went, it may have to replace the measure number for that system.

I've seen that go-to a rehearsal letter would be nice too.
7
User Tools / Quickly (re)generate MIDI files for your entire NWC library
I'm looking for testing and feedback on a new tool.  It's not a user tool (run from within NWC) - it's a PHP script run from a DOS command line (or from a shortcut).

You give it a starting directory, and it will find all NWC files in that directory, and recursively in all directories under that if you want.  For each NWC file, it will generate (or regenerate) the corresponding MIDI file as desired.

There is an extra layer of functionality I'd like to add options for.  Right now, I've got some support for automatically expanding note/rest durations to account for any fermata delay in the NWC file.  There's more I can do with fermatas, and other things (like breath marks for example, or global instrument changes, or global tempo changes, or whatever one can think of) if someone wants it.

If there's any interest at all, I'll post details on the script's invocation (including setting up handy shortcuts and using all the options provided).  The script is attached now only for proof of existence.  :-)

Apologies in advance to those who expect NWC to natively support anything in this tool - I hope along with you that some or all of this tool will be obsolete someday.
8
General Discussion / question on accidentals
An accidental implicitly applies to any of the same note later in that measure, but technically speaking, is it supposed to apply to notes an octave away from that note?!  Take this example:

Code: [Select · Download]
!NoteWorthyComposerClip(2.0,Single)
|Clef|Type:Treble
|TimeSig|Signature:4/4
|Note|Dur:4th|Pos:-3
|Note|Dur:4th|Pos:#-3
|Chord|Dur:4th|Pos:-3,4
|Chord|Dur:4th|Pos:n-3,4
!NoteWorthyComposerClip-End

Is the high F on the 3rd beat sharped, as the low F still is?  If so, is it still sharped on the 4th beat, or does the natural below cancel it?  If you run the Note Names user tool, it has its opinion on these questions, and I'd just like to make sure it's correct!
9
General Discussion / Cut and paste from user tool window?
Is there a way to cut and paste the output of a user tool (e.g. Statistics)?  I can select the text in the window, but I don't seem to be able to cut it into the clipboard.  I have my own scripts that run outside of NWC getting input from an NWCTXT file, and I can redirect the output into a file, but I was hoping to quickly grab an existing user tool's output.
10
General Discussion / New version of fontsettings.nwc
There is a file called fontsettings.nwc available on the scriptorium, courtesy of David Palmquist.  The file allows you to see what all ASCII characters look like for all fonts loaded.  I have automated generation of this file, and enhanced it to include extended ASCII characters (and control characters).  You can edit the file, set up any fonts you want, and view or print the results for reference.  Comments on impoving it further are welcome.  Apologies to those not interested in such a file.

Randy
11
User Tools / Important change to NWC2ClipItem interface
I may be the only one who missed this, but thought I'd share just in case...

There is a new parameter now for NWC2ClipItem:
   function NWC2ClipItem($itemtext,$remapFakes=false)

You may have tools (like I do) that still call NWC2ClipItem without a second parameter.  This defaults it to false, and causes a strange behaviour, that took me a while to track down.  I usually use my user tools on an entire staff, and hence there are no "fake" items, and it still works.  But I just tried to run one on a partial clip, and it wouldn't work.

Without the "remapFakes", the fake objects are not processed by NWC2PlayContext.  In my case, the clef defaulted to treble, even though the clip was bass clef, and a fake object indicated so.  Adding a second parameter of true for NWC2ClipItem fixed my problem.  Not sure why you'd ever want to disable the "fake mapping", such that perhaps the default should have been true?  Perhaps there was a fear of breaking legacy kludges that worked around the absence of the much cleaner fake items.
12
User Tools / Possible additions to nwc2clips.inc
To my knowledge, nobody has written a set of PHP include files to help with processing entire NWCTXT files, similar to the set that does exist to help with processing "clips" (the User Tools suite).  Perhaps instead of writing a new suite, the existing one can become a superset for both?  I haven't worked out all the details yet for other files, but I thought I'd throw out these possible additions to just nwc2clips.inc, to start a discussion.

In function NWC2ClassifyOptTag, before the final return:
Code: [Select · Download]
if ($ObjType == "SongInfo") return NWC2OPT_TEXT;
if (($ObjType == "Font") && ($Tag == "Typeface")) return NWC2OPT_TEXT;
if (($ObjType == "AddStaff") && ($Tag == "Group")) return NWC2OPT_TEXT;
I expect there are other song/staff option tags that are possibly needed here too.

Global constants, alongside the comparable "clip" constants:
Code: [Select · Download]
define("NWC2_STARTSONG","!NoteWorthyComposer");
define("NWC2_ENDSONG","!NoteWorthyComposer-End");