π Handbook#
This page contains some ideas on how one can use PyFLP for automating tasks (to a certain extent) which can only be done via FL Studio.
A basic-to-intermediate level of Python knowledge is assumed. No prior knowledge of PyFLP is required for any of the sections below.
These all are written from a devβs POV. I would β₯ to get more ideas and hear about different use cases.
π¦ Exporting to a ZIP#
Imagine you had a folder structure like this:
π Samples
ββββ π₯ kick.wav
ββββ π clap.wav
ββββ π΅ toms.wav
π MyGreatSong.flp
For the purpose of simplicity, assume that ``π MyGreatSong.flp`` uses only
the samples from ``π Samples`` and all **sample file names are unique**.
The code below will create a ZIP containing all the samples used
from zipfile import ZipFile
import pyflp
project = pyflp.parse("MyGreatSong.flp")
with ZipFile("MyGreatSong.zip", "x") as zp:
zp.write("MyGreatSong.flp")
for sampler in project.channels.samplers:
if sampler.sample_path is not None:
zp.write(sampler.sample_path)
Caution
Missing samples
The above code assumes that all the samples exist at the paths the FLP has stored. If any of the samples arenβt found, there will be an error.
FL Studio doesnβt give up this easily. It searches up a lot of paths, including but not limited to the recursive scanning of folders which are:
Current directory.
Added to the sample browser.
Containing previous samples / missing samples.
This will create a ZIP file of the structure:
π¦ MyGreatSong.zip
ββββ π MyGreatSong.flp
ββββ π₯ kick.wav
ββββ π clap.wav
ββββ π΅ toms.wav
Hint
FL Studio stock samples
While this will work for 3rd party samples unless thereβs 2 samples with
the same name, FL Studio doesnβt store the full path inside an FLP for
stock samples. See pyflp.channel.Sampler.sample_path
for more info.
π Unlocking demo version FLPs#
FLPs saved with a trial version of FL Studio cannot be reopened again without saving in a registered version. The state of demo versions of native pluginsβ is not retained either.
Hint
This section doesnβt explain how to make 3rd party plugin demos recall their state. They have their own mechanisms for doing that.
It is possible to undo both of these:
See also
import pyflp
project = pyflp.parse("/path/to/myflp.flp")
# Unlock the FLP itself
project.registered = True
# Unlock trial version native plugins
for instument in project.channels.instruments:
instrument.demo_mode = False
for insert in project.mixer:
for slot in insert:
if slot.plugin is not None:
slot.plugin.demo_mode = False
pyflp.save(project, "/path/to/myflp_unlocked.flp")
Note
An unregistered version of FL Studio will roll back these changes once you save an FLP in it (even previously registered ones), so you need to repeat this process everytime.