Skip to main content
Topic: CopyHiddenAccidentals (Read 13284 times) previous topic - next topic

CopyHiddenAccidentals

Since I'm absolutely new to php, using prw_CopyGraceAccidentals.php as starting point I wrote this tool as a programming exercise.
It's a slightly more general version than the original one since it tests for hidden notes instead of grace notes.

Of course it's not the case (yet) to use this tool if you purposedly put a hidden muted grace note to hide the accidental!
This is matter for php exercise #2... :-)

Re: CopyHiddenAccidentals

Reply #1
it's not the case (yet) to use this tool if you purposedly put a hidden muted grace note to hide the accidental!
Nor should it be. I agree with you that hidden accidentals should not cause the removal of needed accidentals on visible objects.

I have been working on a tool to audit accidentals according to your guidance. A test song is attached. Running the tool on the a copy of the top staff turns it into the bottom staff. It might make a good testbed for your tool.
Registered user since 1996

Re: CopyHiddenAccidentals

Reply #2
Here is a problem:
Quote
!NoteWorthyComposerClip(2.0,Single)
|Note|Dur:4th,Grace|Pos:#-3|Visibility:Never
|Note|Dur:4th|Pos:#-3
|Note|Dur:4th|Pos:-3
!NoteWorthyComposerClip-End
Your tool adds a sharp to the last note.
Registered user since 1996

Re: CopyHiddenAccidentals

Reply #3
Thanks Rick.
After doing my homework I'll tell you how my php course is going! ;-)

Re: CopyHiddenAccidentals

Reply #4
Quote
... using prw_CopyGraceAccidentals.php as starting point I wrote this tool ...

I'm not complaining here, but just for the record, I think your script is identical to mine, except for adding my "clef" enhancement I think you found that I figured out later in prw_FindAmbiguous.php, and except for the 1 line that checks for visibility rather than grace!  :-)  [Changing formatting doesn't count, as the compiler ignores formatting anyway :-]

So your 1 line has a problem.  You assume that all non-"default" values are hidden, and it's true that "never" values are, but "always" values are not, and "top staff only" values may or may not be!  The best you can probably do is check for equal to "Never", rather than not equal to "Default", since you currently have no way of knowing whether your user tool was invoked on the top staff or not.  (Anyone: can a "default" value ever default to hidden?)

Re: CopyHiddenAccidentals

Reply #5
(Anyone: can a "default" value ever default to hidden?)
By default, |Instrument and |MPC are |Visibility:Never
Some items are TopStaffOnly by default.
Registered user since 1996

Re: CopyHiddenAccidentals

Reply #6
Quote
I think your script is identical to mine, except for adding my "clef" enhancement I think you found that I figured out later in prw_FindAmbiguous.php, and except for the 1 line that checks for visibility rather than grace!  :-)

Oh, yes. Why to reinvent the wheel?
Quote
"If I have seen farther than others, it is because I have stood on the shoulders of giants." (Isaac Newton)

Quote
So your 1 line has a problem.

That's life! :-(

Since I have no way of knowing whether the tool was invoked on the top staff or not I decided to assume by default it's not (in my case it's statistically more probable).
But I forgot the "always"!

Forgive the beginner!

Re: CopyHiddenAccidentals

Reply #7
I have no way of knowing whether the tool was invoked on the top staff or not
The final release of NWC 2.1 will include a current bar count using a new |Context item. This will be passed to the user tool, and ignored by NWC upon return. The context item will always be the first non-fake item in the clip passed to the user tool. [...] The AtStart flag indicates that the clip starts before any notes within the staff. It is not necessary the very beginning of the staff.

Perhaps Context should look something like this:
Quote from: !NoteWorthyComposerClip(2.0,Single)
|Context|Bar:0,AtStart,TopStaff
Registered user since 1996

Re: CopyHiddenAccidentals

Reply #8
Quote
By default, |Instrument and |MPC are |Visibility:Never
Some items are TopStaffOnly by default.

That's very interesting, Rick.  It looks like if you set an MPC (for example) to the "Default" visibility choice, it will stay logically "Default" in the nwxtxt clip (although the Visibility will be pruned physically, since "Default" is the default for this field :-), but it will act as if the visibility is "Never".  That all makes sense for MPC/Instrument.  So there is an object type that acts as if the visibility is "Top Staff Only" when the visibility is set to "Default"?!

Re: CopyHiddenAccidentals

Reply #9
So there is an object type that acts as if the visibility is "Top Staff Only" when the visibility is set to "Default"?!
2 of them:
  • |Flow|Style:Fine
  • |Ending|Endings:1
I pretty much summarize it <here>.
Registered user since 1996

Re: CopyHiddenAccidentals

Reply #10
Homework done.
I put in also the trick to keep the accidental hidden.

To get the most from the tool it must be run after a standard "audit accidentals".
I could have tried to let it do the full job, but I think it's too much work.
I'd like instead to see this behavior included in the built-in "audit accidentals".