Skip to main content

Loop

The music loop interface

Loop.id = "wind"
Loop.volume = 0.5

Properties

id

Loop.id: string

Get/Set the loop by identifier (e.g. "wind")

volume

Loop.volume: number

Get/Set the loop volume in range [0, 1]

offset

Loop.offset: number

Get/Set the music offset (s)

elapsed

Loop.elapsed: number

Get/Set the elapsed loop time (s)

chars_count

Loop.chars_count: number

Get the total character count of the loop

chars_per_beat

Loop.chars_per_beat: number

Get the amount of characters in a beat

chars_delta

Loop.chars_delta: number

Get the time duration of a character

beats_count

Loop.beats_count: number

Get the total beat count of the loop

beats_per_measure

Loop.beats_per_measure: number

Get the amount of beats in a measure

beats_per_minute

Loop.beats_per_minute: number

Get the amount of beats in a minute

beats_elapsed

Loop.beats_elapsed: number

Get the amount of currently elapsed beats

beats_delta

Loop.beats_delta: number

Get the time duration of a beat

measures_count

Loop.measures_count: number

Get the total amount of measures in the loop

measures_elapsed

Loop.measures_elapsed: number

Get the amount of currently elapsed measures

measures_delta

Loop.measures_delta: number

Get the time duration of a measure

loops_elapsed

Loop.loops_elapsed: number

Get the amount of currently elapsed loops

loops_delta

Loop.loops_delta: number

Get the duration of a loop

Functions

set

Loop.set(
idstring,--

loop identifier

optionstable--

settings

) → ()

Sets the current loop

Options

Name Type Default Description
volume number 1 audio volume

Start music silent

Loop.set("wind_kick", { volume = 0.0 })

stop

Loop.stop() → ()

Stops the current loop

skip

Loop.skip() → ()

Skips the current loop

preload

Loop.preload(
idstring--

identifier string

) → ()

Loads the music file into cache

beats_wait

Loop.beats_wait(
targetnumber--

beats elapsed

) → ()

Sleeps until the specified target

measures_wait

Loop.measures_wait(
targetnumber--

measures elapsed

) → ()

Sleeps until the specified target

