[JW Lua] Octave Transposition
Robert Patterson
robert at robertgpatterson.com
Mon Dec 21 14:22:17 CET 2020
I'm glad it worked. Diatonic transposition is easy. Chromatic is a bit
messier and requires mathing <shudder>. :-)
On Mon, Dec 21, 2020 at 4:37 AM Martin Marris <mmarris at notecraft.com> wrote:
> Hi Robert,
>
>
>
> It works, and is very simple. I had noticed that FCNote property but
> because of its name, had assumed it had something to do with the horizontal
> displacement of noteheads in a chord, so had not bothered to read the
> definition.
>
>
>
> Thank you!
>
>
>
> Martin
>
>
>
> *From:* JWLua <jwlua-bounces at jwmusic.nu> *On Behalf Of *Robert Patterson
> *Sent:* Sunday, December 20, 2020 22:54
> *To:* The JW Lua script plug-in. <jwlua at jwmusic.nu>
> *Subject:* Re: [JW Lua] Octave Transposition
>
>
>
> Octave transposition, along with any diatonic transposition, is simple.
> Just add or subtract the number of diatonic steps to/from
> FCNote::Displacement. For octaves it is 7 diatonic steps.
>
>
>
> On Sun, Dec 20, 2020 at 4:42 PM Martin Marris <mmarris at notecraft.com>
> wrote:
>
> Quick correction:
>
>
>
> >>…. using note:SetPitch().<<
>
>
>
> I meant “SetString()” of course.
>
>
>
> Martin
>
>
>
> *From:* JWLua <jwlua-bounces at jwmusic.nu> *On Behalf Of *Martin Marris
> *Sent:* Sunday, December 20, 2020 21:34
> *To:* jwlua at jwmusic.nu
> *Subject:* [JW Lua] Octave Transposition
>
>
>
> After copy/pasting stuff I sometimes need to transpose the results by an
> octave, up or down.
>
>
>
> I assumed this would be easy but several hours later I am stuck.
>
>
>
> I tried three approaches:
>
> - Using the scripts kindly provided by Nick Mazuk at
> https://github.com/Nick-Mazuk/jw-lua-scripts. But even after
> incorporating all of the “transposition” library functions directly into my
> script I could not get this to work. I always got an error message that
> “note” was a nil object even though I had directly assigned a value to
> “note.”
> - A crude approach using MIDIKey, adding or subtracting 12. This did
> result in the correct pitches, but the wrong spellings: C ended up at
> B-sharp for example. (These errors happened only on transposing
> instruments.)
> - Finally I tried an approach that parsed the note String and changed
> it. So for example, Bb4 would be programmatically changed to Bb3 or Bb5 and
> then set using note:SetPitch(). This worked OK on “C” instruments but
> yielded spectacularly wrong results on transposing instruments (off by a
> couple of octaves in some cases). I messed around with the “written pitch”
> parameter (the third property in the SetPitch method) but go nowhere.
>
>
>
> Hmm.
>
>
>
> Martin
>
>
>
> _______________________________________________
> JWLua mailing list
> JWLua at jwmusic.nu
> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>
> _______________________________________________
> JWLua mailing list
> JWLua at jwmusic.nu
> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20201221/8011f966/attachment.htm>
More information about the JWLua
mailing list