jvconnected.interfaces.midi.bcf_sysex

exception jvconnected.interfaces.midi.bcf_sysex.ResponseError(error_code: int)[source]

Bases: Exception

Raised on errors indicated by BCLReply messages

The error_code is used to provide a description of the error, if possible

error_code: int

The error number from the device

class jvconnected.interfaces.midi.bcf_sysex.BCLSyxBase(manufacturer: Sequence[ByteString] = (0, 32, 50), device_id: Sequence[ByteString] = (127,), model: Sequence[ByteString] = (20,), command: Sequence[ByteString] = (32,), message_index: int = 0)[source]

Bases: object

Wrapper for a single BCL command as a Sysex message

manufacturer: Sequence[ByteString] = (0, 32, 50)

The Sysex manufacturer id

This should always be (0x00, 0x20, 0x32) (Behringer)

device_id: Sequence[ByteString] = (127,)

The device id from 0x00 to 0x15, or 0x7f for “any”

model: Sequence[ByteString] = (20,)

0x14 for BCF2000, 0x15 for BCR2000, or 0x7f for “any”

command: Sequence[ByteString] = (32,)

The command type. This is 0x20 for BCL messages

message_index: int = 0

Index of the BCL command within a BCLBlock

classmethod from_sysex_message(msg: Message) BCLSysex[source]

Create an instance from the given Message

property index_msb: Sequence[ByteString]

Bits 7-13 of message_index

property index_lsb: Sequence[ByteString]

Bits 0-6 of message_index

build_sysex_data() Sequence[ByteString][source]

Build the Sysex message as a sequence of int

build_sysex_message() Message[source]

Build a Sysex message wrapped in a mido.Message

class jvconnected.interfaces.midi.bcf_sysex.BCLSysex(manufacturer: Sequence[ByteString] = (0, 32, 50), device_id: Sequence[ByteString] = (127,), model: Sequence[ByteString] = (20,), command: Sequence[ByteString] = (32,), message_index: int = 0, bcl_text: str = '')[source]

Bases: BCLSyxBase

A BCL Text command

bcl_text: str = ''

The BCL line

class jvconnected.interfaces.midi.bcf_sysex.BCLReply(manufacturer: Sequence[ByteString] = (0, 32, 50), device_id: Sequence[ByteString] = (127,), model: Sequence[ByteString] = (20,), command: Sequence[ByteString] = (32,), message_index: int = 0, error_code: Sequence[ByteString] = (0,))[source]

Bases: BCLSyxBase

A message sent from a BC device in response to a BCL command

error_code: Sequence[ByteString] = (0,)

If non-zero, indicates an error occured

raise_on_error()[source]

Check for errors and raise a ResponseError if necessary

class jvconnected.interfaces.midi.bcf_sysex.BCLBlock(revision: str = 'F1', text_lines: ~typing.Sequence[str] = <factory>)[source]

Bases: object

A sequence of BCL commands either received from or sent to a BC device

revision: str = 'F1'

The device type and revision number for the device

This is typically “F1” for the BCF2000 and “R1” for the BCR2000

text_lines: Sequence[str]

The BCL command lines within the block (not including the block start or end commands)

classmethod from_midi_messages(messages: Sequence[Message]) Tuple[BCLBlock, Sequence[Message]][source]

Create a BCLBlock from the given Messages

Returns

  • blk (BCLBlock) – The parsed instance

  • unhandled (List[mido.Message]) – The messages remaining after parsing

Return type

Tuple[BCLBlock, Sequence[Message]]

build_sysex_items() Sequence[BCLSysex][source]

Construct the BCLSysex items needed to send the block

build_sysex_messages() Sequence[Message][source]

Build the block as a sequence of Sysex Messages

async send(inport: InputPort, outport: OutputPort)[source]

Send the block and wait for the device reply using the given Midi ports

Parameters
async send_to_port_name(name: str)[source]

Send the block and wait for the device reply using the given port name

Opens an aioport.IOPort matching the given name. The input/output ports are then used as described in the send() method

class jvconnected.interfaces.midi.bcf_sysex.ControlBase(message_type: str = 'control_change', channel: int = 0, number: int = 0, mode: str = '', value_min: int = 0, value_max: int = 127, value_default: Optional[int] = None, show_value: bool = True)[source]

Bases: object

Base class for control definitions

message_type: str = 'control_change'

Midi message type for the control

Choices

['note', 'aftertouch', 'control_change', 'program_change', 'pitch_bend']
channel: int = 0

Midi channel (zero-indexed)

number: int = 0

Note or controller number (zero-indexed)

value_min: int = 0

Minimum controller value

value_max: int = 127

Maximum controller value

value_default: Optional[int] = None

Default controller value

show_value: bool = True

Whether the value should be displayed in the 4-digit LED display when adjusted

property is_14_bit: bool

True if the control uses 14-bit values

build_bcl_lines() Sequence[str][source]

Build the BCL commands for the controller as a sequence of str

class jvconnected.interfaces.midi.bcf_sysex.EncoderConf(message_type: str = 'control_change', channel: int = 0, number: int = 0, mode: str = '1dot', value_min: int = 0, value_max: int = 127, value_default: Optional[int] = None, show_value: bool = True, index: int = 1, encoder_mode: str = 'absolute', resolution: Sequence[int] = (96, 96, 96, 96))[source]

