Generate a matrix using code

Just as it is possible to generate ReaLearn mappings via Luau, you can also generate a Playtime Matrix via Luau.

This guide is a work in progress
The matrix generated by this example Matrix is viewable, but not yet playable! It will be improved in the future to be playable as well.

Proceed like this:

  1. Copy below Luau code to the clipboard

  2. Press the Show Helgobox plug-in show helgobox plugin icon in the navigation bar on the left.

  3. Press Import from clipboard button.

  4. After confirming the import, you should see a large and wildly colorful matrix.

Colorful matrix
local column_count = 10
local row_count = 200

-- Clip source

-- Build columns
local columns = {}
local clip_index = 0
for c = 0, column_count - 1 do
    local slots = {}
    for r = 0, row_count - 1 do
        if (c % 2 == 0 and r % 2 == 0) or (c % 2 == 1 and r % 2 == 1) then
            local slot = {
                row = r,
                clips = {
                    {
                        name = `Clip {c + 1}/{r + 1}`,
                        color = {
                            kind = "PaletteColor",
                            index = 5 + clip_index % 17,
                        },
                        source = {
                            kind = "MidiChunk",
                            chunk = [[
HASDATA 1 960 QN
E 3840 b0 7b 00 0
IGNTEMPO 1 120 4 4
]],
}
                    },
                },
            }
            table.insert(slots, slot)
            clip_index += 1
        end
    end
    local column = {
        slots = slots or nil,
    }
    table.insert(columns, column)
end

-- Build rows
local rows = {}
for r = 1, row_count do
    local row = {
        name = `Scene {r}`,
    }
    table.insert(rows, row)
end

-- Build matrix
local matrix = {
    columns = columns,
    rows = rows,
}

-- Return result
return {
    kind = "ClipMatrix",
    version = "2.16.15",
    value = matrix,
}