10.6

Table Of Contents
214Logic Pro Effects
Use the Trace object
Trace is a Scripter specific function, rather than a JavaScript function. You can also
use Scripters Event.trace function to log events to the plug-in console. For more
information, see Use the JavaScript Event object.
Trace(value) outputs the given value of any type to the Scripter console, which can be
useful for generating debug outputs. It’s possible to mix different variable types in a single
Trace() command, much like you would do with strings.
Note: Console output is thinned for performance reasons if you send too many Trace
commands in a short timeframe. This also happens with event.trace.
Usage example for Trace() object
function HandleMIDI(event)
{
Trace("Hello World!");
var int = 1;
var float = 1.234;
var str = "Teststring";
Trace("The following is a float variable: " + float +
" And now we inspect an integer: " + int +
" And here's a test string: " + str);
}
Use the MIDI event beatPos property
Every MIDI event in Scripter has a property called “beatPos” that carries the exact beat
position of the event. This makes more exact event timing possible and also handles loops
correctly. This property can be used in place of timingInfo.blockStartBeat. See Use
the JavaScript TimingInfo object.
Note: This property only works if "var NeedsTimingInfo = true", otherwise it will
have a value of 0, and will print a warning if modified.
In Logic Pro, type either of the following lines in the Script Editor window (both achieve
the same result):
event.send()
event.sendAtBeat(event.beatPos)
Alternatively, you can use either of the following lines in the Script Editor window
(both achieve the same result):
event.beatpos += 1; event.send()
event.sendAtBeat(event.beatPos + 1)