project_write
Generates an FL Studio project file from a project document, replacing any file at the given path. Optionally opens it in FL Studio for playback.
Instructions
Write a project document to an .flp file, replacing any file at path. This is how a piece gets made.
The document: the compact form project_read returns, or its full form. The field reference is README.md, 'Project JSON, compact form'; examples/README.md has a working document per feature. Read one before a first write.
Sounds:
an instrument is a plugin by name (see plugins) with an optional preset, or a channel copied from a saved project, state {from: file, channel: n};
an effect is mixer.effects {track, slot, plugin} or one copied, {track, slot, from: {file, track, slot}}.
Units that are easy to get wrong: 96 ticks per beat, 4/4; keys like 'D#4' with MIDI 60 = C4; mixer volume 0.8 = 0 dB; a tempo automation value is (bpm - 60) / 120.
Without open, FL need not run. With open or play, FL first saves the project it has open (so no dialog appears), then opens this one.
Returns the file read back (channels, notes per pattern, clips per arrangement) and the writer's warnings; read them.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| doc | Yes | the project document, compact or full | |
| open | No | open it in FL afterwards, launching FL if needed | |
| path | Yes | the .flp to write, absolute or relative to the repo; pieces go to projects/music/<piece>.flp | |
| play | No | 'song' or 'pattern': open it and start playback |