top of page
vyacheslavnikiforo9

Moog Matriarch 101 The Video Manual TUTORiAL



MIDI scripting allows native support for any MIDI controller. Scripts are written in 'Python' code, stored in a plain text file, that FL Studio uses to translate commands between the controller and FL Studio. MIDI communication can go in both directions; The controller can access features in the FL Studio code (as listed below), and FL Studio can send data back to the controller (such as lighting pads or showing track names).FL Studio MIDI scripts are based on Python. You do not need to install anything, FL Studio will handle scripts directly. When scripts are created in the folders shown below, the scripted device will display in the Controller type menu under the MIDI Settings tab. From there, select the controller and use it as normal.NOTES:Script hierarchy - As FL Studio natively handles many MIDI functions and messages, this allows you to write simple scripts to handle specific cases or inputs and leave the rest to FL Studio's generic MIDI support. For example, you do not need to tell FL Studio what to do with MIDI notes. If the script doesn't specifically make changes to default behavior, FL Studio will handle them as normal.Scripts are complex - With power and flexibility comes complexity. MIDI scripting is intended for hardware manufacturers and advanced users to create custom support for MIDI controllers. If you are new to programming, MIDI scripting will be confronting and confusing at first. This is normal, but patience and persistence will be rewarded! There are some simple examples to get started on our user forum listed below.Support ForumFL Studio customers can access the MIDI Controller Scripting forum to discuss scripting, share scripts, make feature requests and report issues.Script Locations and File NamesFL Studio will check the following locations for MIDI Scripts and related files:Script files - Scripted device files are located in the User data folder under ... Documents\Image-Line\FL Studio\Settings\Hardware\devicename\device_devicename.py.Script folder naming - The sub folder 'devicename' is arbitrary and can be anything you like. Normally you would use the name of the MIDI hardware you are scripting for.Script file naming - The 'device_devicename' (bold part) can be anything you like to identify the MIDI script file. NOTE: 'device_devicename.py' is mandatory for the device to be processed by FL Studio. You can use spaces and capitals for devicename e.g. 'device_My PHAT Controller.py'.The controller name - Shown in the MIDI Settings > Controller type menu is defined on first line of 'device_devicename.py' script file, e.g. #name=AKAI FL Studio Fire. This will appear in the device list as 'AKAI FL Studio Fire (user)'. The (user) suffix is to distinguish your device scripts from installed factory scripts.The controller name is required and your script will be not recognized by FL Studio without it!Editing .py script files - Use any text editor. If you are editing existing scripts, make a backup of the original files.Device (launchmap) pages (optional) - Files are located in ... Documents\Image-Line\FL Studio\Settings\Hardware\devicename\Page(number).scr. Device pages are special use-case and not normally used for standard MIDI controllers.Launchmap files - Launchmaps are custom files that provide different behavior for a controller depending on what mode it is launched in. See the MIDI Controller reference post Custom controller layouts. See also the launchMapPages module.Custom modules - You can include custom or external modules by placing them in the FL Studio installation, shared library folder:Windows - ... /Program Files (x86)/Image-Line/Shared/Python/LibmacOS - ... \Library\Application support\Image-line\Shared\Python\LibNOTE: You do not need to install the Python compiler to edit and maintain these scripts, you can open and edit .py files with any text editor. FL Studio MIDI scripting is based on events (Script events) fired by FL Studio and responses (Callbacks) to these events.Getting Started TutorialsThe basics of working with Script Files:To start from scratch, you need to create a script file, in the correct location in the FL Studio User data folder. This section and video shows you how to do that, step-by-step.Create a folder - Using the file browser in your Operating System of choice, browse to your FL Studio User data folder, usually '...Documents\Image-Line\FL Studio\Settings\Hardware\YourScriptSubFolder', where 'YourScriptSubFolder' is a sub folder you created for your script.Create a script file - In the 'YourScriptSubFolder' folder, create a plain text file 'device_YourScriptName.txt'. Open the text file and add the following line of text, which will be the script name that appears in the MIDI Settings > Controller type list: # name=My First ScriptNOTE: There's more information about predefined paramaters here.Change the file extension type to .py - Change the file extension type from .txt to .py. To do this you must have file-type extensions activated in the browser on your computer. After that, just rename a plain text file 'device_ThisIsMyFistScript.txt' to 'device_ThisIsMyFistScript.py', for example. You can also use the operating system options to open files of type .py in the text editor of your choice.Select your script in the MIDI Settings - You will now see your script in the MIDI Settings > Controller type list as My First Script (user).Edit the script - Open this script in FL Studio from the VIEW (menu) > Script output > Edit script (button)The following video shows steps 4 and 5 above.This video shows how to find MIDI data coming from a controller, to use in a script:After creating a script. You will probably want to identify data coming from your controller you want to link to a function in FL Studio, this video shows such an example.NOTE: For the Interpreter tab to work you must select a script from the MIDI Settings > Controller type option.The script used in this tutorial is available here.Script ModulesScript functions (callbacks) are the instructions FL Studio will recognize and act upon in the Python code. Callbacks are organized in modules according to FL Studio target features (Playlist, Patterns, Device etc.). To use callbacks in script, you must load the callback module by including it at the top of the script with 'import':import module (e.g. import playlist) - NOTE: Module names use Lower Camel Case. Available modules:playlistchannelsmixerpatternsarrangementuitransportdevicepluginsgenerallaunchMapPagesScript FunctionsCallbacks are functions that execute features or act on components in FL Studio. You can for example, use a callback function to name an instrument Channel, move a Channel up/down or delete it. Or, more simply remap the transport buttons in FL Studio to your controller. In other words, callbacks give you deep control over FL Studio and how it operates. To use function in script use following syntax:module.functionName(arguments) - Where 'module' is module name. NOTE: Function names use Lower Camel Case.Script EventsScript events are functions called by FL Studio, if script needs to respond to the event, add event function to script:def eventName(arguments) - Write response code inside this function. NOTE: Event names use Camel CaseScript predefined parametersScript 'predefined parameters' are a way to tell FL Studio some additional information about your script. Include predefined parameters at the top of main .py file. Predefines include:name (required) - The name of your script shown in the MIDI Settings > Controller type list.url (optional) - Image-Line MIDI Scripting forum link, where users can discuss or get help for your script. URLs must start with -line.com. For example, the link to the 'Working Scripts list' is -line.com/viewtopic.php?f=1994&t=228179. You can link to any post in the MIDI Scripting forum.receiveFrom (optional) - Specify the device name to receive MIDI events from. If specified, FL Studio will dispatch messages (sent via device.dispatch function) from the specified device.supportedDevices (optional) - Comma separated list of device names supported by your script. If specified, FL Studio will automatically link a script to devices matching names in this list.supportedHardwareIds (optional) - Comma separated list of device hardware id's supported by your script. If specified, FL Studio will automatically link the script to devices with same hardware ids. TIP: You can use partial hardware ID's to omit device firmware version numbers.Example:# name=My Launch Control script# url= -line.com/viewtopic.php?p=1494175#p1494175# supportedDevices=Launch Control XL,Launch Control XL mkII# receiveFrom=Forward Device# supportedHardwareIds=00 20 29 61 00 00 00 00 00 02 07Tools for Testing Functions and Editing ScriptsOpen the VIEW menu > Script output window:Interpreter - This Tab allows you to enter and test Script commands to check they work as expected.Script - When a MIDI Script is selected in the MIDI Settings the second tab will show with the name of the device (in this case FL STUDIO FIRE). When there are unhandled MIDI events, the data will be displayed here. NOTE: The Debugging log tab also shows ALL incoming MIDI data.NOTE: If your script loads and compiles correctly, you will see init ok, Initialization OK, in the Script window.Clear output - Clears the tabs data.Edit script - Open the current script in the system text editor to make changes.Reload - Apply the edited script so you don't need to restart FL Studio to test it.Script eventsNameArgumentsDocumentationVersionOnInit-Called when the script has been started.1OnDeInit-Called before the script will be stopped.1OnMidiIneventDataCalled first when a MIDI message is received. Set the event's handled property to True if you don't want further processing -(only raw data is included here: handled, timestamp, status, data1, data2, port, sysex, pmeflags)use this event for filtering, use OnMidiMsg event for actual processing ...1OnMidiMsgeventDataCalled for all MIDI messages that were not handled by OnMidiIn.1OnSysExeventDataCalled for note sysex messages that were not handled by OnMidiIn.1OnNoteOneventDataCalled for note on messages that were not handled by OnMidiMsg.1OnNoteOffeventDataCalled for note off messages that were not handled by OnMidiMsg.1OnControlChangeeventDataCalled for CC messages that were not handled by OnMidiMsg.1OnProgramChangeeventDataCalled for program change messages that were not handled by OnMidiMsg.1OnPitchBendeventDataCalled for pitch bend change messages that were not handled by OnMidiMsg.1OnKeyPressureeventDataCalled for key pressure messages that were not handled by OnMidiMsg.1OnChannelPressureeventDataCalled for channel pressure messages that were not handled by OnMidiMsg.1OnMidiOutMsgeventDataCalled for short MIDI out messages sent from MIDI Out plugin -(event properties are limited to: handled, status, data1, data2, port, midiId,midiChan, midiChanEx)1OnIdle-Called from time to time. Can be used to do some small tasks, mostly UI related.For example: update activity meters.1OnProjectLoadlong statusCalled when project is loaded16OnRefreshlong flagsCalled when something changed that the script might want to respond to.1OnDoFullRefresh-Same as OnRefresh, but everything should be updated.1OnUpdateBeatIndicatorlong valueCalled when the beat indicator has changes -"value" can be off = 0, bar = 1 (on), beat = 2 (on)1OnDisplayZone-Called when playlist zone changed1OnUpdateLiveModelong lastTrackCalled when something about performance mode has changed.1OnDirtyMixerTracklong indexCalled on mixer track(s) change, 'index' indicates track index of track that changed or -1 when all tracks changedcollect info about 'dirty' tracks here but do not handle track(s) refresh, wait for OnRefresh event with HW_Dirty_Mixer_Controls flag1OnDirtyChannellong index, long flagCalled on channel rack channel(s) change, 'index' indicates channel that changed or -1 when all channels changedcollect info about 'dirty' channels here but do not handle channels(s) refresh, wait for OnRefresh event with HW_ChannelEvent flag16OnFirstConnect-Called when device is connected for the first time (ever)17OnUpdateMeters-Called when peak meters needs to be updatedcall device.setHasMeters() in onInit to use this event!1OnWaitingForInput-Called when FL Studio is set in waiting mode1OnSendTempMsgstring message, long durationCalled when hint message (to be displayed on controller display) is sent to thecontrollerduration of message is in ms1Modules and functions




Moog Matriarch 101 The Video Manual TUTORiAL

2ff7e9595c


0 views0 comments

Recent Posts

See All

Comments


bottom of page