Skip to main content
Topic: ChordPlay.nw (Read 41246 times) previous topic - next topic

Re: ChordPlay.nw

Reply #50
I'm ignorant, so I'm sorry for being picky, but my friends always told me javascript has almost nothing to do with java.
mea culpa.  Corrected pdf sent to Richard.

I did some reading and it seems your friends are quite correct.  I think I'll just take this moment to remind people that I am not a programmer ;)
One should never ass-u-me anything  :))
I plays 'Bones, crumpets, coronets, floosgals, youfonymums 'n tubies.

Re: ChordPlay.nw

Reply #51
Lawrie, you're in good company. Like many, I was fooled too.
Who did choose that name?  ::)

Re: ChordPlay.nw

Reply #52
Lawrie, you're in good company. Like many, I was fooled too.
Who did choose that name?  ::)
My reading revealed the following:
Netscape created a language they originally called LiveScript.  Its purpose was to be embedded into HTML to enable interactivity.  The interpreter was built into Netscape's Navigator.  By the time it was officially released it was renamed JavaScript, probably to try and benefit from Javas popularity at the time.  There are, apparently, some deliberate syntactical similarities with Java.

At about the same time Sun Microsystems released Java (originally Oak, then Green and finally Java).  The initial idea for its development was to enable interactivity for TV's, but that never eventuated.  Later it became a server side language.  Sun, and thus Java are now owned by Oracle Corp..  They also own the JavaScript trademark.

Of course, this is all off topic for this thread ;)
I plays 'Bones, crumpets, coronets, floosgals, youfonymums 'n tubies.

Re: ChordPlay.nw

Reply #53
I use ChordPlay.nw  a lot. It's so easy to transpose, with the chords being changed along with the notes on the staff.

Sometimes it's useful to be able to change the key of the chords for guitarists using a capo to turn hard chords like E flat into easy ones. So how to transpose the chords without transposing the notes?

I've coded the reverse in a modified version of ChordPlay.nw.nwcuser.lua (taken from version 1.6 at the top of this thread). It provides the option to disable chord transposition. Thus you can create capo chord version by first transposing the notes and chords down, then turn off chord transposition and transpose the staff back.

I've added an option to the right click menu to enable (default) or disable chord transposition. Use it on any chord object and it works on all of them - it's not a per-object setting.

I can't attach files but you'll find it here.

I'm not a Lua programmer, so my code may be clunky - I just followed used what was there with a bit of background reading about the API. If someone wants to pick this up and make it better, please do. Hope somebody else finds it useful.

Re: ChordPlay.nw

Reply #54
I seemed to remember there was a user tool to transpose chords (and only chords).
I was right: adp_TransposeChords.php.
But it's old and only transposes chords entered as text items.
Maybe the best thing would be to update it than to perform all the steps you listed.

Re: ChordPlay.nw

Reply #55
I show that there have been a couple of custom variations of Chordplay.nw created by members here:
  • Chordplay.fl, created by Flurmy, which allowed solfeggio chord names, several additional chord types, and corrected a minor bug
  • Chordplay.lp, created by Lawrie, which extended Flurmy's version by adding a number of SwingChord types, and changed the default font to SwingChord
Most of the changes were made in a backward-compatible way, such that the original object's functionality is still present,

Anyway, there is a facility to embed a user tool within the object itself, so that installing the object automatically adds the tool to NWC's menus. The Chordplay objects all include a tool that converts text chords to ChordPlay objects, but an object can have multiple user tools. Adding a Transpose tool should not be too difficult, I would think. But I am most familiar with object coding; tools were never my strong point.

It would be nice if there were a way to merge most, if not all, of the changes back to the parent object.  But that is an aside.

Re: ChordPlay.nw

Reply #56
But I am most familiar with object coding; tools were never my strong point.
Tools are much simpler than objects; you're not tied at all to the NWC APIs.
But the tool adp_TransposeChords.php is in php and, beside never having really grasped php, I'm now... well, rusty!  :D

It would be nice if there were a way to merge most, if not all, of the changes back to the parent object.  But that is an aside.
Mine, beside being backward-compatible, includes all the Lawrie's additions!
We are already there.

Re: ChordPlay.nw

Reply #57
Mine, beside being backward-compatible, includes all the Lawrie's additions!
We are already there.
The copy I have of Chordplay.fl is dated 8/20/2021, and has a significant number of differences with Chordplay.lp. I just tried to update it to the forum, and it tells me there are no updates available. Did you ever post it in the Object Plugins forum? You do have an official ID now, so you can do this. That way, everyone else will get an updated version when you post changes.

Re: ChordPlay.nw

Reply #58
I'll try to sort it out.   :-[

Lawrie's version implements my changes, not the other way round. Sorry, Lawrie!
But I made some more additions on a newer but unpublished version building on Lawrie's work, and this was what fooled me.

Unpublished because basically I added more different ways to write chords (in Europe, or at least in Italy, we often use chords written quite differently from what was expected by the original plugin).
Furthermore, I added the conversion text-> chordplay also for "solfeggio style" chord names, but it seems there is little request for "solfeggio style" tools.

I didn't change the plugin name because, as I wrote, my updates should be perfectly backward compatible.
Unless, of course, you enjoyed the bugs that are corrected!  :D

