PedalPi - PluginsManager - ModHost

About mod-host

mod-host is a LV2 host for Jack controllable via socket or command line. With it you can load audio plugins, connect, manage plugins.

For your use, is necessary download it

git clone https://github.com/moddevices/mod-host
cd mod-host
make
make install

Then boot the JACK process and start the mod-host. Details about “JACK” can be found at https://help.ubuntu.com/community/What%20is%20JACK

# In this example, is starting a Zoom g3 series audio interface
jackd -R -P70 -t2000 -dalsa -dhw:Series -p256 -n3 -r44100 -s &
mod-host

You can now connect to the mod-host through the Plugins Manager API. Create a ModHost object with the address that is running the mod-host process. Being in the same machine, it should be ‘localhost’

mod_host = ModHost('localhost')
mod_host.connect()

Finally, register the mod-host in your BanksManager. Changes made to the current pedalboard will be applied to mod-host

manager = BanksManager()
# ...
manager.register(mod_host)

To change the current pedalboard, change the pedalboard parameter to mod_host. Remember that for changes to occur in mod-host, the pedalboard must belong to some bank of banks_manager.

mod_host.pedalboard = my_awesome_pedalboard

ModHost

class pluginsmanager.observer.mod_host.mod_host.ModHost(address='localhost', port=5555)[source]
Python port for mod-host
Mod-host is a LV2 host for Jack controllable via socket or command line.

This class offers the mod-host control in a python API:

# Create a mod-host, connect and register it in banks_manager
mod_host = ModHost('localhost')
mod_host.connect()
banks_manager.register(mod_host)

# Set the mod_host pedalboard for a pedalboard that the bank
# has added in banks_manager
mod_host.pedalboard = my_awesome_pedalboard

The changes in current pedalboard (pedalboard attribute of mod_host) will also result in mod-host:

driver = my_awesome_pedalboard.effects[0]
driver.active = False

Note

For use, is necessary that the mod-host is running, for use, access

For more JACK information, access Demystifying JACK – A Beginners Guide to Getting Started with JACK

Example:

In this example, is starting a Zoom G3 series audio interface. Others interfaces maybe needs others configurations.
# Starting jackdump process via console
jackd -R -P70 -t2000 -dalsa -dhw:Series -p256 -n3 -r44100 -s &
# Starting mod-host
mod-host &
Parameters:
  • address (string) – Computer mod-host process address (IP). If the process is running on the same computer that is running the python code uses localhost.
  • port (int) – Socket port on which mod-host should be running. Default is 5555
__del__()[source]

Calls close() method for remove the audio plugins loaded and closes connection with mod-host.

>>> mod_host = ModHost()
>>> del mod_host

Note

If the mod-host process has been created with start() method, it will be finished.

close()[source]

Remove the audio plugins loaded and closes connection with mod-host.

Note

If the mod-host process has been created with start() method, it will be finished.

connect()[source]

Connect the object with mod-host with the _address_ parameter informed in the constructor method (__init__())

pedalboard

Currently managed pedalboard (current pedalboard)

Getter:Current pedalboard - Pedalboard loaded by mod-host
Setter:Set the pedalboard that will be loaded by mod-host
Type:Pedalboard
start()[source]

Invokes the mod-host process.

mod-host requires JACK to be running. mod-host does not startup JACK automatically, so you need to start it before running mod-host.

Note

This function is experimental. There is no guarantee that the process will actually be initiated.

ModHost internal

The classes below are for internal use of mod-host

Connection

class pluginsmanager.observer.mod_host.connection.Connection(socket_port=5555, address='localhost')[source]

Class responsible for managing an API connection to the mod-host process via socket

close()[source]

Closes socket connection

send(message)[source]

Sends message to mod-host.

Note

Uses ProtocolParser for a high-level management. As example, view Host

Parameters:message (string) – Message that will be sent for mod-host

Host

class pluginsmanager.observer.mod_host.host.Host(address='localhost', port=5555)[source]

Bridge between mod-host API and mod-host process

add(effect)[source]

Add an LV2 plugin encapsulated as a jack client

Parameters:effect (Lv2Effect) – Effect that will be loaded as LV2 plugin encapsulated
close()[source]

Quit the connection with mod-host

connect(connection)[source]

Connect two effect audio ports

Parameters:connection (pluginsmanager.model.connection.Connection) – Connection with the two effect audio ports (output and input)
disconnect(connection)[source]

Disconnect two effect audio ports

Parameters:connection (pluginsmanager.model.connection.Connection) – Connection with the two effect audio ports (output and input)
quit()[source]

