[JW Lua] Set Instrument Playback

Martin Marris mmarris at notecraft.com
Fri Dec 4 08:26:53 CET 2020


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/34733d7f/attachment.htm>


More information about the JWLua mailing list