Bases: ControlBase

A Push Encoder configuration

index: int = 1

Encoder number starting with 1

mode: str = '1dot'

LED Display mode

Choices

[
    'off', '1dot', '1dot/off', '12dot', '12dot/off', 'bar', 'bar/off',
    'spread', 'pan', 'qual', 'cut', 'damp',
]
encoder_mode: str = 'absolute'

Control mode for the encoder

Choices

[
    'absolute', 'relative-1', 'relative-2', 'relative-3', 'inc/dec',
    'absolute/14', 'relative-1/14', 'relative-2/14', 'relative-3/14',
]
resolution: Sequence[int] = (96, 96, 96, 96)

Steps per revolution at four different rotation speeds

build_bcl_lines() Sequence[str][source]

Build the BCL commands for the controller as a sequence of str

class jvconnected.interfaces.midi.bcf_sysex.FaderConf(message_type: str = 'control_change', channel: int = 0, number: int = 0, mode: str = 'absolute', value_min: int = 0, value_max: int = 127, value_default: Optional[int] = None, show_value: bool = True, index: int = 1, motor: bool = True, override: str = 'move', keyoverride: str = 'off')[source]

Bases: ControlBase

A fader configuration

index: int = 1

Fader number starting with 1

motor: bool = True

Enable/disable the fader motor

override: str = 'move'

Behavior when motor is False

Choices

['move', 'pickup']
'move'

Immediately send output messages when the fader is moved

'pickup'

Wait for the fader to reach last known value before sending output messages

keyoverride: str = 'off'

Set a button to temporarily disable the fader motor when held

Choices

['off', 1 .. 64]
build_bcl_lines() Sequence[str][source]

Build the BCL commands for the controller as a sequence of str

class jvconnected.interfaces.midi.bcf_sysex.ButtonConf(message_type: str = 'control_change', channel: int = 0, number: int = 0, mode: str = '', value_min: int = 0, value_max: int = 127, value_default: Optional[int] = None, show_value: bool = True, index: int = 1, button_mode: str = 'toggleon', increment: int = 1)[source]

Bases: ControlBase

A Button configuration

index: int = 1

Button number starting with 1

button_mode: str = 'toggleon'

Choices

['toggleoff', 'toggleon', 'increment']
increment: int = 1

Amount to increment/decrement if button_mode is 'increment'

class jvconnected.interfaces.midi.bcf_sysex.Preset(**kwargs)[source]

Bases: object

Representation of a BCF preset containing encoders, faders and buttons

name: str = ''

Name of the preset

snapshot: bool = False

If True, send predefined values when a preset is selected

request: bool = False

If True, send any LearnOutput data when a preset is selected

egroups: int = 4

Number of encoder groups to enable

fkeys: bool = True

Enable/disable the STORE, LEARN, EDIT and EXIT function keys

lock: bool = False

Enable/disable the < and > preset buttons

encoders: Dict[int, EncoderConf]

Mapping of EncoderConf definitions using their index as keys

faders: Dict[int, FaderConf]

Mapping of FaderConf definitions using their index as keys

buttons: Dict[int, ButtonConf]

Mapping of ButtonConf definitions using their index as keys

add_encoder(**kwargs) EncoderConf[source]

Create an EncoderConf and add it to encoders

Keyword arguments from this method will be used to create the instance

add_fader(**kwargs) FaderConf[source]

Create a FaderConf and add it to faders

Keyword arguments from this method will be used to create the instance

add_button(**kwargs) ButtonConf[source]

Create a ButtonConf and add it to buttons

Keyword arguments from this method will be used to create the instance

build_bcl_lines() Sequence[str][source]

Build the BCL commands for the preset as a list of strings

build_bcl_block() BCLBlock[source]

Build the BCL commands for the preset wrapped in a BCLBlock

build_sysex_messages() Sequence[Message][source]

Build the BCL commands for the preset as a sequence of Sysex messages

build_store_block(preset_num: int) BCLBlock[source]

Build the BCL commands to store the preset to the given number, wrapped in a BCLBlock

build_store_sysex(preset_num: int) Sequence[Message][source]

Build the BCL commands to store the preset to the given number, wrapped in a sequence of Sysex messages

async send(inport: InputPort, outport: OutputPort, store: bool = False, preset_num: int = 1)[source]

Send the preset to the device and optionally store it using the given midi ports

Parameters
  • inport (aioport.InputPort) – An open midi input port to receive BCL replies from

  • outport (aioport.OutputPort) – An open midi output port to send BCL messages to

  • store (bool) – If True, store the preset in the device memory using the given preset_num. Default is False

  • preset_num (int) – If store is True this is will be the preset number stored on the device. Default is 1

async send_to_port_name(name: str, store: bool = False, preset_num: int = 1)[source]

Send the preset to the device and optionally store it using the given port name

Opens an aioport.IOPort matching the given name. The input/output ports are then used as described in the send() method

Parameters
  • name (str) – The port name

  • store (bool) – If True, store the preset in the device memory using the given preset_num. Default is False

  • preset_num (int) – If store is True this is will be the preset number stored on the device. Default is 1