Quit the connection with mod-host and stop the mod-host process

remove(effect)[source]

Remove an LV2 plugin instance (and also the jack client)

Parameters:effect (Lv2Effect) – Effect that your jack client encapsulated will removed
set_param_value(param)[source]

Set a value to given control

Parameters:param (Lv2Param) – Param that the value will be updated
set_status(effect)[source]

Toggle effect processing

Parameters:effect (Lv2Effect) – Effect with the status updated

ProtocolParser

class pluginsmanager.observer.mod_host.protocol_parser.ProtocolParser[source]

Prepare the objects to mod-host string command

static add(effect)[source]

add <lv2_uri> <instance_number>

add a LV2 plugin encapsulated as a jack client

e.g.:

add http://lv2plug.in/plugins/eg-amp 0

instance_number must be any value between 0 ~ 9999, inclusively

Parameters:effect (Lv2Effect) – Effect will be added
static bypass(effect)[source]

bypass <instance_number> <bypass_value>

toggle plugin processing

e.g.:

bypass 0 1
  • if bypass_value = 1 bypass plugin
  • if bypass_value = 0 process plugin
Parameters:effect (Lv2Effect) – Effect that will be active the bypass or disable the bypass
static connect(connection)[source]

connect <origin_port> <destination_port>

connect two plugin audio ports

e.g.:

connect system:capture_1 plugin_0:in
Parameters:connection (pluginsmanager.model.connection.Connection) – Connection with a valid Output and Input
static disconnect(connection)[source]

disconnect <origin_port> <destination_port>

disconnect two plugin audio ports

e.g.:

disconnect system:capture_1 plugin_0:in
Parameters:connection (pluginsmanager.model.connection.Connection) – Connection with a valid Output and Input
static help()[source]

help

show a help message

static load(filename)[source]

load <file_name>

load a history command file dummy way to save/load workspace state

e.g.:

load my_setup

Note

Not implemented yet

static midi_learn(plugin, param)[source]

midi_learn <instance_number> <param_symbol>

This command maps starts MIDI learn for a parameter

e.g.:

midi_learn 0 gain

Note

Not implemented yet

static midi_map(plugin, param, midi_chanel, midi_cc)[source]

midi_map <instance_number> <param_symbol> <midi_channel> <midi_cc>

This command maps a MIDI controller to a parameter

e.g.:

midi_map 0 gain 0 7

Note

Not implemented yet

static midi_unmap(plugin, param)[source]

midi_unmap <instance_number> <param_symbol>

This command unmaps the MIDI controller from a parameter

e.g.:

unmap 0 gain

Note

Not implemented yet

static monitor()[source]

monitor <addr> <port> <status>

open a socket port to monitoring parameters

e.g.:

monitor localhost 12345 1
  • if status = 1 start monitoring
  • if status = 0 stop monitoring

Note

Not implemented yet

static param_get(param)[source]

param_get <instance_number> <param_symbol>

get the value of the request control

e.g.:

param_get 0 gain
Parameters:param (Lv2Param) – Parameter that will be get your current value
static param_monitor()[source]

param_monitor <instance_number> <param_symbol> <cond_op> <value>

do monitoring a plugin instance control port according given condition

e.g.:

param_monitor 0 gain > 2.50

Note

Not implemented yet

static param_set(param)[source]

param_set <instance_number> <param_symbol> <param_value>

set a value to given control

e.g.:

param_set 0 gain 2.50
Parameters:param (Lv2Param) – Parameter that will be updated your value
static preset_load()[source]

preset_load <instance_number> <preset_uri>

load a preset state to given plugin instance

e.g.:

preset_load 0 "http://drobilla.net/plugins/mda/presets#JX10-moogcury-lite"

Note

Not implemented yet

static preset_save()[source]

preset_save <instance_number> <preset_name> <dir> <file_name>

save a preset state from given plugin instance

e.g.:

preset_save 0 "My Preset" /home/user/.lv2/my-presets.lv2 mypreset.ttl

Note

Not implemented yet

static preset_show()[source]

preset_show <instance_number> <preset_uri>

show the preset information of requested instance / URI

e.g.:

preset_show 0 http://drobilla.net/plugins/mda/presets#EPiano-bright

Note

Not implemented yet

static quit()[source]

quit

bye!

static remove(effect)[source]

remove <instance_number>

remove a LV2 plugin instance (and also the jack client)

e.g.:

remove 0
Parameters:effect (Lv2Effect) – Effect will be removed
static save(filename)[source]

save <file_name>

saves the history of typed commands dummy way to save/load workspace state

e.g.:

save my_setup

Note

Not implemented yet