ShowCockpit Academy
  • 🏠Welcome
  • Getting Started
    • Installation
    • Elements
    • Mapping
  • Tutorials
    • 🧩Integration
      • Ableton Link to MA2
      • LTC Input to MA2 OnPC
      • REAPER Markers to Onyx Cues
      • Ableton Link to Onyx FX Speed
      • MIDI Device with Bitfocus Companion
    • 🎬Timecode
      • LTC to MTC
      • MTC to LTC
      • Static Time Offset
      • LTC Input from Dante
    • 🔄Protocol Conversion
      • OSC to MIDI
      • MIDI to OSC
      • Keyboard to MIDI
      • Joystick to MIDI
    • 💡Lighting
      • grandMA3 OnPC Hotkeys
      • MIDI device(s) with an MA3 Desk
      • Connecting to MA3 OnPC on the same PC
      • MIDI device(s) with MA2
      • MA2 Bi-directional Page Sync
      • MIDI device(s) with Chamsys MagicQ
      • Obsidian Onyx - Multiple OSC Devices
      • Obsidian Onyx Pre-Dylos vs. Dylos
      • MIDI device(s) with Obsidian Onyx
    • 🎥Video
      • Resolume Arena Timecode Clip Trigger
      • Controlling OBS with a MIDI device
      • Controlling vMix with MIDI Devices
    • 🎛️Generic MIDI Mapping
      • Encoders Tips
    • 🤓LUA Scripts
      • Get MA2 Speed Master BPM value
    • 🌐Networking
      • Loopback Network Adapter
      • Multiple IP Addresses on a NIC
  • FAQs
    • License FAQs
    • Registration FAQs
    • Drivers FAQs
Powered by GitBook
On this page

Was this helpful?

  1. Tutorials
  2. LUA Scripts

Get MA2 Speed Master BPM value

In some cases, it might be useful to get the BPM value of a Speed Master from an MA2 desk. One common use-case is to use the MA2 Speed Master as the global master for the remaining systems.

While there is no dedicated way to retrieve a BPM value from a Speed Master, you can retrieve the running "cue" name of an executor, which, for a Speed Master, is essentially the current BPM value.

Here's an example ShowCockpit LUA script:

-- Get 'GrandMA2' element
GrandMA2 = GetElement('GrandMA2')

-- Returns the name of the current cue
-- (in fact for speedmasters it shows the BPM value)
-- For example: "60.0 BPM"
v = GrandMA2.GetExecutorCurrentCue(1)

-- Remove the " BPM" part of the name
v = string.gsub(v, " BPM", "")

-- Convert to Number
v = tonumber(v)

-- Variable v contains the speedmaster BPM value as a number
print(v)

Because the GetExecutorCurrentCue function returns a string containing the units (for example, "60.0 BPM"), we need to remove that text part and then convert the string to a number.

PreviousLUA ScriptsNextNetworking

Last updated 1 year ago

Was this helpful?

🤓