NoteWorthy Composer Forum

Forums => Tips & Tricks => User Tools => Topic started by: Mike Shawaluk on 2015-10-25 01:17 am

Title: User Tool: Make Tremolo.ms.lua (0.2)
Post by: Mike Shawaluk on 2015-10-25 01:17 am
The attached user tool will perform the following over a selected range of notes/chords:


If the original chords have a forced stem direction, the stem direction for converted chords will be preserved. Otherwise, it will be set to Down. The inserted Tremolo.ms objects will have the default parameters (3 beams, Play=true).
Title: Re: User Tool: Make Tremolo.ms.lua
Post by: Richard Woodroffe on 2015-10-26 08:20 am
Hi Mike,

Thanks for doing this - closing the loop I suppose.
You know how I like my dotted and double dotted tremolos.  Well this user tool cannot deal with them. Although there is nothing amiss by using the tool for undotted notes/chords and then dotting afterwards.

This is the STDERR :

Quote
Scripts\MakeTremolo.ms.lua:64: attempt to perform arithmetic on field '?' (a nil value)


Title: Re: User Tool: Make Tremolo.ms.lua
Post by: Mike Shawaluk on 2015-10-26 01:06 pm
You know how I like my dotted and double dotted tremolos.  Well this user tool cannot deal with them. Although there is nothing amiss by using the tool for undotted notes/chords and then dotting afterwards.

This is the STDERR :
Thanks for the feedback Rich. I completely forgot to test this with dotted/double-dotted notes.

Given what I have learned so far with user tools, I think this one will need a significant rewrite to handle dotted notes.  I do have a question for you about the dotted durations though. I've noticed in the Caprice6 sample score, most of the tremolos have a dotted quarter note, but an undotted 16th rest. Normally, the rest duration is 1/2 of the note duration (excepting eighth tremolos, which use a quarter note instead to avoid the pesky flags). Is there a reason that the rest and note portions aren't both dotted the same?

Mike
Title: Re: User Tool: Make Tremolo.ms.lua (0.2)
Post by: Mike Shawaluk on 2015-10-26 03:03 pm
The "Make Tremolo.ms.lua" user tool has been updated, with the following changes:


Please refer to the parent post for a description of the tool's behavior and usage.
Title: Re: User Tool: Make Tremolo.ms.lua (0.2)
Post by: Richard Woodroffe on 2015-10-26 03:35 pm
Is there a reason that the rest and note portions aren't both dotted the same?


Hi Mike,

Thanks for the update - will test when I have time.
In answer to the question - yes - triplets.

Title: Re: User Tool: Make Tremolo.ms.lua (0.2)
Post by: Flurmy on 2016-05-13 09:39 pm
Problem: I have a score with lots of tremolo like the snippet below. (Lets forget the grace notes.)

Code: (nwc) [Select · Download]
!NoteWorthyComposerClip(2.75,Single)
|Clef|Type:Bass
|Key|Signature:F#|Tonic:G
|TimeSig|Signature:Common
|Dynamic|Style:mf|Pos:-10|Visibility:Never
|Note|Dur:8th,Grace,Slur|Pos:-4|Opts:Muted
|RestChord|Dur:4th,Slur|Opts:Stem=Up,Muted,HideRest|Dur2:Half|Pos2:0,3
|User|Tremolo.ms|Pos:5|Play:N
|RestChord|Dur:4th|Opts:Stem=Up,Muted,HideRest|Dur2:Half|Pos2:5
|Note|Dur:8th,Grace,Slur|Pos:-4|Opts:Muted
|RestChord|Dur:4th,Slur|Opts:Stem=Up,Muted,HideRest|Dur2:Half|Pos2:0,3
|User|Tremolo.ms|Pos:5|Play:N
|RestChord|Dur:4th|Opts:Stem=Up,Muted,HideRest|Dur2:Half|Pos2:5
|Bar
|Note|Dur:8th,Grace,Slur|Pos:-4|Opts:Muted
|RestChord|Dur:4th,Slur|Opts:Stem=Up,Muted,HideRest|Dur2:Half|Pos2:0,2
|User|Tremolo.ms|Pos:5|Play:N
|RestChord|Dur:4th|Opts:Stem=Up,Muted,HideRest|Dur2:Half|Pos2:6
|Note|Dur:8th,Grace,Slur|Pos:-4|Opts:Muted
|RestChord|Dur:4th,Slur|Opts:Stem=Up,Muted,HideRest|Dur2:Half|Pos2:0,2
|User|Tremolo.ms|Pos:5|Play:N
|RestChord|Dur:4th|Opts:Stem=Up,Muted,HideRest|Dur2:Half|Pos2:6
|Bar
|Note|Dur:8th,Grace,Slur|Pos:-4|Opts:Muted
|RestChord|Dur:4th,Slur|Opts:Stem=Up,Muted,HideRest|Dur2:Half|Pos2:0,2
|User|Tremolo.ms|Pos:5|Play:N
|RestChord|Dur:4th|Opts:Stem=Up,Muted,HideRest|Dur2:Half|Pos2:6
|Note|Dur:8th,Grace,Slur|Pos:-4|Opts:Muted
|RestChord|Dur:4th,Slur|Opts:Stem=Up,Muted,HideRest|Dur2:Half|Pos2:0,2
|User|Tremolo.ms|Pos:5|Play:N
|RestChord|Dur:4th|Opts:Stem=Up,Muted,HideRest|Dur2:Half|Pos2:6
|Bar
!NoteWorthyComposerClip-End

The tremolo notes are somehow "cluttered" and hard to read at a glance.
A stem a bit longer can make things clearer. (See below)

