PedalPi - PluginsManager - Models

This page contains the model classes.

digraph classes {
     graph [rankdir=BT];

     node [shape=rect, style=filled, color="#298029", fontname=Sans, fontcolor="#ffffff", fontsize=10];

     Pedalboard->Bank [
         dir="forward", arrowhead="odiamond", arrowtail="normal"
     ];
     Effect->Pedalboard [
         dir="forward", arrowhead="odiamond", arrowtail="normal"
     ];
     Param->Effect [
         dir="backward", arrowhead="diamond", arrowtail="normal"
     ];
     Connection->Pedalboard [
         dir="forward", arrowhead="odiamond", arrowtail="normal"
     ];
     Input->Effect [
         dir="backward", arrowhead="diamond", arrowtail="normal"
     ];
     Output->Effect [
        dir="backward", arrowhead="diamond", arrowtail="normal"
     ];

     Input->Connection [
         dir="backward", arrowhead="odiamond", arrowtail="normal"
     ];
     Output->Connection [
         dir="backward", arrowhead="odiamond", arrowtail="normal"
     ];
} digraph classes {
    graph [rankdir=BT];
    node [shape=rect, style=filled, color="#298029", fontname=Sans, fontcolor="#ffffff", fontsize=10];

    AudioPort->Port;

    Input->AudioPort;
    Output->AudioPort;

    MidiPort->Port;
    MidiInput->MidiPort;
    MidiOutput->MidiPort;

    Lv2Input->Input;
    Lv2Output->Output;
    Lv2MidiInput->MidiInput;
    Lv2MidiOutput->MidiOutput;

    SystemInput->Input;
    SystemOutput->Output;
    SystemMidiInput->MidiInput;
    SystemMidiOutput->MidiOutput;

} digraph classes {
    graph [rankdir=BT];
    node [shape=rect, style=filled, color="#298029", fontname=Sans, fontcolor="#ffffff", fontsize=10];

    Lv2Effect->Lv2Plugin[
        dir="backward", arrowhead="diamond", arrowtail="normal"
    ];
    Lv2Effect->Effect;
    SystemEffect->Effect;

    Lv2Param->Param;

    MidiConnection->Connection;
} digraph classes {
    graph [rankdir=BT];
    node [shape=rect, style=filled, color="#298029", fontname=Sans, fontcolor="#ffffff", fontsize=10];

    Bank->BanksManager [dir="forward", arrowhead="odiamond", arrowtail="normal"];
    BanksManager->ObserverManager [dir="forward", arrowhead="none", arrowtail="normal"];
    UpdatesObserver->ObserverManager [dir="forward", arrowhead="odiamond", arrowtail="normal"];
    ModHost->UpdatesObserver
    AutoSaver->UpdatesObserver
}

BanksManager

class pluginsmanager.banks_manager.BanksManager(banks=None)[source]

BanksManager manager the banks. In these is possible add banks, obtains the banks and register observers for will be notified when occurs changes (like added new pedalboard, rename bank, set effect param value or state)

For use details, view Readme.rst example documentation.

Parameters:banks (list[Bank]) – Banks that will be added in this. Useful for loads banks previously loaded, like banks persisted and recovered.
__iter__()[source]

Iterates banks of the banksmanager:

>>> banks_manager = BanksManager()
>>> for index, bank in enumerate(banks_manager):
...     print(index, '-', bank)
Returns:Iterator for banks list
append(bank)[source]

Append the bank in banks manager. It will be monitored, changes in this will be notified for the notifiers.

Parameters:bank (Bank) – Bank that will be added in this
enter_scope(observer)[source]

Informs that changes occurs by the observer and isn’t necessary informs the changes for observer

Parameters:observer (UpdatesObserver) – Observer that causes changes
exit_scope()[source]

Closes the last observer scope added

observers
Returns:Observers registered in BanksManager instance
register(observer)[source]

Register an observer for it be notified when occurs changes.

For more details, see UpdatesObserver

Parameters:observer (UpdatesObserver) – Observer that will be notified then occurs changes
unregister(observer)[source]

Remove the observers of the observers list. It will not receive any more notifications when occurs changes.

Parameters:observer (UpdatesObserver) – Observer you will not receive any more notifications then occurs changes.

Bank

class pluginsmanager.model.bank.Bank(name)[source]

Bank is a data structure that contains Pedalboard. It’s useful for group common pedalboards, like “Pedalboards will be used in the Sunday show”

A fast bank overview:

