[JW Lua] Set Instrument Playback

Martin Marris mmarris at notecraft.com
Fri Dec 4 19:50:34 CET 2020


OK, I have figured out that once the file has been created by JW Lua (with
all the newly created instruments defaulting to a Piano sound) I can do this
in Finale:

 

MIDI/Audiio => Reassign Playback Sounds.

 

This assigns the correct instrument sounds to all of the instruments, as
listed in Score Manager.

 

So, Finale really does know what these instruments are, which is not
surprising given that I have assigned them using  InstrumentUUID.

 

However "Reassign Playback Sounds" is still an extra step to make manually.
Is there really no way to do it in Lua, at the time that the instruments are
created?

 

Tnx.

 

Martin

 

From: JWLua <jwlua-bounces at jwmusic.nu> On Behalf Of Martin Marris
Sent: Friday, December 4, 2020 07:27
To: jwlua at jwmusic.nu
Subject: [JW Lua] Set Instrument Playback

 

I am writing a large JW Lua script that, among other things, creates
instrument staves. The playback needs to be correct on those staves. At the
very least, the correct General MIDI sound needs to be applied.

 

Here is a snippet of the code I am using to create instrument staves:

 

local staffID = finale.FCStaves.Append()

if staffID then

-- Load the created staff

local staff = finale.FCStaff()

staff:Load(staffID)

-- Set the virtual instrument (in the Score Manager)

staff.InstrumentUUID = finale.FFUUID_CLARINETBFLAT

--Set the instrument names

local strName =finale.FCString()

strName.LuaString="B_b Clarinet"

staff:SaveNewFullNameString (strName)

local strAbrev =finale.FCString()

strAbrev.LuaString="Bb Cl."

staff:SaveNewAbbreviatedNameString (strAbrev)

--Set the clef

staff.DefaultClef = 0

--Set the transposition

staff.TransposeInterval = 1

staff.TransposeAlteration = 2

staff.TransposeSimplifyKey = true

staff:Save() 

end

 

The staves/instruments created by the above code look perfect in Score
Manager, except for the playback sound, which defaults to Piano.

 

I have spent way too long, several hours, messing around with
FCInstrumentPlaybackData but cannot figure it out, nor do I find a list of
constants that I could apply for playback (the existing constants list has
extensive instrument UUID listings but I don't find playback constants).

 

How does it work?

 

Thanks!

 

Martin

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20201204/46d96e9c/attachment.htm>


More information about the JWLua mailing list