> For the complete documentation index, see [llms.txt](https://academy.showcockpit.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://academy.showcockpit.com/showcockpit-for-windows/tutorials/lua-scripts/get-ma2-speed-master-bpm-value.md).

# 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.&#x20;

Here's an example ShowCockpit LUA script:

```lua
-- 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.
