PedalPi - PluginsManager - Models¶
This page contains the model classes.
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. -
__weakref__
¶ list of weak references to the object (if defined)
-
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 observerParameters: observer (UpdatesObserver) – Observer that causes changes
-
register
(observer)[source]¶ Register an observer for it be notified when occurs changes.
For more details, see
UpdatesObserver
andModHost
.Parameters: observer (UpdatesObserver) – Observer that will be notified 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 -
__weakref__
¶ list of weak references to the object (if defined)
-
append
(pedalboard)[source]¶ Add a
Pedalboard
in this bankThis works same as:
>>> bank.pedalboards.append(pedalboard)
or:
>>> bank.pedalboards.insert(len(bank.pedalboards), pedalboard)
Parameters: pedalboard (Pedalboard) – Pedalboard that will be added
-
json
¶ Get a json decodable representation of this bank
Return dict: json representation
-
Connection¶
-
class
pluginsmanager.model.connection.
Connection
(effect_output, effect_input)[source]¶ Connection
represents a connection between two distinct effects by your ports (effectOutput
with effectInput
):>>> 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:
>>> guitar_output.connect(driver_input) >>> driver_output.connect(reverb_input) >>> reverb_output.connect(amp_input)
Parameters: -
__weakref__
¶ list of weak references to the object (if defined)
-
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
-
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 ofInput
and a list ofConnection
:>>> 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. -
__weakref__
¶ list of weak references to the object (if defined)
-
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?
-
json
¶ Get a json decodable representation of this effect
Return dict: json representation
-
outputs
¶ Return list[Output]: Outputs of effect
-
params
¶ Return list[Param]: Params of effect
-
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 class: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, view
Connections
.Parameters: effect (Effect) – Effect of input -
__weakref__
¶ list of weak references to the object (if defined)
-
effect
¶ Returns: Effect of input
-
index
¶ :return Input index in the your effect
-
json
¶ Get a json decodable representation of this input
Return dict: json representation
-
symbol
¶ Returns: Input identifier
-
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, view
Connections
.Parameters: effect (Effect) – Effect of output -
__weakref__
¶ list of weak references to the object (if defined)
-
connect
(effect_input)[source]¶ Connect it with effect_input:
>>> driver_output = driver.outputs[0] >>> reverb_input = reverb.inputs[0] >>> Connection(driver_output, reverb_input) in driver.effect.connections False >>> driver_output.connect(reverb_input) >>> Connection(driver_output, reverb_input) in driver.effect.connections True
Note
This method does not work for all cases. class:SystemOutput can not be connected with class:SystemInput this way. For this case, use
>>> pedalboard.connections.append(Connection(system_output, system_input))
Parameters: effect_input (Input) – Input that will be connected with it
-
disconnect
(effect_input)[source]¶ Disconnect it with effect_input
>>> driver_output = driver.outputs[0] >>> reverb_input = reverb.inputs[0] >>> Connection(driver_output, reverb_input) in driver.effect.connections True >>> driver_output.disconnect(reverb_input) >>> Connection(driver_output, reverb_input) in driver.effect.connections False
Note
This method does not work for all cases. class:SystemOutput can not be disconnected with class:SystemInput this way. For this case, use
>>> pedalboard.connections.remove(Connection(system_output, system_input))
Parameters: effect_input (Input) – Input that will be disconnected with it
-
effect
¶ Returns: Effect of output
-
index
¶ :return Output index in the your effect
-
json
¶ Get a json decodable representation of this output
Return dict: json representation
-
symbol
¶ Returns: Output identifier
-
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)
-
__weakref__
¶ list of weak references to the object (if defined)
-
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
Pedalboard¶
-
class
pluginsmanager.model.pedalboard.
Pedalboard
(name)[source]¶ Pedalboard is a patch representation: your structure contains
Effect
andConnection
:>>> 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 >>> reverb.outputs[1].connect(sys_effect.inputs[0]) 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 -
__weakref__
¶ list of weak references to the object (if defined)
-
append
(effect)[source]¶ Add a
Effect
in this pedalboardThis works same as:
>>> pedalboard.effects.append(effect)
or:
>>> pedalboard.effects.insert(len(pedalboard.effects), effect)
Parameters: effect (Effect) – Effect that will be added
-
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
-
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
-
UpdateType¶
UpdatesObserver¶
-
class
pluginsmanager.model.updates_observer.
UpdatesObserver
[source]¶ The
UpdatesObserver
is an abstract class definition for treatment of changes in some class model. Your methods are called when occurs any change in Bank, Pedalboard, Effect, etc.To do this, it is necessary that the
UpdateObserver
objects be registered in some manager, so that it reports the changes. An example of a manager isBanksManager
.-
__weakref__
¶ list of weak references to the object (if defined)
-
on_bank_updated
(bank, update_type, index, origin, **kwargs)[source]¶ Called when changes occurs in any
Bank
Parameters: - bank (Bank) – Bank changed.
- update_type (UpdateType) – Change type
- index (int) – Bank index (or old index if update_type == UpdateType.DELETED)
- origin (BanksManager) – BanksManager that the bank is (or has) contained
-
on_connection_updated
(connection, update_type, pedalboard, **kwargs)[source]¶ Called when changes occurs in any
pluginsmanager.model.connection.Connection
of Pedalboard (adding, updating or removing connections)Parameters: - connection (pluginsmanager.model.connection.Connection) – Connection changed
- update_type (UpdateType) – Change type
- pedalboard (Pedalboard) – Pedalboard that the connection is (or has) contained
-
on_effect_status_toggled
(effect, **kwargs)[source]¶ Called when any
Effect
status is toggledParameters: effect (Effect) – Effect when status has been toggled
-
on_effect_updated
(effect, update_type, index, origin, **kwargs)[source]¶ Called when changes occurs in any
Effect
Parameters: - effect (Effect) – Effect changed
- update_type (UpdateType) – Change type
- index (int) – Effect index (or old index if update_type == UpdateType.DELETED)
- origin (Pedalboard) – Pedalboard that the effect is (or has) contained
-
on_param_value_changed
(param, **kwargs)[source]¶ Called when a param value change
Parameters: param (Param) – Param with value changed
-
on_pedalboard_updated
(pedalboard, update_type, index, origin, **kwargs)[source]¶ Called when changes occurs in any
Pedalboard
Parameters: - pedalboard (Pedalboard) – Pedalboard changed
- update_type (UpdateType) – Change type
- index (int) – Pedalboard index (or old index if update_type == UpdateType.DELETED)
- origin (Bank) – Bank that the pedalboard is (or has) contained
-