Show raw api
{
    "functions": [
        {
            "name": "set",
            "desc": "Sets the current loop\n\n### Options\n| Name            | Type        | Default | Description                    |\n|-----------------|-------------|---------|--------------------------------|\n| volume          | number      |       1 | audio volume                   |\n\n### Start music silent\n```lua\nLoop.set(\"wind_kick\", { volume = 0.0 })\n```",
            "params": [
                {
                    "name": "id",
                    "desc": "loop identifier",
                    "lua_type": "string"
                },
                {
                    "name": "options",
                    "desc": "settings",
                    "lua_type": "table"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 35,
                "path": "../../res/data/script/lib/system/loop.lua"
            }
        },
        {
            "name": "stop",
            "desc": "Stops the current loop",
            "params": [],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 42,
                "path": "../../res/data/script/lib/system/loop.lua"
            }
        },
        {
            "name": "skip",
            "desc": "Skips the current loop",
            "params": [],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 48,
                "path": "../../res/data/script/lib/system/loop.lua"
            }
        },
        {
            "name": "preload",
            "desc": "Loads the music file into cache",
            "params": [
                {
                    "name": "id",
                    "desc": "identifier string",
                    "lua_type": "string"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 55,
                "path": "../../res/data/script/lib/system/loop.lua"
            }
        },
        {
            "name": "beats_wait",
            "desc": "Sleeps until the specified target",
            "params": [
                {
                    "name": "target",
                    "desc": "beats elapsed",
                    "lua_type": "number"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 140,
                "path": "../../res/data/script/lib/system/loop.lua"
            }
        },
        {
            "name": "measures_wait",
            "desc": "Sleeps until the specified target",
            "params": [
                {
                    "name": "target",
                    "desc": "measures elapsed",
                    "lua_type": "number"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 169,
                "path": "../../res/data/script/lib/system/loop.lua"
            }
        }
    ],
    "properties": [
        {
            "name": "id",
            "desc": "Get/Set the loop by identifier (e.g. \"wind\")",
            "lua_type": "string",
            "source": {
                "line": 18,
                "path": "../../res/data/script/lib/system/loop.lua"
            }
        },
        {
            "name": "volume",
            "desc": "Get/Set the loop volume in range [0, 1]",
            "lua_type": "number",
            "source": {
                "line": 64,
                "path": "../../res/data/script/lib/system/loop.lua"
            }
        },
        {
            "name": "offset",
            "desc": "Get/Set the music offset (s)",
            "lua_type": "number",
            "source": {
                "line": 71,
                "path": "../../res/data/script/lib/system/loop.lua"
            }
        },
        {
            "name": "elapsed",
            "desc": "Get/Set the elapsed loop time (s)",
            "lua_type": "number",
            "source": {
                "line": 78,
                "path": "../../res/data/script/lib/system/loop.lua"
            }
        },
        {
            "name": "chars_count",
            "desc": "Get the total character count of the loop",
            "lua_type": "number",
            "source": {
                "line": 85,
                "path": "../../res/data/script/lib/system/loop.lua"
            }
        },
        {
            "name": "chars_per_beat",
            "desc": "Get the amount of characters in a beat",
            "lua_type": "number",
            "source": {
                "line": 92,
                "path": "../../res/data/script/lib/system/loop.lua"
            }
        },
        {
            "name": "chars_delta",
            "desc": "Get the time duration of a character",
            "lua_type": "number",
            "source": {
                "line": 99,
                "path": "../../res/data/script/lib/system/loop.lua"
            }
        },
        {
            "name": "beats_count",
            "desc": "Get the total beat count of the loop",
            "lua_type": "number",
            "source": {
                "line": 106,
                "path": "../../res/data/script/lib/system/loop.lua"
            }
        },
        {
            "name": "beats_per_measure",
            "desc": "Get the amount of beats in a measure",
            "lua_type": "number",
            "source": {
                "line": 113,
                "path": "../../res/data/script/lib/system/loop.lua"
            }
        },
        {
            "name": "beats_per_minute",
            "desc": "Get the amount of beats in a minute",
            "lua_type": "number",
            "source": {
                "line": 120,
                "path": "../../res/data/script/lib/system/loop.lua"
            }
        },
        {
            "name": "beats_elapsed",
            "desc": "Get the amount of currently elapsed beats",
            "lua_type": "number",
            "source": {
                "line": 127,
                "path": "../../res/data/script/lib/system/loop.lua"
            }
        },
        {
            "name": "beats_delta",
            "desc": "Get the time duration of a beat",
            "lua_type": "number",
            "source": {
                "line": 134,
                "path": "../../res/data/script/lib/system/loop.lua"
            }
        },
        {
            "name": "measures_count",
            "desc": "Get the total amount of measures in the loop",
            "lua_type": "number",
            "source": {
                "line": 149,
                "path": "../../res/data/script/lib/system/loop.lua"
            }
        },
        {
            "name": "measures_elapsed",
            "desc": "Get the amount of currently elapsed measures",
            "lua_type": "number",
            "source": {
                "line": 156,
                "path": "../../res/data/script/lib/system/loop.lua"
            }
        },
        {
            "name": "measures_delta",
            "desc": "Get the time duration of a measure",
            "lua_type": "number",
            "source": {
                "line": 163,
                "path": "../../res/data/script/lib/system/loop.lua"
            }
        },
        {
            "name": "loops_elapsed",
            "desc": "Get the amount of currently elapsed loops",
            "lua_type": "number",
            "source": {
                "line": 178,
                "path": "../../res/data/script/lib/system/loop.lua"
            }
        },
        {
            "name": "loops_delta",
            "desc": "Get the duration of a loop",
            "lua_type": "number",
            "source": {
                "line": 185,
                "path": "../../res/data/script/lib/system/loop.lua"
            }
        }
    ],
    "types": [],
    "name": "Loop",
    "desc": "The music loop interface\n\n```lua\nLoop.id = \"wind\"\nLoop.volume = 0.5\n```",
    "source": {
        "line": 10,
        "path": "../../res/data/script/lib/system/loop.lua"
    }
}