@objectkit/scriptex

A metaplugin and microlib for the Scripter MIDI-FX Plugin.

Usage no npm install needed!

<script type="module">
  import objectkitScriptex from 'https://cdn.skypack.dev/@objectkit/scriptex';
</script>

README

Scriptex

1.0.0-rc

A metaplugin and micro library for the Scripter MIDI-FX Plugin.

Scriptex is a thin ES6 wrapper that uses dynamic binding to link custom plugin keys to the official Scripter API.

API

Scriptex Scripter
parameters PluginParameters
needsTiming NeedsTimingInfo
needsDefaults ResetParameterDefaults
onParameter ParameterChanged
onProcess ProcessMIDI
onMIDI HandleMIDI
onReset Reset
onIdle Idle

Example

import { Plugin } from "@objectkit/scriptex"

/* conversion metric between pitch bend units and cents */
const PITCH_BEND_UNITS_PER_CENT= 40.96

/* extend from minimal Plugin class to have access to the static deploy method */
class Microtuner extends Plugin {

  /** @lends Scripter.PluginParameters */
  get parameters () {
    return [{
      ID: `microtuning`
      , name: ` m i c r o t u n e r `
      , type: `lin`
      , unit: `\u00A2`
      , minValue: -100
      , maxValue: 100
      , numberOfSteps: 200
      , defaultValue: 0
    }]
  }

  /** @lends Scripter.ParameterChanged */
  onParameter (key, val) {
    /* treat the plugin instance as a model view */
    this[this.parameters[key].ID]= val
  }

  /** @lends Scripter.Reset */
  onReset () {
    /* access Scripter by global or by #system reference */
    this.system.UpdatePluginParameters()
    return
  }

  /* intercept changes to the "microtuning" parameter */
  set microtuning (cents) {
    const units= ( PITCH_BEND_UNITS_PER_CENT * cents )
    this.applyPitchbend(units)
    return
  }

  /* send a pitch bend each time the slider moves */
  applyPitchbend (units) {
    const bend= new PitchBend()
    bend.value= units
    bend.send()
    return
  }
}

export { Microtuner }

Checkout the scriptex.plugin.microtuner project for a functional example that also uses the companion @objectkit/scriptex.mock library to test the plugin in a virtual Scripter environment or visit the docs.

Scripter plugin view.
Code Editor view

Requirements

  • Familiarity with ECMAScript 6
  • Familiarity with NodeJS
  • Familiarity with the Scripter MIDI-FX Plugin ( Logic Pro X | Mainstage )
  • Logic Pro X 10.5.0+ or Mainstage 3.4+
  • macOS 10.14+ Mojave or higher

Getting Started

Scriptex has been designed to support two workflows.

Code Editor Workflow

  • Download the latest scriptex preset
  • Create a new Logic Pro X or Mainstage project
  • Add Scripter as a MIDI plugin a new instrument strip
  • Press Open Script in Editor
  • Add the compressed content of the Scriptex library (2kb) to Code Editor
  • Save the preset as "Scriptex-1.0.0-rc.6"
  • Use this preset as a template for making bespoke MIDI processors

IDE Workflow

Follow your own path

  • Obtain an IDE of your choice
  • Create a new NodeJS project
  • Add the Scriptex package as an NPM package dependency
    npm i -D @objectkit/scriptex
    
  • Do what you need to do to develop your own plugins.
    import { Plugin } from "@objeckit/scriptex"
    class MIDITrace extends Plugin {
      onMIDI (event) {
        event.trace()
        event.send()
      }
    }
    export { MIDITrace }
    

Follow a designed path

Checkout the standalone project template and take advantage of the incorporated direct to pasteboard build tool helper and ready to use testing environment.

License

Apache-2.0 © ObjectKit 2020

Donation

paypal