>>> bank = Bank('RHCP')
>>> californication = Pedalboard('Californication')
>>> # Add pedalboard in bank - mode A
>>> bank.append(californication)
>>> californication.bank == bank
True
>>> bank.pedalboards[0] == californication
True
>>> # Add pedalboard in bank - mode B
>>> bank.pedalboards.append(Pedalboard('Dark Necessities'))
>>> bank.pedalboards[1].bank == bank
True
>>> # If you needs change pedalboards order (swap), use pythonic mode
>>> bank.pedalboards[1], bank.pedalboards[0] = bank.pedalboards[0], bank.pedalboards[1]
>>> bank.pedalboards[1] == californication
True
>>> # Set pedalboard
>>> bank.pedalboards[0] = Pedalboard("Can't Stop")
>>> bank.pedalboards[0].bank == bank
True
>>> del bank.pedalboards[0]
>>> bank.pedalboards[0] == californication # Pedalboard Can't stop rermoved, first is now the californication
True

You can also toggle pedalboards into different banks:

>>> bank1.pedalboards[0], bank2.pedalboards[2] = bank2.pedalboards[0], bank1.pedalboards[2]
Parameters:name (string) – Bank name
append(pedalboard)[source]

Add a Pedalboard in this bank

This works same as:

>>> bank.pedalboards.append(pedalboard)

or:

>>> bank.pedalboards.insert(len(bank.pedalboards), pedalboard)
Parameters:pedalboard (Pedalboard) – Pedalboard that will be added
index

Returns the first occurrence of the bank in your PluginsManager

json

Get a json decodable representation of this bank

Return dict:json representation

Pedalboard

class pluginsmanager.model.pedalboard.Pedalboard(name)[source]

Pedalboard is a patch representation: your structure contains Effect and Connection:

>>> pedalboard = Pedalboard('Rocksmith')
>>> bank.append(pedalboard)

>>> builder = Lv2EffectBuilder()
>>> pedalboard.effects
ObservableList: []
>>> reverb = builder.build('http://calf.sourceforge.net/plugins/Reverb')
>>> pedalboard.append(reverb)
>>> pedalboard.effects
ObservableList: [<Lv2Effect object as 'Calf Reverb'  active at 0x7f60effb09e8>]

>>> fuzz = builder.build('http://guitarix.sourceforge.net/plugins/gx_fuzzfacefm_#_fuzzfacefm_')
>>> pedalboard.effects.append(fuzz)

>>> pedalboard.connections
ObservableList: []
>>> pedalboard.connections.append(Connection(sys_effect.outputs[0], fuzz.inputs[0])) # View SystemEffect for more details
>>> pedalboard.connections.append(Connection(fuzz.outputs[0], reverb.inputs[0]))
>>> # It works too
>>> pedalboard.connect(reverb.outputs[1], sys_effect.inputs[0])
>>> pedalboard.connections
ObservableList: [<Connection object as 'system.capture_1 -> GxFuzzFaceFullerMod.In' at 0x7f60f45f3f60>, <Connection object as 'GxFuzzFaceFullerMod.Out -> Calf Reverb.In L' at 0x7f60f45f57f0>, <Connection object as 'Calf Reverb.Out R -> system.playback_1' at 0x7f60f45dacc0>]

>>> pedalboard.data
{}
>>> pedalboard.data = {'my-awesome-component': True}
>>> pedalboard.data
{'my-awesome-component': True}

For load the pedalboard for play the songs with it:

>>> mod_host.pedalboard = pedalboard

All changes¹ in the pedalboard will be reproduced in mod-host. ¹ Except in data attribute, changes in this does not interfere with anything.

Parameters:name (string) – Pedalboard name
append(effect)[source]

Add a Effect in this pedalboard

This works same as:

>>> pedalboard.effects.append(effect)

or:

>>> pedalboard.effects.insert(len(pedalboard.effects), effect)
Parameters:effect (Effect) – Effect that will be added
connect(output_port, input_port)[source]

Connect two Effect instances in this pedalboard. For this, is necessary informs the output port origin and the input port destination:

>>> pedalboard.append(driver)
>>> pedalboard.append(reverb)
>>> driver_output = driver.outputs[0]
>>> reverb_input = reverb.inputs[0]
>>> Connection(driver_output, reverb_input) in driver.connections
False
>>> pedalboard.connect(driver_output, reverb_input)
>>> Connection(driver_output, reverb_input) in driver.connections
True
Parameters:
  • output_port (Port) – Effect output port
  • input_port (Port) – Effect input port
