Midi Setup

Set of functions to inspect the system’s midi configuration.

Note

These functions are available only if pyo is built with portmidi support.

Functions in this category

pm_get_default_output

pm_get_default_output()

Returns the index number of Portmidi’s default output device.

>>> names, indexes = pm_get_output_devices()
>>> name = names[indexes.index(pm_get_default_output())]
>>> print(name)
'IAC Driver Bus 1'

pm_get_default_input

pm_get_default_input()

Returns the index number of Portmidi’s default input device.

>>> names, indexes = pm_get_input_devices()
>>> name = names[indexes.index(pm_get_default_input())]
>>> print(name)
'IAC Driver Bus 1'

pm_get_output_devices

pm_get_output_devices()

Returns midi output devices (device names, device indexes) found by Portmidi.

device names is a list of strings and device indexes is a list of the actual Portmidi index of each device.

>>> outs = pm_get_output_devices()
>>> print(outs)
(['IAC Driver Bus 1', 'to MaxMSP 1', 'to MaxMSP 2'], [3, 4, 5])

pm_get_input_devices

pm_get_input_devices()

Returns midi input devices (device names, device indexes) found by Portmidi.

device names is a list of strings and device indexes is a list of the actual Portmidi index of each device.

>>> ins = pm_get_input_devices()
>>> print(ins)
(['IAC Driver Bus 1', 'from MaxMSP 1', 'from MaxMSP 2'], [0, 1, 2])

pm_list_devices

pm_list_devices()

Prints a list of all devices found by Portmidi.

>>> pm_list_devices()
MIDI devices:
0: IN, name: IAC Driver Bus 1, interface: CoreMIDI
1: IN, name: from MaxMSP 1, interface: CoreMIDI
2: IN, name: from MaxMSP 2, interface: CoreMIDI
3: OUT, name: IAC Driver Bus 1, interface: CoreMIDI
4: OUT, name: to MaxMSP 1, interface: CoreMIDI
5: OUT, name: to MaxMSP 2, interface: CoreMIDI

pm_count_devices

pm_count_devices()

Returns the number of devices found by Portmidi.

>>> c = pm_count_devices()
>>> print(c)
6