[JW Lua] Reading MIDI values
Jari Williamsson
jari.williamsson at mailbox.swipnet.se
Wed Jan 15 17:31:05 CET 2014
Jan,
After using ConnectCell(), you need to also load the data to have it
available in the object. However, since there can be any number of
instances available to a cell, the most efficient way would be to use
the collection (FCMidiExpressions instead of FCMidiExpression).
Browse through a loaded collection using the each() iterator.
If you need to delete data from the collection, delete backwards.
The code snippet below will print all controller events in the first
measure/first staff ID:
---
local midievents = finale.FCMidiExpressions()
local cell = finale.FCCell(1,1)
midievents:LoadAllInCell(cell)
for me in each(midievents) do
if me.Controller then
print("CC #", me.ControllerNumber, " value:", me.ControllerValue)
end
end
---
The 3 other types (patch, pressure, wheel) will be available to
FCMidiExpression(s) in the next beta of JW Lua.
Best regards,
Jari Williamsson
On 2014-01-15 16:50, Jan Angermüller wrote:
> Hi Jari,
>> JW Lua beta 0.13 is now available for download, and the following code
>> should insert a MIDI controller event at the start of the first
>> measure on the staff with ID 1:
> Thanks a lot for the MIDI integration !
>
> Just two questions:
> 1.) Is it also possible to READ existing continuous MIDI data from a
> measure/staff ?
> I am not sure about the syntax. I tried:
>
> local cell = finale.FCCell(1,1)
> me:ConnectCell(cell)
> me:SetUseController() -- required ? I only want to get controller
> values ?
> me.MeasurePos = 0
> me.ControllerNumber=52
> if me:GetController () then --returns true only when I use
> SetUseController before
> print("MIDI Controller:", me.ControllerNumber) --always prints 52
> (of course, as set before)
> print("MIDI value:", me.ControllerValue) --always
> prints 0, although in Finale the value x is stored
> end
>
> No matter if the controller 52 is set in Finale or not, GetController
> only returns true, when I use SetUseController before. GetController
> seems to check SetUseController only and not the real controllers set in
> the Finale measure/staff.
> No matter which controller number I select, the ControllerValue always
> returns 0.
> Seems to me like the Get functionality is not implemented yet.
>
> 2.) The "Finale MIDI tool" also allows viewing and setting of other
> continuous MIDI data besides
> the controller data: Patch Changes, Channel Pressure and Pitch Wheel.
> Are they also covered by FCMidiExpression ?
> In MIDI message code: controller data is $b0 in the first message byte,
> patch changes $c0, channel pressure $d0 and pitch wheel $e0.
> If not, maybe add a variable (MIDI_CONTROLLER, MIDI_PATCHCHANGES, ...)
> to FCMidiExpression for selecting the type of MIDI data ?
>
> Thanks a lot !
>
> Jan
>
> _______________________________________________
> JWLua mailing list
> JWLua at jwmusic.nu
> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>
>
More information about the JWLua
mailing list