connections

Return the pedalboard connections list

Note

Because the connections is an ObservableList, it isn’t settable. For replace, del the connections unnecessary and add the necessary connections

disconnect(output_port, input_port)[source]

Remove a connection between (two ports of) Effect instances. For this, is necessary informs the output port origin and the input port destination:

>>> pedalboard.append(driver)
>>> pedalboard.append(reverb)
>>> driver_output = driver.outputs[0]
>>> reverb_input = reverb.inputs[0]
>>> pedalboard.connect(driver_output, reverb_input)
>>> Connection(driver_output, reverb_input) in driver.connections
True
>>> pedalboard.disconnect(driver_output, reverb_input)
>>> Connection(driver_output, reverb_input) in driver.connections
False
Parameters:
  • output_port (Port) – Effect output port
  • input_port (Port) – Effect input port
effects

Return the effects presents in the pedalboard

Note

Because the effects is an ObservableList, it isn’t settable. For replace, del the effects unnecessary and add the necessary effects

index

Returns the first occurrence of the pedalboard in your bank

json

Get a json decodable representation of this pedalboard

Return dict:json representation

Connection

class pluginsmanager.model.connection.Connection(output_port, input_port)[source]

Connection represents a connection between two distinct effects by your AudioPort (effect Output with effect Input):

>>> from pluginsmanager.model.pedalboard import Pedalboard
>>> californication = Pedalboard('Californication')
>>> californication.append(driver)
>>> californication.append(reverb)
>>> guitar_output = sys_effect.outputs[0]
>>> driver_input = driver.inputs[0]
>>> driver_output = driver.outputs[0]
>>> reverb_input = reverb.inputs[0]
>>> reverb_output = reverb.outputs[0]
>>> amp_input = sys_effect.inputs[0]
>>> # Guitar -> driver -> reverb -> amp
>>> californication.connections.append(Connection(guitar_output, driver_input))
>>> californication.connections.append(Connection(driver_output, reverb_input))
>>> californication.connections.append(Connection(reverb_output, amp_input))

Another way to use implicitly connections:

>>> californication.connect(guitar_output, driver_input)
>>> californication.connect(driver_output, reverb_input)
>>> californication.connect(reverb_output, amp_input)
Parameters:
  • output_port (Output) – Audio output port that will be connected with audio input port
  • input_port (Input) – Audio input port that will be connected with audio output port
input
Return Output:Input connection port
json

Get a json decodable representation of this effect

Return dict:json representation
output
Return Output:Output connection port
ports_class
Return class:Port class that this connection only accepts

MidiConnection

class pluginsmanager.model.midi_connection.MidiConnection(output_port, input_port)[source]

MidiConnection represents a connection between two distinct effects by your MidiPort (effect MidiOutput with effect MidiInput):

>>> californication = Pedalboard('Californication')
>>> californication.append(driver)
>>> californication.append(reverb)
>>> output_port = cctonode1.midi_outputs[0]
>>> input_port = cctonode2.midi_inputs[0]
>>> californication.connections.append(MidiConnection(output_port, input_port))

Another way to use implicitly connections:

>>> californication.connect(output_port, input_port)
Parameters:
  • output_port (MidiOutput) – MidiOutput port that will be connected with midi input port
  • input_port (MidiInput) – MidiInput port that will be connected with midi output port
ports_class
Return class:Port class that this connection only accepts

Effect

class pluginsmanager.model.effect.Effect[source]

Representation of a audio plugin instance - LV2 plugin encapsulated as a jack client.

Effect contains a active status (off=bypass), a list of Param, a list of Input and a list of Connection:

>>> reverb = builder.build('http://calf.sourceforge.net/plugins/Reverb')
>>> pedalboard.append(reverb)
>>> reverb
<Lv2Effect object as 'Calf Reverb' active at 0x7fd58d874ba8>

>>> reverb.active
True
>>> reverb.toggle()
>>> reverb.active
False
>>> reverb.active = True
>>> reverb.active
True

