Skip to content

v0.0.7 How to create patches for the plugin

Pierre Guillot edited this page Jan 8, 2018 · 1 revision

Sending and receiving data

The Camomile plugin is a bridge between a Pure Data patch and the DAW. This connection implies to define a system to exchange information. There are three kind of information that can be exchanged:

  • audio signal
  • MIDI events
  • parameters values
Audio Signal

The audio signal can be sent by the plugin to the patch and the patch can transform or generate audio signal that will be sent to the plugin. Like for a top-level patch, use the adc~ object to receive audio signal and the dac~ object to send signal. The maximum number of input and output signal is 16.

adcdac

MIDI Events

All the standard midi objects of Pure Data should work in the plugin. You can send MIDI events to the plugin and receive the MIDI events from the plugin.

midi

You can also receive informations about the track and the playhead using a receive object with the symbol $0-receive. The first message is a list of 3 elements defined by "playing (symbol), state (float - 0 or 1), time of the playhead in ms (float)". The second message is a list of 6 elements defined by "measure (symbol), beats per minute (float), time signature numerator (float), time signature denominator (float), the position of the play head in pulses per quarter note (float), the position of the last bar in pulses per quarter note (float)".

playhead

Parameters

The parameters are the type of data used in a plugin to save the states or to create automations.

automation

To add a parameter to the plugin, you must first create a GUI (like a toggle, a slider, a radio or a numbox) in the top-level patch (and only in the top-level patch) that will be used as a link between Pure Data and the DAW. At the loading, the plugin looks for the GUIs in the top-level patch but not all the GUIs are interpreted as parameters.

toplevelgui

To notify the plugin how to link the GUI to a parameter, you must add a receive symbol to the GUI. The value of the parameter will be sent by the plugin via its receive symbol. You can also use this receive symbol somewhere else if you want to use a GUI as an alias of this parameter or if you want to avoid chord connections (see below for further explanation). To avoid conflicts between several instances of the plugin, you must always use $0 in the receive symbol. This rule is not only valid for parameters but also for all the send and receive symbol of the patches (see the FAQ for further information).

receivesymbol

The last step to activate the GUI as a parameter is to define its label. In a DAW, the parameters have a name and a label. The name describes the function of a parameter (for example: frequency, depth, etc.) and the label describes the unit of the parameter (for example: Hz, ms, %, etc.). In Pure Data the GUIs have no name, only a label so the plugin splits the GUI label into the parameter name and the parameter label. For example, if you want a parameter “Frequency” with a label “Hz”, you should define the GUI label as “Frequency_Hz” (the spaces are not allowed in Pure Data so the GUI replace it by an underscore). You can’t have two parameters with the same name, this will generate an error in the Camomile console. If you want to use a more complex name than a single word, you must use a hyphen like “Phaser-Frequency_Hz” for example.

label

The minimum and maximum values of GUIs (numbox and slider) defines the values range of the parameters.

In a plugin, the parameters are strictly organized depending on an index. The first GUI created in Pure Data will be the first parameter in the list of the plugin and the last GUI created will be the last parameter. So, you must always ensure that you created the parameters in the right order. If for any reason, you want to insert a parameter between two other, you must recreate (cut and copy) the GUIs that match with the parameters that should come after in the list. Be careful! The automations and saved states of the parameters in the DAW depend on the indices of the parameters so if you insert a parameter in you list, all the automations will be broken.

Creating the plugin interface

As explained before, the plugin considers only the top-level patch. You should use the graph-on-parent option and define its visible area to notify the plugin which part of the patch should be visible.

area

To display a parameter in the plugin interface, you only have to put it in the visible area.

area2

You can also use comments to give more informations about the pacth and how to use it.

comments

Finally, sometimes you would like to have an GUI that acts as an alias of the real GUI parameter. For example, you use a slider to create a parameter but you also want to use a numbox to control and to display its value. You simply need to create a numbox and to define the same receive symbol as for the slider. In the graphical interface of the plugin, when you'll change the value of numbox by typing or dragging its value, the value of the parameter will automatically changed and will update the display of the other GUI.

alias

Here another example of what you can do:

example For other informations, you can have a look at the FAQ.