Code Monkey home page Code Monkey logo

tuneflow-py's Introduction

TuneFlow Python SDK

TuneFlow Screenshots

Build Status Code Coverage PyPI Discord License

What is TuneFlow and tuneflow-py?

TuneFlow is a next-gen DAW that aims to boost music making productivity through the power of AI. Unlike traditional DAWs, TuneFlow has a plugin system designed to facilitate music production in almost all areas, including but not limited to song writing, arrangement, automation, mixing, transcription...... You can easily write your own algorithms or integrate your AI models directly into the song-making process. tuneflow-py is the Python SDK of TuneFlow plugins.

Installation

pip install tuneflow-py

Prefer another language?

Check out the SDKs in other languages:

Getting started

The core idea of TuneFlow's plugin system is that you only care about the data model, NOT the implementation. A plugin's only goal is to modify the song, and the DAW will get the modified result and apply changes automatically. Below is an illustration:

Plugin Flow

A python plugin bundle consists of 2 components: The bundle file and the plugin files.

Bundle file (bundle.json)

The bundle file, which we usually name it bundle.json, contains the information of the plugins in this bundle. The information here will be shown to the users before they need to load the code of your plugin.

An example manifest file looks like this.

{
  "plugins": [
    ......,
    {
      "providerId": "my-provider-id",
      "providerDisplayName": "My Provider Name",
      "pluginId": "my-plugin-id",
      "pluginDisplayName": "My Plugin Name",
      "version": "1.0.0",
      "minRequiredDesktopVersion": "1.8.3",
      "options": {
        "allowReset": false
      }
    },
    ......
  ]
}

Plugin code (plugin.py)

Under the plugin's root folder we need to create a plugin.py file, which is where we define the plugin code. You can put other source code under the same folder, too. When TuneFlow runs the plugin, it adds the plugin's root folder to the PYTHONPATH.

A barebone python plugin may look like this:

from tuneflow_py import TuneflowPlugin, Song, ParamDescriptor


class HelloWorld(TuneflowPlugin):
    @staticmethod
    def provider_id():
        return "andantei"

    @staticmethod
    def plugin_id():
        return "hello-world"

    @staticmethod
    def params(song: Song) -> dict[str, ParamDescriptor]:
        return {}

    @staticmethod
    def run(song: Song, params: dict[str, Any]):
        print("Hello World!")

Note: All methods here are static methods. This is by design: The entire plugin should be stateless -- the outcome of one plugin execution is only determined by the input and NOT by any internal states of the plugin itself.

When writing a plugin, our main focus is in params and run.

params

This is where you specify the input parameters you want from the user or from the DAW. It will be processed by the DAW and generate your plugin's UI widgets.

You can optionally use song to get some additional information about the project's current snapshot, so that you can customize your params. For example, if you have a list of presets that applies to different time signatures, you can use init to read the current song's time signature and filter out those options that don't work for the song.

run

Called by the DAW when the user actually runs the plugin by hitting the Apply` button.

Here is where you implement your main logic. The method takes in the current song snapshot (song: Song), the params that are actually provided by the user or the DAW (params).

Run your plugin

To debug and run your plugin locally, you can use tuneflow-devkit-py. For more documentation, visit: https://github.com/tuneflow/tuneflow-devkit-py

Examples

For a comprehensive of example plugins, check out https://www.github.com/tuneflow/tuneflow-py-demos

Contribute

Checkout contribution guidelines.

Resources

TuneFlow Website

Typescript SDK

tuneflow-py's People

Contributors

andantei avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.