>>> reverb.inputs
(<Lv2Input object as In L at 0x7fd58c583208>, <Lv2Input object as In R at 0x7fd58c587320>)
>>> reverb.outputs
(<Lv2Output object as Out L at 0x7fd58c58a438>, <Lv2Output object as Out R at 0x7fd58c58d550>)
>>> reverb.params
(<Lv2Param object as value=1.5 [0.4000000059604645 - 15.0] at 0x7fd587f77908>, <Lv2Param object as value=5000.0 [2000.0 - 20000.0] at 0x7fd587f7a9e8>, <Lv2Param object as value=2 [0 - 5] at 0x7fd587f7cac8>, <Lv2Param object as value=0.5 [0.0 - 1.0] at 0x7fd587f7eba8>, <Lv2Param object as value=0.25 [0.0 - 2.0] at 0x7fd58c576c88>, <Lv2Param object as value=1.0 [0.0 - 2.0] at 0x7fd58c578d68>, <Lv2Param object as value=0.0 [0.0 - 500.0] at 0x7fd58c57ae80>, <Lv2Param object as value=300.0 [20.0 - 20000.0] at 0x7fd58c57df98>, <Lv2Param object as value=5000.0 [20.0 - 20000.0] at 0x7fd58c5810f0>)
Parameters:pedalboard (Pedalboard) – Pedalboard where the effect lies.
active

Effect status: active or bypass

Getter:Current effect status
Setter:Set the effect Status
Type:bool
connections
Return list[Connection]:
 Connections that this effects is present (with input or output port)
index

Returns the first occurrence of the effect in your pedalboard

inputs
Return list[Input]:
 Inputs of effect
is_possible_connect_itself

return bool: Is possible connect the with it self?

is_unique_for_all_pedalboards
return bool: Is unique for all pedalboards?
Example: SystemEffect is unique for all pedalboards
json

Get a json decodable representation of this effect

Return dict:json representation
midi_inputs
Return list[MidiInput]:
 MidiInputs of effect
midi_outputs
Return list[MidiOutput]:
 MidiOutputs of effect
outputs
Return list[Output]:
 Outputs of effect
params
Return list[Param]:
 Params of effect
toggle()[source]

Toggle the effect status: self.active = not self.active

use_real_identifier

Instances of audio plugins are dynamically created, so the effect identifier for the jack can be set.

However, SystemEffect correspond (mostly) to the audio interfaces already present in the computational system. The identifier for their jack has already been set.

return bool: For this audio plugin, is necessary use the real effect identifier?
Example: Lv2Effect is False Example: SystemEffect is True
version
Return string:Effect version

Port

class pluginsmanager.model.port.Port(effect)[source]

Port is a parent abstraction for inputs and outputs

Parameters:effect (Effect) – Effect that contains port
connection_class
Returns:Class used for connections in this port
effect
Returns:Effect that this port is related
index
Returns:Index in the effect related based in your category. As example, if this port is a input, the index returns your position in the inputs ports.
json

Get a json decodable representation

Return dict:json representation
symbol
Returns:Identifier for this port

AudioPort

class pluginsmanager.model.audio_port.AudioPort(effect)[source]

Port is a parent abstraction for audio inputs and audio outputs

connection_class
Return Connection:
 Class used for connections in this port

Input

class pluginsmanager.model.input.Input(effect)[source]

Input is the medium in which the audio will go into effect to be processed.

Effects usually have a one (mono) or two inputs (stereo L + stereo R). But this isn’t a rule: Some have only Output, like audio frequency generators, others have more than two.

For obtains the inputs:

>>> my_awesome_effect
<Lv2Effect object as 'Calf Reverb' active at 0x7fd58d874ba8>
>>> my_awesome_effect.inputs
(<Lv2Input object as In L at 0x7fd58c583208>, <Lv2Input object as In R at 0x7fd58c587320>)

>>> effect_input = my_awesome_effect.inputs[0]
>>> effect_input
<Lv2Input object as In L at 0x7fd58c583208>

>>> symbol = effect_input.symbol
>>> symbol
'in_l'

>>> my_awesome_effect.inputs[symbol] == effect_input
True

For connections between effects, see connect() and disconnect() Pedalboard class methods.

Parameters:effect (Effect) – Effect of input
index
Returns:Input index in the your effect

Output

class pluginsmanager.model.output.Output(effect)[source]

Output is the medium in which the audio processed by the effect is returned.

Effects usually have a one (mono) or two outputs (stereo L + stereo R). .

For obtains the outputs:

>>> my_awesome_effect
<Lv2Effect object as 'Calf Reverb' active at 0x7fd58d874ba8>
>>> my_awesome_effect.outputs
(<Lv2Output object as Out L at 0x7fd58c58a438>, <Lv2Output object as Out R at 0x7fd58c58d550>)

