Skip to content

General

General

FL Studio built-in module.

Handles general interactions with FL Studio.

clearLog()

Clear the score log.

Included since API version 15.

dumpScoreLog(time, silent=False)

Write recently played MIDI to the selected pattern.

Args

  • time (int): The duration of time to write, from time seconds before the last note played, to the last note.

  • silent (int): Whether the empty score message is suppressed (True) or not (False).

Included since API version 15.

getChangedFlag()

Returns whether a project has been changed since the last save.

Returns

  • int: changed flag:

    • 0: Unchanged since last save.

    • 1: Changed since last save.

    • 2: Changed since last save, but unchanged since last auto-save.

Included since API version 1.

getPrecount()

Returns whether precount before recording is enabled.

Returns

  • bool: precount before recording.

Included since API version 1.

getRecPPB()

Returns the current timebase (PPQN) multiplied by the number of beats in a bar.

Note

  • This DOES NOT respect time signature markers in the playlist.

Returns

  • int: timebase * numerator.

Included since API version 1.

getRecPPQ()

Returns the current timebase (PPQN), which represents the number of ticks per quarter note.

Returns

  • int: timebase.

Included since API version 8.

getUndoHistoryCount()

Returns the total number of items that have ever been added to the undo history including items that have been trimmed by setUndoHistoryPos(), but not items that have been trimmed by setUndoHistoryCount().

Returns

  • int: number of elements in undo history.

Included since API version 1.

getUndoHistoryLast()

Returns the current position in the undo history. The most recent position is 0, with earlier points in the history having higher indexes.

Returns

  • int: position in undo history.

Included since API version 1.

getUndoHistoryPos()

Returns the length of the undo history.

HELP WANTED

  • This seems to behave the same as getUndoHistoryCount(). What's the difference?

Returns

  • int: number of elements in undo history.

Included since API version 1.

getUndoLevelHint()

Returns a fraction-like string that shows the position in the undo history as well as the total length of it.

Returns

  • str: fraction-like string:

    • numerator: position in history (1 is most recent).

    • denominator: number of elements in history.

Included since API version 1.

getUseMetronome()

Returns whether the metronome is active.

Returns

  • bool: metronome enabled.

Included since API version 1.

getVersion()

Returns MIDI Scripting API version number. Note that this is the API version, rather than the FL Studio version.

To get the version of FL Studio, use ui.getVersion() instead.

Returns

  • int: version number

Included since API version 1.

processRECEvent(eventId, value, flags)

Processes a REC event, usually changing an automatable value.

Try to achieve your task with other API functions first!

This part of FL's scripting API is incomplete, poorly documented, and filled with hidden bugs. REC events expose more controls inside FL Studio, while being much more confusing than other parts of the API.

"REC events" represent every automatable control in FL studio. Each "REC" is identified with a unique integer, "event ID". FL Studio reserves a range of event IDs for each channel, mixer track, plugin, and so on.

REC events have some other properties available:

HELP WANTED

  • More information from Image-Line? More details on what flags can do?

Args

  • eventId (int): Refer to the FL Studio manual.

  • value (int): value of even within a range. This range depends on the plugin, but you can specify for it to be between 0 - 2^30 by using the midi.REC_MIDIController flag. Note that providing an invalid value can lead to very strange behavior and sometimes crashes.

  • flags (int): Refer to the FL Studio manual.

Returns

  • int: Unknown.

Included since API version 7.

restoreUndo()

Undo-redo toggle. This behaves in the same way as undo().

Returns:

  • int: ?

Included since API version 1.

Deprecated since API version 1.

restoreUndoLevel(level)

Undo-redo toggle. This behaves in the same way as undo().

Args:

  • level (int): this parameter is ignored.

Returns:

  • int: ?

Included since API version 1.

safeToEdit()

Returns whether it is currently safe to perform edit operations in FL Studio.

Returns

  • bool: whether it is safe to edit.

Included since API Version 29.

saveUndo(undoName, flags, update=True)

Save an undo point into FL Studio's history.

Args

  • undoName (str): a descriptive name for the undo point.

  • flags (int): Any combination of the following flags, combined using the logical or (|) operator:

    • UF_None (0): No flags

    • UF_EE (1): Changes in event editor

    • UF_PR (2): Changes in piano roll

    • UF_PL (4): Changes in playlist

    • UF_KNOB (32): Changes to an automated control

    • UF_AudioRec (256): Audio recording

    • UF_AutoClip (512): Automation clip

    • UF_PRMarker (1024): Piano roll (pattern) marker

    • UF_PLMarker (2048): Playlist marker

    • UF_Plugin (4096): Plugin

    • UF_SSLooping (8192): Step sequencer looping

    • UF_Reset (65536): Reset undo history

  • update (int, optional): ???. Defaults to 1.

Included since API version 1.

setUndoHistoryCount(value)

Removes old elements from the undo history, leaving only the latest n = index elements.

This will affect the length of the undo history as per getUndoHistoryCount(), but not affect it as per getUndoHistoryPos().

Known issues

  • The browser will not refresh when this action.

Args

  • value (int): number of elements to leave at the end of the history.

Included since API version 1.

setUndoHistoryLast(index)

Sets the position in the undo history, where index = 0 is the most recent element and earlier points have higher indexes.

Args

  • index (int): new position in undo history.

Included since API version 1.

setUndoHistoryPos(index)

Removes recent elements from the undo history, leaving only the earliest n = index elements in the history.

This will affect the length of the undo history as per getUndoHistoryPos(), but not affect it as per getUndoHistoryCount().

This will not actually undo the actions, just remove them from the undo history. It could be useful for grouping multiple undo items into one.

Known issues

  • The browser will not refresh when this action is performed, meaning the UI may not be updated.

Args

  • index (int): number of elements to leave at the start of the history.

Included since API version 1.

undo()

Perform an undo toggle, much like pressing Ctrl+Z. If the position in the undo history is at the most recent, it will undo, otherwise, it will redo.

Returns

  • int: ???

Included since API version 1.

undoDown()

Move down in the undo history. This is much like redo in most programs.

Note that in FL Studio 21, the ordering of the undo history was changed, so visually this actually moves up.

Returns:

  • int: ?

Included since API version 1.

undoUp()

Move up in the undo history. This is much like undo in most programs.

Note that in FL Studio 21, the ordering of the undo history was changed, so visually this actually moves down.

Returns:

  • int: ?

Included since API version 1

undoUpDown(value)

Move in the undo history by delta value.

Args:

  • value (int): amount to undo or redo (positive is redo, negative is undo).

Returns:

  • int: ?

Included since API version 1.