Scripter Javascript Tutorial
javascriptmusiclogicscripterbookexcerpttutorialThe Complete Guide to Logic Pro’s Scripter: JavaScript Tutorial
2 Introduction
The tutorial covers everything needed to work with JavaScript in Scripter and provides examples within a musical, Scripter, and Logic Pro context wherever possible. The tutorial is divided into the following sections:
Fundamentals: This section focuses on the core building blocks of the JavaScript language—statements, syntax, variables, operators—where they are most commonly used in Scripter and includes some basics on organizing code. This is intended for the beginning programmer who has had no exposure to any kind of computer code. For experienced programmers, Scripter’s JavaScript syntax is just the same as in any other JavaScript environment, but a review of this section can be helpful because there are a few important differences.
Advanced: This brings together everything in Fundamentals by covering objects, branching, functions, and stepping into code quality. It also starts to address working with JavaScript within the context of a track and MIDI events.
Code Quality: This section describes ways to write clean, maintainable code. Like any Logic Pro project, Scripter scripts can get complex quickly, and a little consistency and organization will go a long way towards enhancing and debugging scripts. Code style considerations and recommendations are provided: variable naming, how to use spaces, grouping statements, and other options when writing code.
The following section is found in the book, available on Apple Books and Amazon Kindle. ISBN: 978-0-578-37719-3Bringing It All Together: This section reviews a fairly complex script in detail, showing all the key points of working with objects, Scripter’s own functionality, and code quality.
The tutorial will not cover everything there is to know about
JavaScript, because Scripter is a unique use case which is outside
JavaScript’s web-based purposes. Instead, it will cover topics which are
typical of working in Scripter. For example, declaring variables with
var
, let
, and const
is covered,
but code blocks (...
) are not covered because those are generally not needed even in the most complex scripts.