>>> output = my_awesome_effect.outputs[0]
>>> output
<Lv2Output object as Out L at 0x7fd58c58a438>

>>> symbol = my_awesome_effect.outputs[0].symbol
>>> symbol
'output_l'

>>> my_awesome_effect.outputs[symbol] == output
True

For connections between effects, see connect() and disconnect() Pedalboard class methods.

Parameters:effect (Effect) – Effect that contains the output
index
Returns:Output index in the your effect

MidiPort

class pluginsmanager.model.midi_port.MidiPort(effect)[source]

Port is a parent abstraction for midi inputs and midi outputs

connection_class
Return MidiConnection:
 Class used for connections in this port

MidiInput

class pluginsmanager.model.midi_input.MidiInput(effect)[source]

MidiInput is the medium in which the midi input port will go into effect to be processed.

For obtains the inputs:

>>> cctonode
<Lv2Effect object as 'CC2Note'  active at 0x7efe5480af28>
>>> cctonode.midi_inputs
(<Lv2MidiInput object as MIDI In at 0x7efe54535dd8>,)

>>> midi_input = cctonode.midi_inputs[0]
>>> midi_input
<Lv2MidiInput object as MIDI In at 0x7efe54535dd8>

>>> symbol = midi_input.symbol
>>> symbol
'midiin'

>>> cctonode.midi_inputs[symbol] == midi_input
True

For connections between effects, see connect() and disconnect() Pedalboard class methods.

Parameters:effect (Effect) – Effect of midi input
index
Returns:MidiInput index in the your effect

MidiOutput

class pluginsmanager.model.midi_output.MidiOutput(effect)[source]

MidiOutput is the medium in which the midi output processed by the effect is returned.

For obtains the outputs:

>>> cctonode
<Lv2Effect object as 'CC2Note'  active at 0x7efe5480af28>
>>> cctonode.outputs
(<Lv2MidiOutput object as MIDI Out at 0x7efe5420eeb8>,)

>>> midi_output = cctonode.midi_outputs[0]
>>> midi_output
<Lv2Output object as Out L at 0x7fd58c58a438>

>>> symbol = midi_output.symbol
>>> symbol
'midiout'

>>> cctonode.midi_outputs[symbol] == midi_output
True

For connections between effects, see connect() and disconnect() Pedalboard class methods.

Parameters:effect (Effect) – Effect that contains the output
index
Returns:Output index in the your effect

Param

class pluginsmanager.model.param.Param(effect, default)[source]

Param represents an Audio Plugin Parameter:

>>> my_awesome_effect
<Lv2Effect object as 'Calf Reverb' active at 0x7fd58d874ba8>
>>> my_awesome_effect.params
(<Lv2Param object as value=1.5 [0.4000000059604645 - 15.0] at 0x7fd587f77908>, <Lv2Param object as value=5000.0 [2000.0 - 20000.0] at 0x7fd587f7a9e8>, <Lv2Param object as value=2 [0 - 5] at 0x7fd587f7cac8>, <Lv2Param object as value=0.5 [0.0 - 1.0] at 0x7fd587f7eba8>, <Lv2Param object as value=0.25 [0.0 - 2.0] at 0x7fd58c576c88>, <Lv2Param object as value=1.0 [0.0 - 2.0] at 0x7fd58c578d68>, <Lv2Param object as value=0.0 [0.0 - 500.0] at 0x7fd58c57ae80>, <Lv2Param object as value=300.0 [20.0 - 20000.0] at 0x7fd58c57df98>, <Lv2Param object as value=5000.0 [20.0 - 20000.0] at 0x7fd58c5810f0>)

>>> param = my_awesome_effect.params[0]
>>> param
<Lv2Param object as value=1.5 [0.4000000059604645 - 15.0] at 0x7fd587f77908>

>>> param.default
1.5
>>> param.value = 14

>>> symbol = param.symbol
>>> symbol
'decay_time'
>>> param == my_awesome_effect.params[symbol]
True
Parameters:
  • effect (Effect) – Effect in which this parameter belongs
  • default – Default value (initial value parameter)
default

Default parameter value. Then a effect is instanced, the value initial for a parameter is your default value.

Getter:Default parameter value.
effect
Returns:Effect in which this parameter belongs
json

Get a json decodable representation of this param

Return dict:json representation
maximum
Returns:Greater value that the parameter can assume
minimum
Returns:Smaller value that the parameter can assume
symbol
Returns:Param identifier
value

Parameter value

Getter:Current value
Setter:Set the current value