Scripter Javascript Tutorial
javascriptmusiclogicscripterbookexcerpttutorial79 Summary
A summary comment can contain basic information about the script and
can provide helpful context to the script when going back into it after
a long time. It’s similar to a README
file:
/*
Name: Live Humanize
Author(s): Philip Regan
Purpose: Randomize velocity, beatPos, and detune by Ticks during play
Information:
* Need to increase Tick range to ensure more noticeable changes
Change History:
21_10_23_01_00_00: Started script
21_10_23_01_01_00: Added NoteOn and NoteOff capturing
*/
In the above example, basic but important information is captured in this comment:
The script’s purpose told in a way of generally how it goes about "humanizing" the music.
A tweak that needs to be made in the script. This could also be used to record enhancement ideas and bugs to be fixed.
The script’s change history. Most scripts probably won’t need this section, but when a script grows to any real complexity, this can be useful to know where things left off. As for complex, there are no hard and fast rules, but if there is more than a few controls and/or functions, then recording a basic roadmap of ideas and a change history will likely be helpful.
Summary comments can also be used for at least moderately complex functions:
/*
Purpose: Modifies an event's properties based on control settings
Input: MIDI event
Output: modified MIDI event
*/
function humanizeEvent(event) {
// do something
}