Code: (nwc) [Select · Download]
!NoteWorthyComposerClip(2.75,Single)
|Note|Dur:8th,Grace,Slur|Pos:-4|Opts:Muted
|RestChord|Dur:4th,Slur|Opts:Stem=Up,StemLength=9,Muted,HideRest|Dur2:Half|Pos2:0,3
|User|Tremolo.ms|Pos:5|Play:N
|RestChord|Dur:4th|Opts:Stem=Up,StemLength=9,Muted,HideRest|Dur2:Half|Pos2:5
|Note|Dur:8th,Grace,Slur|Pos:-4|Opts:StemLength=9,Muted
|RestChord|Dur:4th,Slur|Opts:Stem=Up,StemLength=9,Muted,HideRest|Dur2:Half|Pos2:0,3
|User|Tremolo.ms|Pos:5|Play:N
|RestChord|Dur:4th|Opts:Stem=Up,StemLength=9,Muted,HideRest|Dur2:Half|Pos2:5
|Bar
!NoteWorthyComposerClip-End

The problem is that the stem increment is fixed, but the stems are not all of equal length; changing them all by hand is very tedious.
A solution is using the magic global modification, and I think I'll build up the relevant command line, but I was wondering: since there is a tool for "making tremolos", why not include the "incremental stem length" parameter?
Title: Re: User Tool: Make Tremolo.ms.lua (0.2)
Post by: Mike Shawaluk on 2016-05-13 10:51 pm
Problem: I have a score with lots of tremolo like the snippet below. (Lets forget the grace notes.)

Code: (nwc) [Select · Download]
!NoteWorthyComposerClip(2.75,Single)
--snip--

The tremolo notes are somehow "cluttered" and hard to read at a glance.
A stem a bit longer can make things clearer. (See below)

Code: (nwc) [Select · Download]
!NoteWorthyComposerClip(2.75,Single)
--snip--

The problem is that the stem increment is fixed, but the stems are not all of equal length; changing them all by hand is very tedious.
A solution is using the magic global modification, and I think I'll build up the relevant command line, but I was wondering: since there is a tool for "making tremolos", why not include the "incremental stem length" parameter?

Thanks for the suggestion; I'll consider it for my next update of that user tool.

There would seem to be a few things to consider for this addition:
Title: Re: User Tool: Make Tremolo.ms.lua (0.2)
Post by: Opagust on 2016-05-14 07:12 am
I don't think there is a way for a tool to tell how long a note's stem is, if the override box is not already checked.
If I select a note and open the properties box, I see a value of 7 for the stemlength (4 for a grace note). So I think your tool can use these values as a default when item:Get('Opts', 'StemLength') returns nil.
Title: Re: User Tool: Make Tremolo.ms.lua (0.2)
Post by: Flurmy on 2016-05-14 08:31 am
I don't think there is a way for a tool to tell how long a note's stem is, if the override box is not already checked.
Yes, that's exactly the wall I crashed on now when I tried to use "global modification"!
Title: Re: User Tool: Make Tremolo.ms.lua (0.2)
Post by: Mike Shawaluk on 2016-05-14 10:06 am
If I select a note and open the properties box, I see a value of 7 for the stemlength (4 for a grace note). So I think your tool can use these values as a default when item:Get('Opts', 'StemLength') returns nil.
You would think so, but you would be wrong. :)  Look at the notes in the following clip:

Code: (nwc) [Select · Download]
!NoteWorthyComposerClip(2.75,Single)
|Note|Dur:4th|Pos:8|Opts:Stem=Up
|Note|Dur:4th|Pos:8|Opts:Stem=Up
|Note|Dur:4th|Pos:-14|Opts:Stem=Up
|Note|Dur:4th|Pos:-14|Opts:Stem=Up
|Note|Dur:8th|Pos:8|Opts:Stem=Up,Beam=First
|Note|Dur:8th|Pos:-3|Opts:Stem=Up,Beam=End
|Bar
|RestChord|Dur:4th|Opts:Stem=Down,StemLength=7,Muted,HideRest|Dur2:Half|Pos2:8
|User|Tremolo.ms|Pos:0
|RestChord|Dur:4th|Opts:Stem=Down,StemLength=7,Muted,HideRest|Dur2:Half|Pos2:8
|RestChord|Dur:4th|Opts:Stem=Down,StemLength=7,Muted,HideRest|Dur2:Half|Pos2:-14
|User|Tremolo.ms|Pos:0
|RestChord|Dur:4th|Opts:Stem=Down,StemLength=7,Muted,HideRest|Dur2:Half|Pos2:-14
|RestChord|Dur:8th|Opts:Stem=Down,StemLength=7,Muted,HideRest|Dur2:4th|Pos2:8
|User|Tremolo.ms|Pos:0
|RestChord|Dur:8th|Opts:Stem=Down,StemLength=7,Muted,HideRest|Dur2:4th|Pos2:-3
!NoteWorthyComposerClip-End
The notes to the left of the bar do not have the override box checked; those to the right of the bar do. As you can see, NWC makes it own adjustments to non-overridden stem lengths based on staff position and stem direction (and beam slope, if the notes are beamed), and there is no way for a user tool to obtain this information. Still, as you say, a tool could simply assume a default of 7 when no value is stored, and the user could adjust them manually if they looked wrong.

Or on the flip side: functionality could be added to the Tremolo objects so they would draw their own stems if the note stem length was set to 0. This would give better default tremolos for cases such as the last pair. But the current Tremolo code is able to find the actual stem end points and draw the beams between them.
Title: Re: User Tool: Make Tremolo.ms.lua (0.2)
Post by: Opagust on 2016-05-14 12:36 pm
You would think so, but you would be wrong. :) 
I don't think it anymore.  :-[