MaddyGuthridge / Flapi

Remotely control FL Studio using the MIDI Controller Scripting API
MIT License
7 stars 0 forks source link

Thank you for Flapi and request for guidance #17

Open LL1yt opened 1 month ago

LL1yt commented 1 month ago

Dear Flapi developers,

First and foremost, I want to express my sincere gratitude for developing Flapi. This library has the potential to greatly enhance workflow automation in FL Studio, and I'm excited about its possibilities.

I'm working on a project to automate the creation of tracks in FL Studio based on a JSON structure. However, I've encountered some difficulties as I'm not sure about the correct way to use Flapi for this purpose. My current approach seems to be incorrect, as I've noticed that Flapi doesn't have transport, channels, plugins, patterns, or playlist modules that I initially assumed it would have.

from flapi import transport, channels, plugins, patterns, playlist
import json

def create_track_from_json(json_data):
    data = json.loads(json_data)

    transport.set_bpm(data["tempo"])

Could you please provide some guidance on how to properly use Flapi to achieve the following tasks:

  1. Setting the project tempo
  2. Creating new channels
  3. Adding instruments (plugins) to channels
  4. Creating patterns and adding notes to them
  5. Adding patterns to the playlist
  6. Setting plugin parameters
  7. Adding and configuring effects

Here's a snippet of the JSON structure I'm working with:

{
    "tempo": 140,
    "channels": [
        {
            "name": "Kick",
            "instrument": "FPC",
            "patterns": [
                {
                    "name": "Main Kick",
                    "notes": [
                        {"time": 0, "note": 36, "duration": 0.25, "velocity": 100},
                        {"time": 1, "note": 36, "duration": 0.25, "velocity": 100}
                    ]
                }
            ],
            "effects": [
                {"name": "Fruity Compressor", "settings": {"threshold": -6, "ratio": 4}}
            ]
        }
    ]
}

Any examples or explanations of the correct Flapi usage for these tasks would be immensely helpful. I'm eager to learn and make the most of this fantastic library.

Thank you again for your hard work on Flapi, and I look forward to your guidance.

PS and yes, LLM helped me in writing this)

MaddyGuthridge commented 1 month ago

Hey! Unfortunately, Flapi is currently undergoing a pretty significant rewrite to address some major stability issues on Windows, so for the time being it's not very reliable on anything other than MacOS.

In terms of your feature requests, Flapi is unfortunately limited by FL Studio's Python API capabilities. Here are the things you should be able to do:

The things that currently aren't possible are:

All of these features have been requested to Image-Line, so hopefully they will become possible in the future. For the time being, here is the documentation for FL Studio's Python API, which is what you would want to look at for how to do all of the above features.

MaddyGuthridge commented 1 month ago

As for the error that you're getting, my guess is this is to do with LLM hallucinations -- FL Studio's MIDI Controller Scripting API is comparatively new, so many LLMs don't know much about how to use it, and so hallucinate things even more than usual.

If the modules are failing to import, that could be due to a recent issue with the FL Studio API Stubs library where the modules weren't being distributed correctly. Perhaps try upgrading that dependency (pip install --upgrade fl-studio-api-stubs) and see if it helps :)

francisgabrieljoseph commented 1 month ago

I never did manage to get this to run on OSX, or scripting in general. I just assumed support was only catered to Windows.

LL1yt commented 1 month ago

Thank you very much for clarifying these points. If the API were more widely implemented, then my experience of creating music would have changed dramatically with the support of LLM. But apparently we’ll have to wait for major players and capital to get down to business