Re: ChordPlay.nw

Reply #59
Hi peoples, especially @Flurmy and @Mike Shawaluk,
do any of you regularly use Chordplay, and if so, do you use it to create chords for transposing instruments?
Today I tried to do something a little different to what I usually do* in that I activated playback for chordplay chords on a staff for a Concert pitch instrument.  This has always been fine.
Then I copied that entire staff to new one and transposed it for a Bb instrument (+2 semitones) with playback transposition checked.  The cacophony was dreadful.  The staff was playing back at concert pitch, as it should, BUT the Chordplay objects were not.  Unless I'm badly mistaken it appears that Chordplay ignores the staff playback transposition.

Has anybody else noticed this?  Or do I have something very unusual going on.  This enquiring mind would like to know.

FYI I also tried my unedited copy of Chordplay.nw and it was the same.

* I regularly create charts for several transposing instruments that are identical except for the transpositions (C, Bb and Eb usually) but this is the first time I activated playback of the Chordplay objects on all staves.
I plays 'Bones, crumpets, coronets, floosgals, youfonymums 'n tubies.

Re: ChordPlay.nw

Reply #60
Of course, you're right. Chordplay ignores the staff transposition.

I regularly create charts for several transposing instruments that are identical except for the transpositions (C, Bb and Eb usually) but this is the first time I activated playback of the Chordplay objects on all staves.
Very often I make use of Chordplay but very rarely, if ever, used the play option, so I was unaware of this problem.

I have to investigate what can be done. I think it can be corrected.
Maybe Mike already knows a solution...

Re: ChordPlay.nw

Reply #61
Thanks for the confirmation mate.

It isn't important enough to me to warrant any real effort to correct, I was more wanting confirmation that I hadn't lost what's left of my tiny, little mind  :))
I plays 'Bones, crumpets, coronets, floosgals, youfonymums 'n tubies.

Re: ChordPlay.nw

Reply #62
It turns out that this problem isn't unique to ChordPlay.nw.  GuitarChord.ms has the same problem. (I was going to add Banjo.ms and Ukulele.ms to the list, but then I remembered that those objects don't include playback.)

When I saw this, I thought that perhaps more of my objects that have playback would suffer from this, but it appears that objects that look at existing notes, like Arpeggio and Trill, are getting the staff transposition information.  I will look at the code for GuitarChord.ms to see if there is an easy fix for this, which hopefully could be applied to the other objects.

Re: ChordPlay.nw

Reply #63
And... it turns out the fix is very simple.  The API has a convenient function named nwcplay.getTransposition() which will take into account staff transpositions, as well as octave shifts for a treble clef.

Make these changes to the code toward the end of the play_ChordPlay() function:

   local noteCount = #k
   local arpeggioShift = (strum ~= 'No') and math.floor(math.min(duration,nwcplay.PPQ)/math.max(12,noteCount+1)) or 0
   local trans = nwcplay.getTransposition()
   for i, v in ipairs(k) do
      local thisShift = math.min(duration-arpeggioShift, arpeggioShift * ((strum == 'Down') and (noteCount-i) or i))
      nwcplay.note(thisShift, duration-thisShift, startPitch+v+nshift+trans)
   end


(Note: I would have used the "code" block feature, but that wouldn't let me use colored text)

Re: ChordPlay.nw

Reply #64
I should add a caveat to that fix. Namely, if you are using ChordPlay.nw in a passage that uses the Ottavamatic.ms object, you will get some strange sounding chords in the 8va sections :)

Re: ChordPlay.nw

Reply #65
Thanks Mike,
works a treat once I found the code section... and made ALL the changes  ::)

I note that in my installation the function is called this:
play_ChordPlay(t)

instead of this:
play_ChordPlay()

I plays 'Bones, crumpets, coronets, floosgals, youfonymums 'n tubies.

Re: ChordPlay.nw

Reply #66
I note that in my installation the function is called this:
play_ChordPlay(t)

instead of this:
play_ChordPlay()
I omitted the parameter when I typed the name of the function in my post, but as you observed, it needs to be there :)

Re: ChordPlay.nw

Reply #67
So, it is up to @NoteWorthy Online to decide if he wants to make this change to the object official. I can see that there could be circumstances in which might not be desirable to transpose the playback (such as when Ottavamatic.ms is being used). For GuitarChord.ms, I was considering an additional checkbox parameter "Prevent transposed playback" which, when checked, would disable the new behavior. While I normally try to implement a new parameter with backward compatibility, I think it makes more sense for this to have a default value of unchecked, so that transposed playback is on by default.  I would be interested in your opinions as to whether this makes sense, or if an additional parameter is even needed.

 

Re: ChordPlay.nw

Reply #68
If it's easy to implement the option for GuitarChord.ms then it's probably worth doing.

I'm also inclined to agree that in this case the new parameter should be unchecked by default as IMHO having playback match the transposition is far more likely to be desired than otherwise.

In fact, I can't think of a scenario where object playback should not include staff transposition, it makes no sense to me.
I plays 'Bones, crumpets, coronets, floosgals, youfonymums 'n tubies.


Re: ChordPlay.nw

Reply #70
If neither of you experts can think of a case where you wouldn't want transposition, then it seems silly to add an option to enable/disable it. Look for an update shortly.