Skip to main content
Topic: (a) Tool to create single voices from chords? (b) Class model of NWC2ClipItem (Read 7533 times) previous topic - next topic

(a) Tool to create single voices from chords? (b) Class model of NWC2ClipItem

Hello all -

I urgently need (well ... I would like to have) a tool that creates single voices from chords ... and I'll write it myself (already started), but I found that I have a few questions:

a) I write it in PHP, because I also wrote my previous tool in it - but I must say I hate the language and am not fluent in it (whatever here is the cause and what the effect, I do not know). Which other language could I use which gives me a sensible object model for items, like the one in lib/nwc2clips.inc? (yes, I could write my own string splitter - but I rather would not).

b) What I need is actually a little more than single voices: I want to extract some voices from chords, according to some heuristics (e.g., in a chord with 3 notes, "take voices 1 and 2" will select the upper most two notes, whereas "voices -1 and -2" will take the lowermost; and with rules for what to take when there is chord with 2 notes or a single note; etc...). So, I sometimes have to rewrite RestChords to Chords or Notes or Rests ... and for that, I would like to have an overview over the options I have to copy into the new object. In the attachment is my current draft of such a model - but: Is there one documented and more complete somewhere around?

c) And last but not least: Is there already such a tool around - or something near it which I could modify according to my ideas?

Thanks a lot!
Harald M.

Re: (a) Tool to create single voices from chords? (b) Class model of NWC2ClipItem

Reply #1
c) And last but not least: Is there already such a tool around - or something near it which I could modify according to my ideas?
There is a user tool in the starter kit called "Parts (adp)" that appears to do some of what you are asking. It's not as fancy as the tool you are describing, but as you say, perhaps it would be a suitable starting point, or at least give you a few ideas.

Re: (a) Tool to create single voices from chords? (b) Class model of NWC2ClipItem

Reply #2
Thanks! .. 540 lines or so ... so it seems not too simple to do this  :-\ - I will dive into it!

Regards
Harald

Re: (a) Tool to create single voices from chords? (b) Class model of NWC2ClipItem

Reply #3
Which other language could I use which gives me a sensible object model for items, like the one in lib/nwc2clips.inc?
Lua
Registered user since 1996

Re: (a) Tool to create single voices from chords? (b) Class model of NWC2ClipItem

Reply #4
Which other language could I use which gives me a sensible object model for items, like the one in lib/nwc2clips.inc?
Lua
I would suggest looking at the recently posted TabStaffMaker.lua (which is part of this post) as a good example Lua user tool.

Re: (a) Tool to create single voices from chords? (b) Class model of NWC2ClipItem

Reply #5
Hello Harald,
Here are some useful links if you want to go for Lua:

In my tools I prefer to use level2 (see https://lua.noteworthycomposer.com/nwcut.html##(nwcut).setlevel), wich is the most expanded representation of a NWC text line.
In attachment you find a little tool 'ShowCliptext'. If you select a part of a staff and run this tool, it shows the internal representation in level 2.
Always look on the bright side of life!

 

Re: (a) Tool to create single voices from chords? (b) Class model of NWC2ClipItem

Reply #6
I use "Parts (adp)" quite a bit - so much so that I have created various invocations so I can just select one to do what I want without having to remember the syntax:
Extract from "nwc2UserTools.ini"
Quote
Extract Parts - Remove Bottom='php\php.exe scripts\adp_Parts.php remove bottom'
Extract Parts - Remove Top='php\php.exe scripts\adp_Parts.php remove top'
Extract Parts - Remove Top - No Single Notes='php\php.exe scripts\adp_Parts.php remove top nosingle'
Extract Parts - Remove Bottom - No Single Notes='php\php.exe scripts\adp_Parts.php remove bottom nosingle'
Extract Parts - HELP='php\php.exe scripts\adp_Parts.php help'
Extract Parts - Retain Bottom='php\php.exe scripts\adp_Parts.php retain bottom'
Extract Parts - Retain Top='php\php.exe scripts\adp_Parts.php retain top'
Used in combination it is also easy to extract interior notes.

I've lately been playing with concert band arrangements - to make life easy I create each set of voices on one staff in concert pitch (Saxes, trumpets, flutes/oboe etc.) then copy the staff to each instrument to extract the parts later using "Parts (adp)".

This way I can have a condensed conductor score as well as extractable parts, just by choosing what is visible, all in one file.
I plays 'Bones, crumpets, coronets, floosgals, youfonymums 'n tubies.

Re: (a) Tool to create single voices from chords? (b) Class model of NWC2ClipItem

Reply #7
Hi Lawrie -

with your posting (thank you!), I should immediately give up writing my own tool - because that's exactly what I want to do.

Right now, I still do not really understand these "bottom" and "top" things - instead of just saying what I want ("keep the second voice from the bottom"), this implies an "operational way" of doing things (wait ... I have to think ... probably it is: "remove bottom, then retain bottom").

What I do not understand at all, was that "position thing", including accidentals?? - this lead me to the conclusion that this tool was used for something else which I did not understand ... maybe I should have asked instead :-[ And the "nosingle" also makes me stumble - what is special about a single voice? Why is there no "nodouble", when chords are written with 3 voices?

But is seems that I will split my programming play-arounds (be they in PHP or, more likely, in Lua) from my musical ones (which, however, have a higher priority - I am years behind with the things I want to do there ...).

Many thanks!
Harald

Re: (a) Tool to create single voices from chords? (b) Class model of NWC2ClipItem

Reply #8
What I do not understand at all, was that "position thing", including accidentals??
Assuming you mean:
Quote from: adp_Parts.php
<pos> is a position on the staff, including accidental
(accidentals are ## for double sharp, # for sharp, b for flat, bb for double)
0 is the centre line
eg remove pos=#0 will remove all sharp centre line notes or chord members
It is used to extract percussion parts.
Registered user since 1996

Re: (a) Tool to create single voices from chords? (b) Class model of NWC2ClipItem

Reply #9
Well ... I would have come to that requirement somewhen, wouldn't I? ;) .. just right now, I didn't think far enough.
Many thanks!
So my musical enterprises will continue now ... re programming, I might switch back a little, or, maybe, just add a little this and that to the - it seems - very useful Parts tool.

Regards
Harald