Skip to main content
Topic: Nwctxt webpages to work on dynamics and tempo (Read 12732 times) previous topic - next topic

Nwctxt webpages to work on dynamics and tempo

I have a pair of new webpages: 
  • Specify the current duration and requested duration of any NCW piece.  Cut the staff containing all tempo markings and MPC tempos to tchange.htm.  Specify the durations or a conversion factor and Submit.  The selected text may be copied back to the staff from which it was cut and all tempos will have been multiplied by the appropriate conversion factor.
  • When playing a crescendo on an instrument where effort is continuous to produce a sound (violin instead of piano), all dynamics need to be changed to override Volume on all dynamics.  Cut the staff to dynamics.htm, change the default volume level (if necessary), click Submit and paste the output back to your staff.

P.S. Forgot attachment.  The B will replace the G as the two notes swap dynamics.
Since 1998

Re: Nwctxt webpages to work on dynamics and tempo

Reply #1
Nice code. Easy to follow.
A few problems with the tempo page:
  • When I click on "Submit Factor", sometimes it triggers the conversion for both mouse down and mouse up.
  • It doesn't work for any 'Base:' other than the default 'Base:Quarter'.
  • The result needs to be limited to a range of 4 - 32767. If not, NWC2 will not paste, export and/or save it correctly.
  • All MPC's get modified, not just 'Controller:tempo'

I have written a similar User Tool. I never published it because its use requires too many caveats. If the resulting tempo falls outside the range of 4 - 32767, it is not reversible. If there is no tempo at the beginning of the input, it is difficult to know what the starting tempo is.

My regular expression for extracting the 'Controller Value(s):' from MPC's is
Quote
"(\|Pt\d:\d+,)(\d+)"
this returns an array which I can simply iterate and not have to fool with indexes. I'm in a different language, so YMMV

Edit:
The tempo page doesn't respond well to:
Code: (nwc) [Select · Download]
!NoteWorthyComposerClip(2.0,Single)
|Text|Text:"\|MPC\|Pt1:0,64"|Font:StaffBold|Pos:8
|MPC|Controller:pan|Style:Absolute|TimeRes:Quarter|SweepRes:1|Pt1:0,64|Pos:8
!NoteWorthyComposerClip-End
I have found though painful experience that I need to check object types and take extra care when dealing with objects that contain quoted text.
Registered user since 1996

Re: Nwctxt webpages to work on dynamics and tempo

Reply #2
I've changed a number of things in the tempo page, I'm now looking for /\|Tempo.*\|Tempo:(\d+)/ so it will accept notes other than the default.  New tempos are calculated first and checked against your range.  I'm not quite sure what happened on my original continue; statement, but I'm using an if statement now to run the change() function when I find an MPC..tempo statement.

I had to ask for help on the problem of changing the Pt's in a loop in a javascript forum.  I'm a long way from being able to code something like that from scratch but I think I found out how it works--my attempt to adapt that to the dynamics page without splitting the textarea into lines first resulted in an endless loop.

Also, I added code to find the earliest occurrence of MPC..tempo or Tempo statement vs Note or Rest or RestChord.  Notes before a tempo indication will cause an alert.

The submit functions can be triggered by either clicking the appropriate button OR changing the last time or either of the factors.  I'll look into changing that but pressing the TAB key after entering a factor or time should work.

Many thanks for checking it out and your suggestions.
Since 1998

Re: Nwctxt webpages to work on dynamics and tempo

Reply #3
I've consolidated all my NWC related webpages under one umbrella: http://www.wjporter.com/nwc/.
Since 1998

Re: Nwctxt webpages to work on dynamics and tempo

Reply #4
Quote
Inserts stacissimo symbol above/below selected notes.

I suppose you mean "staccatissimo".


Re: Nwctxt webpages to work on dynamics and tempo

Reply #6
I just added a do it yourself webpage to my suite based on an earlier thread.  Since the user would modify it to some other task I created it as a text file the user could change and save as .htm.
Since 1998

Re: Nwctxt webpages to work on dynamics and tempo

Reply #7
The "do it yourself" link seems to go to a page with a heading of "Replace whole rests with four quarter rests", and a large text box (empty). Below that is the text "Copy the above to your clipboard (it's pre-selected) and paste it into a song you have already open in NoteWorthy Composer." but, as I said, "the above" seems to be empty.

Edit: I think I am catching on. To use, you must extract the source from the page, modify it to do what you need, and save it as .html. To use your new function, open the new .html file in your browser, cut data from an nwc song, paste it into the box, and click "Read". Then the previously pasted text will be modified and selected. Copy that modified data and paste back to the nwc song. Is that about it?  

Re: Nwctxt webpages to work on dynamics and tempo

Reply #8
I think I am catching on. To use, you must extract the source from the page, modify it to do what you need, and save it as .html. To use your new function, open the new .html file in your browser, cut data from an nwc song, paste it into the box, and click "Read". Then the previously pasted text will be modified and selected. Copy that modified data and paste back to the nwc song. Is that about it?  

Ding! Ding! Ding! Ding! Ding! We have a winner! Actually, I would start by creating a new NWC file with copies of the object I want to change and what I want to change it to on the staff, then copy that staff to the page for reference (between "body" and "form").  Plug those into the "from" and "to" literals and be sure the length of the "from" literal is correct in the slice.  From here your instructions are spot on.

This assumes you want to replace the entire line with something else and it works great for simple objects with no Pos: or any options which may need overriding or left intact on a different object.  To keep an attribute intact while changing things around it, study exec, match, replace, and regular expressions.  While working on other pages in the suite I referred to the "Pattern Matching with Regular Expressions" chapter so much I highlighted the edge of the pages so I could find it.

I retired from a career as a programmer or systems analyst and still enjoy these types of challenges as a hobby.  Hope you like them as well.
Since 1998

Re: Nwctxt webpages to work on dynamics and tempo

Reply #9
Just added a new page to the set: nummeas.htm.  First create a "model" text entry for your first measure number, before or after the bar, with the starting measure number and position all ready to go.  Starting from your measure number, Cut to the end of the staff and paste into the webpage.  Click Read and copy back to the clipboard to paste it back.  It ignores hidden bar lines and those excluded from measure count.
Since 1998

Re: Nwctxt webpages to work on dynamics and tempo

Reply #10
Nummeas now counts hidden barlines w/o creating a measure number and ignores bar lines with "exclude from bar count" attribute.  Corrected the "dotted" checkbox on the guitar page.
Since 1998

Re: Nwctxt webpages to work on dynamics and tempo

Reply #11
Nummeas worked very nicely, once I read your instructions properly, and it took, oh, maybe half a second to number 315 bars.  Nice work, Warren, and thank you for creating this tool (macro?). 

Re: Nwctxt webpages to work on dynamics and tempo

Reply #12
Nummeas worked very nicely, once I read your instructions properly, and it took, oh, maybe half a second to number 315 bars.  Nice work, Warren, and thank you for creating this tool (macro?). 
You're welcome.  I'll try to transcribe other semware macros into web pages as time permits.
Since 1998

Re: Nwctxt webpages to work on dynamics and tempo

Reply #13
--Removed by author--
Since 1998