Anyone familiar with scripting in Presence XT?

Discussion in 'Studio One' started by MNDSTRM, Sep 22, 2019.

  1. MNDSTRM

    MNDSTRM Platinum Record

    Joined:
    Nov 24, 2011
    Messages:
    627
    Likes Received:
    271
    Location:
    Toronto
    Since its initial release I've been waiting for some kind of tutorial on scripting for the Presence XT editor.
    I'm really disappointed in Presonus as they have a track record of implementing cool features without developing a strong support infrastructure behind them. They built a powerful instrument and just said it runs javascript go ahead. Theres no manual or anything (aside from a list of functions in the editor).

    I've had some programming experience in university with C+ and PERL but not JS. Even then I had found the best way for me to learn was to take sample code and modify it to my needs (break it, fix it, and keep repeating till it doesnt resemble the original anymore).

    Theres this site which has good info but seems to be scripting 102. It has two source codes but theyre a bit too advanced to learn from at the moment.
    https://xtscripting.wordpress.com

    I think two of the simplest scripts to start with would be to create a macro knob for a layer volume and a button to something.

    Anybody have any insight?
     
  2.  
  3. Moonlight

    Moonlight Audiosexual

    Joined:
    Jun 12, 2011
    Messages:
    2,470
    Likes Received:
    760
    Location:
    Earth
    thanks for the resource! It is a pity how bad the presonus support is and do not care about their clients.
     
  4. Moonlight

    Moonlight Audiosexual

    Joined:
    Jun 12, 2011
    Messages:
    2,470
    Likes Received:
    760
    Location:
    Earth
    I just had a look on the docs, it is all in there:

    Code:
    ===================
    Script Entry Points
    ===================
    
     - onInit ();
        called when the script is loaded
        available object: engine
    
     - onNoteOn ();
        called when a note on event is processed
        available object: note
        also available: engine
    
     - onNoteOff ();
        called when a note off event is processed
        available object: note
        also available: engine
    
     - onNoteSustainOff ();
        called when a sustained note is stopped
        available object: note
        also available: engine
    
     - onController ();
        called when a controller event is processed
        available object: controller
        also available: engine
    
     - onVoiceStart ();
        called when a voice is started
        available object: voice
        also available: engine
    
     - onScriptParamChange ();
        called when a script parameter has changed
        available object: parameter
        also available: engine
    
     - onReset ();
        called when the sampler is switched off
        available object: engine
    
     - wakeup ();
        called as a result of engine.scheduleWakeup
        available object: engine
    
    ===================
    Objects
    ===================
    
    -------------------
    engine
    -------------------
    
      Properties:
        - noteOnCount [int]
        - isLegato [bool]
        - sampleRate [float]
        - blockSize [int]
        - playbackLatency [int]
        - captureLatency [int]
        - processLatency [int]
        - timeSeconds [float]
        - timeSamples [int]
        - timePPQ [float]
        - systemTimeSeconds [float]
        - systemTimeSamples [int]
        - playing [bool]
        - recording [bool]
        - loopActive [bool]
        - offline [bool]
        - located [bool]
        - tempo [float]
        - signatureNum [int]
        - signatureDenom [int]
        - blockOffset [int]
        - numOutputs [int]
        - warnings [bool]
        - profiling [bool]
    
      Methods:
        - lookupZone (name); -> returns 'zone'
        - lookupLayer (name); -> returns 'layer'
        - playNote (pitch, velocity, delay, oneshot); -> returns 'eventID'
        - playZone (zone, pitch, velocity, delay, oneshot); -> returns 'eventID'
        - stopEvent (eventID, fadeOutTime);
        - allNotesOff ();
        - getNoteOnPitch (index);
        - getNoteOnVelocity (index);
        - enableLayer (layer, state);
        - disableAllLayers ();
        - scheduleWakeup (delay);
        - scheduleWakeupSamples (delay);
        - cancelWakeup ();
        - getParameter (component, name); -> returns 'value'
        - writeLine (string);
    
    -------------------
    note
    -------------------
    
      Properties:
        - pitch [int]
        - velocity [int]
        - velocityNorm [float]
        - eventID [int]
        - blockOffset [int]
        - duration [float]
        - discarded [bool]
        - sustained [bool]
    
      Methods:
        - discard ();
    
    -------------------
    controller
    -------------------
    
      Properties:
        - number [int]
        - value [int]
        - discarded [int]
    
      Methods:
        - discard ();
    
    -------------------
    parameter
    -------------------
    
      Properties:
        - index [int]
        - name [string]
        - value [float]
    
    -------------------
    voice
    -------------------
    
      Properties:
        - pitch [int]
        - eventID [int]
        - output [int]
        - offMode [int]
        - velocity [int]
        - velocityNorm [float]
        - sample [string]
        - rootKey [int]
        - tune [float]
        - startSample [int]
        - endSample [int]
        - loopMode [int]
        - loopStart [int]
        - loopEnd [int]
        - loopXFade [int]
        - lowKey [int]
        - highKey [int]
        - lowVelo [int]
        - highVelo [int]
        - layer [object]
    
      Methods:
        - getParameter (component, name); -> returns 'value'
        - setParameter (component, name, value);
    
    =================================================================
    Component / Parameter IDs
    =================================================================
    
        Parameters available for engine.getParameter
        -------------------------------------------------------------
        'component' - 'name'
        -------------------------------------------------------------
        midi-cc - pitchBend
        midi-cc - bendRangeUp
        midi-cc - bendRangeDown
        midi-cc - sustain
        midi-cc - modWheel
        midi-cc - aftertouch
        midi-cc - breath
        midi-cc - expression
        script - bool-1
        script - bool-2
        script - bool-3
        script - bool-4
        script - bool-5
        script - bool-6
        script - bool-7
        script - bool-8
        script - float-1
        script - float-2
        script - float-3
        script - float-4
        script - float-5
        script - float-6
        script - float-7
        script - float-8
        glide - glideTime
        lfo1 - active
        lfo1 - type
        lfo1 - syncbeats
        lfo1 - syncnote
        lfo1 - frequency
        lfo1 - beatlength
        lfo1 - delay
        lfo1 - delaybeats
        lfo1 - keyscaling
        lfo2 - active
        lfo2 - type
        lfo2 - syncbeats
        lfo2 - syncnote
        lfo2 - frequency
        lfo2 - beatlength
        lfo2 - delay
        lfo2 - delaybeats
        lfo2 - keyscaling
        adsrMain - attack
        adsrMain - hold
        adsrMain - decay
        adsrMain - sustain
        adsrMain - release
        adsrMain - attackcurve
        adsrMain - decaycurve
        adsrMain - releasecurve
        adsr2 - delay
        adsr2 - attack
        adsr2 - hold
        adsr2 - decay
        adsr2 - sustain
        adsr2 - release
        adsr2 - attackcurve
        adsr2 - decaycurve
        adsr2 - releasecurve
        wave - tune
        wave - veloSampleShift
        wave-amp - pan
        wave-amp - dbOffset
        filter - active
        filter - type
        filter - clip
        filter - drive
        filter - cutoff
        filter - resonance
        filter - keyscaling
        filter - velo-to-cutoff
        filter - compress
        voiceAmp - velo-amount
        voiceAmp - velo-curve
        delayFx - active
        delayFx - mix
        delayFx - beats
        delayFx - feedback
        delayFx - locut
        delayFx - hicut
        delayFx - pingpong
        verbFx - active
        verbFx - mix
        verbFx - pre
        verbFx - size
        verbFx - damp
        verbFx - locut
        verbFx - hicut
        modFx - active
        modFx - type
        modFx - sync
        modFx - speed
        modFx - beats
        modFx - depth
        modFx - feedback
        modFx - lfowidth
        modFx - chorusdelay
        modFx - flangerdelay
        modFx - phaserspeed
        modFx - mono
        eqFx - active
        eqFx - type
        eqFx - mix
        eqFx - level1
        eqFx - level2
        eqFx - level3
        eqFx - level4
        eqFx - level5
        eqFx - level6
        eqFx - level7
        distFx - active
        distFx - type
        distFx - mix
        distFx - drive
        panFx - active
        panFx - sync
        panFx - speed
        panFx - beats
        panFx - depth
        gateFx - active
        gateFx - stereo
        gateFx - beats
        gateFx - depth
        gateFx - stepL01
        gateFx - stepL02
        gateFx - stepL03
        gateFx - stepL04
        gateFx - stepL05
        gateFx - stepL06
        gateFx - stepL07
        gateFx - stepL08
        gateFx - stepL09
        gateFx - stepL10
        gateFx - stepL11
        gateFx - stepL12
        gateFx - stepL13
        gateFx - stepL14
        gateFx - stepL15
        gateFx - stepL16
        gateFx - stepR01
        gateFx - stepR02
        gateFx - stepR03
        gateFx - stepR04
        gateFx - stepR05
        gateFx - stepR06
        gateFx - stepR07
        gateFx - stepR08
        gateFx - stepR09
        gateFx - stepR10
        gateFx - stepR11
        gateFx - stepR12
        gateFx - stepR13
        gateFx - stepR14
        gateFx - stepR15
        gateFx - stepR16
        delayRevBypass - active
        masterGain - gain
    
    
        Parameters available for voice.getParameter / voice.setParameter
        -------------------------------------------------------------
        'component' - 'name'
        -------------------------------------------------------------
        glide - glideTime
        lfo1 - active
        lfo1 - type
        lfo1 - syncbeats
        lfo1 - syncnote
        lfo1 - frequency
        lfo1 - beatlength
        lfo1 - delay
        lfo1 - delaybeats
        lfo1 - keyscaling
        lfo2 - active
        lfo2 - type
        lfo2 - syncbeats
        lfo2 - syncnote
        lfo2 - frequency
        lfo2 - beatlength
        lfo2 - delay
        lfo2 - delaybeats
        lfo2 - keyscaling
        adsrMain - attack
        adsrMain - hold
        adsrMain - decay
        adsrMain - sustain
        adsrMain - release
        adsrMain - attackcurve
        adsrMain - decaycurve
        adsrMain - releasecurve
        adsr2 - delay
        adsr2 - attack
        adsr2 - hold
        adsr2 - decay
        adsr2 - sustain
        adsr2 - release
        adsr2 - attackcurve
        adsr2 - decaycurve
        adsr2 - releasecurve
        wave - tune
        wave - veloSampleShift
        wave-amp - pan
        wave-amp - dbOffset
        filter - active
        filter - type
        filter - clip
        filter - drive
        filter - cutoff
        filter - resonance
        filter - keyscaling
        filter - velo-to-cutoff
        filter - compress
        voiceAmp - velo-amount
        voiceAmp - velo-curve
    
     
  5. Moonlight

    Moonlight Audiosexual

    Joined:
    Jun 12, 2011
    Messages:
    2,470
    Likes Received:
    760
    Location:
    Earth
    Code:
    onScriptParamChange () 
    is fired when a defined knob/ button change its value

    eg:
    Code:
    function onScriptParamChange ()
    {
         engine.writeLine("knob1:"+ parameter.name) 
         engine.writeLine("knob1 value:"+ parameter. value) 
    }

    The knobs and switches have hardcoded variable names (see docs):
    Code:
    script - bool-1 // button 1
    ...
    script - float-1 // knob 1
     
Loading...
Loading...