Complete Help Docs

Laser Show Technology for Lighting Professionals

User Tools

Site Tools


examples:pangoscript

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
examples:pangoscript [2025/04/17 18:04]
Lyra Letournea
examples:pangoscript [2025/04/17 18:11] (current)
Lyra Letournea [Examples from Users]
Line 80: Line 80:
 ===== Examples from Users ===== ===== Examples from Users =====
  
-The following examples are from the userbase, at the permission of the users. +The following examples are from the userbase, at the permission of the users. Scripts many not have been validated by pangolin internally, and opinions expressed, and explanations are directly from the user not pangolin
  
 ==== Jeff Vyduna ==== ==== Jeff Vyduna ====
Line 232: Line 232:
  
 Takes a rotary incremental (relative mode) encoder on a MIDI controller, such as on a APC40mk2 or Traktor F1, and scale the metronome for beat-based effects in selected QuickFX rows to snap to a 2^X time scale multiplier. For example, if you've made effects with a 2 beat nominal duration, this lets you twist a knob and instantly change their duration to 2, 4, 8, or 16 beats (as well as 1, 1/2, 1/4, or 1/16th of a beat). Takes a rotary incremental (relative mode) encoder on a MIDI controller, such as on a APC40mk2 or Traktor F1, and scale the metronome for beat-based effects in selected QuickFX rows to snap to a 2^X time scale multiplier. For example, if you've made effects with a 2 beat nominal duration, this lets you twist a knob and instantly change their duration to 2, 4, 8, or 16 beats (as well as 1, 1/2, 1/4, or 1/16th of a beat).
 +
 +=== Advance a QuickFX, toggling through multiple layers ===
 +
 +  // Advance the currently running QuickFX from the color layers,
 +  // which are layers 1 and 2 in many QuickFX layouts.
 +  // Use this script in a MIDI-to-PangoScript slot.
 +  
 +  // As configured below, it will toggle advance through the first 24 colors
 +  // in layer 1, then in layer 2, then back to layer one (including a state where both layers are off)
 +  
 +  // Scripts like this that store some state in a golbal variable should have
 +  // that variable defined in the controller initialization script. Copy these these and uncomment:
 +  // GLOBALVAR gColorFXIdx
 +  // gColorFXIdx = 0
 +  
 +  gColorFXIdx = gColorFXIdx + 1 // advance on MIDI trigger
 +  gColorFXIdx = gColorFXIdx % 49
 +  
 +  MidiOutLong(0xBC, 41, gColorFXIdx) // Display on Traktor F1 the color index
 +  
 +  if (gColorFXIdx > 24) GOTO Layer2
 +  
 +  SetFX 2, 0
 +  SetFX 1, gColorFXIdx
 +  
 +  exit
 +  
 +  
 +  Layer2:
 +  
 +  SetFX 1, 0
 +  SetFX 2, gColorFXIdx - 24
 +  
 +  exit
 +
 +Many workspaces keep the default scheme of having the first two QuickFX layers apply colors. On some compact MIDI controllers, I've wanted to have a single button advance through the effects in a row. This script advances through the first 24 colors on layer 1, then disables layer 1 and advances through the first 24 effects in layer 2, finally ending with a state where both layers are off.
 +
 +=== Relative encoder for fine Channel adjustment ===
 +
 +  // Fine control from a relative encoder
 +  // Place this script in a MIDI-to-PangoScript slot.
 +  // and be sure to change the channel number in several places below
 +  
 +  // Channels are displayed in the UI as 0 to 100
 +  // but can be set as 0-1000 values using ChannelOut
 +  // Channel.<N>.Value is a fractional value 0...1
 +  VAR ChannelNumber, ChVal
 +  ChannelNumber = 5
 +  ChVal = int(Channels.5.Value * 1000)
 +  //DisplayPreview "Ch " + intstr(ChannelNumber) + " name iss: " + Channels.1.Name
 +  //DisplayPreview "Ch " + intstr(ChannelNumber) + " value (0-1000) was: " + intstr(ChVal)
 +  
 +  VAR MidiVal
 +  MidiVal = ExtValue(0,127)
 +  DisplayPreview "MidiVal: " + intstr(MidiVal)
 +  
 +  if (MidiVal > 64) GOTO Incr
 +  
 +  if (ChVal <= 0) GOTO Done
 +  ChannelOut ChannelNumber, int(ChVal - 1)
 +  //DisplayPreview "Decremented"
 +  GOTO Done
 +  
 +  Incr:
 +  if (ChVal >= 1000) GOTO Done
 +  ChannelOut ChannelNumber, ChVal + 1
 +  //DisplayPreview "Incremented"
 +  
 +  Done:
 +  //DisplayPreview "Ch " + intstr(ChannelNumber) + " value set to: " + intstr(ChVal) + "/1000"
 +
 +Beyond channels show up as values between 0 and 100 in the Channels tab, but are internally stored as a normalized 0..1 float. This makes them useful tools for linking to any parameter that takes an input. Sometimes you want much finer control over a parameter than 127 values from MIDI (and few controllers support 14-bit MSB+LSB). You may have experienced this when linking MIDI controllers to Z rotation - it's steppy and I've resorted to enabling physics to dampen the motion which helps a little but is still imprecise. I was recently preparring for a film shoot where I needed fine control over some large value ranges (precise points counts in a resampler to help tune rolling shutter banding). By configuring my rotary encoder to send incremental up/down values, you can route it to parameter inputs through Channels using arbitrary fine resolution using the internal float value.
 +
 +=== Select Groups mode Destination cues from APC40 mkii Track/Clip Stop buttons ===
 +
 +  // Activate a Destination cue (Groups) on APC40 mk2's Track Select button or Clip Stop button
 +  
 +  // Requires GlobalVar lastDestinationCueNumber - Define these in the controller init scripts!
 +  // GlobalVar lastDestinationCueNumber
 +  // lastDestinationCueNumber = 0
 +  
 +  // For this script, Destination Cues page MUST be in page 1 of the whole workspace
 +  // Select a desitnation cue; CueDown is the only trigger possible -- MouseDown doesn't seem to work
 +  // Cancel all other track and clip stop indicator LEDs
 +  // Illuminate the correct light
 +  // Handle if a destination cue was clicked again by holding internal state
 +  
 +  // You must set this correctly for each button you add this script to
 +  Var destinationCueNumber 
 +  destinationCueNumber = 1
 +  
 +  Var isSecondRow
 +  isSecondRow = (destinationCueNumber > 8) & (destinationCueNumber <=16)
 +  
 +  // StartCue doesn't work for Destination cues
 +  CueDown 1, destinationCueNumber // Page 1 must be "Destinations" Cue sheet
 +  
 +  // Turn off all lights in this group
 +  // Using a loop was too slow for the device or PangoScript. :-/
 +  MidiOut 0x90, 0x33, 0x00
 +  MidiOut 0x91, 0x33, 0x00
 +  MidiOut 0x92, 0x33, 0x00
 +  MidiOut 0x93, 0x33, 0x00
 +  MidiOut 0x94, 0x33, 0x00
 +  MidiOut 0x95, 0x33, 0x00
 +  MidiOut 0x96, 0x33, 0x00
 +  MidiOut 0x97, 0x33, 0x00
 +  
 +  MidiOut 0x90, 0x34, 0x00
 +  MidiOut 0x91, 0x34, 0x00
 +  MidiOut 0x92, 0x34, 0x00
 +  MidiOut 0x93, 0x34, 0x00
 +  MidiOut 0x94, 0x34, 0x00
 +  MidiOut 0x95, 0x34, 0x00
 +  MidiOut 0x96, 0x34, 0x00
 +  MidiOut 0x97, 0x34, 0x00
 +  
 +  
 +  // Turn on this button's light
 +  MidiOut 0x90 + ((destinationCueNumber - 1) % 8), 0x33 + isSecondRow, 0x7F // 33 = track row, 90 where 0 is first 
 +  light
 +  
 +  // Handle repeat press of same cue
 +  if (lastDestinationCueNumber = destinationCueNumber) Goto ToggleThisDestination
 +  
 +  destinationPlaying = 1 // Global. A new destination was clicked, so it's playing
 +  
 +  Goto FinishUp
 +  
 +  
 +  ToggleThisDestination:
 +  destinationPlaying = 1 - destinationPlaying // global
 +  if (destinationPlaying = 0) MidiOut 0x90 + ((destinationCueNumber - 1) % 8), 0x33 + isSecondRow, 0x00
 +  
 +  FinishUp:
 +  lastDestinationCueNumber = destinationCueNumber
 +
 +I like Groups mode, though it still has several bugs around destination/chase cues being brittle. I like the default assignment of zone destinations, and there seem to be many effects across zones that can only be accomplished with MultiFX. However, you cannot select destination cues from MIDI controllers. This is likely a temporary bug that will eventually be fixed, but I wanted to be able to select them from an APC40 mkii now. Since the Clip Stop and Channel Select rows are mapped to Zone Mute and Output by default, I reassigned those buttons to use this script, which also manages the LED state. Unfortunately it currently requires your page of destination cues to be the first page in your workspace, but there's likely some way around this limitation with more scripting.
  
 ---- ----
examples/pangoscript.1744905868.txt · Last modified: 2025/04/17 18:04 by Lyra Letournea