Remotely control FL Studio using the MIDI Controller Scripting API
Project description
Flapi
Flapi (pron. "flappy") is a remote control server for FL Studio, using the MIDI Controller Scripting API. It allows you to execute Python code in FL Studio from outside of FL Studio by modifying functions in the FL Studio API Stubs package to forward their calling information to the Flapi server, where they are executed, with their values returned to the client.
$ flapi
>>> import ui
>>> ui.setHintMsg("Hello from Flapi!")
# Hint message "Hello from Flapi!" is displayed in FL Studio
Setup
-
Install the Flapi library using Pip, or any package manager of your choice.
pip install flapi
-
Install the Flapi server to FL Studio by running
flapi install
. If you have changed your FL Studio user data folder, you will need to enter it. -
On Windows, install a virtual MIDI loopback tool such as loopMIDI and use it to create two virtual MIDI ports, named
Flapi Request
andFlapi Response
. On MacOS, Flapi is able to create these MIDI ports automatically, so this step is not required. -
Start or restart FL Studio. The server should be loaded automatically, but if not, you may need to set it up in FL Studio's MIDI settings. To do this, set each MIDI port to have a unique port number in the outputs section, configure the input ports to match the port numbers of their corresponding output ports, then assign the "Flapi Request" port to the "Flapi Request" script and the "Flapi Response" port to the "Flapi Response" script.
Usage
As a library
import flapi
# Enable flapi
flapi.enable()
# Now all calls to functions in FL Studio's MIDI Controller Scripting API will
# be forwarded to FL Studio to be executed.
As a REPL
$ flapi
>>> import transport
>>> transport.start()
# FL Studio starts playback
>>> transport.stop()
# FL Studio stops playback
Server-side execution
Flapi also supports a bare-bones server-side REPL, where all input is executed within FL Studio (as opposed to forwarding function data).
$ flapi -s server
>>> import sys
>>> sys.version
'3.12.1 (tags/v3.12.1:2305ca5, Dec 7 2023, 22:03:25) [MSC v.1937 64 bit (AMD64)]'
# It's running inside FL Studio!
>>> print("Hello")
Hello
# Stdout is redirected back to the client too!
Credits
This concept was originally created by dimentorium and is available on GitHub at dimentorium/Flappy. I have adapted their code to improve its usability, and make it easier to install.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file flapi-1.0.1.tar.gz
.
File metadata
- Download URL: flapi-1.0.1.tar.gz
- Upload date:
- Size: 21.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.9.19 Linux/6.5.0-1017-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd2e081a5b7cd3615e4335bc769f7ac85cf3b7bf3f6159971416725e6fdbc0ee |
|
MD5 | f6212d344055daeaa410819051172803 |
|
BLAKE2b-256 | aef1e165bb4b05ab52816e5797e81a6b8e77dd3ace119d6bc8c9501179127ba9 |
File details
Details for the file flapi-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: flapi-1.0.1-py3-none-any.whl
- Upload date:
- Size: 27.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.9.19 Linux/6.5.0-1017-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b998b03b2179301dfbdf13025757dd358748438728b9b6b09882259e1f83dbdb |
|
MD5 | c48c8ab902c03cdaad65697a60c6945b |
|
BLAKE2b-256 | 9ee562eb1a4339e630df7a0aee617b836d192b51cbcf09c454d0669dc23c9be5 |