mtsespy

December 4, 2025 ยท View on GitHub

Python bindings for the ODDSound MTS-ESP library.

Installation

To install from PyPI:

$ pip install mtsespy

or to clone the repo and install from source:

$ git clone --recurse-submodules https://github.com/narenratan/mtsespy.git
$ cd mtsespy
$ python3 -m pip install .

Using MTS-ESP requires the libMTS dynamic library which is available in the ODDSound MTS-ESP repo here. The places to put it for each OS are given in the MTS-ESP README here.

Examples

Set tuning of midi note 69 to frequency 441 Hz

import signal

import mtsespy as mts

with mts.Master():
    mts.set_note_tuning(441.0, 69)
    signal.pause()

Pull frequency of midi note 69 on midi channel 0

import mtsespy as mts

with mts.Client() as c:
    f = mts.note_to_frequency(c, 69, 0)

The Master and Client context managers, used above, handle registering and deregistering the MTS-ESP master and client.

Wrapper names

The function names in the MTS-ESP C++ library and this Python wrapper correspond as follows

Master functions

C++Python
MTS_RegisterMasterregister_master
MTS_DeregisterMasterderegister_master
MTS_HasIPChas_ipc
MTS_Reinitializereinitialize
MTS_Master_ShouldUpdateLibrarymaster_should_update_library
MTS_GetNumClientsget_num_clients
MTS_SetNoteTuningsset_note_tunings
MTS_SetNoteTuningset_note_tuning
MTS_SetScaleNameset_scale_name
MTS_SetPeriodRatioset_period_ratio
MTS_SetMapSizeset_map_size
MTS_SetMapStartKeyset_map_start_key
MTS_SetRefKeyset_ref_key
MTS_FilterNotefilter_note
MTS_ClearNoteFilterclear_note_filter
MTS_SetMultiChannelset_multi_channel
MTS_SetMultiChannelNoteTuningsset_multi_channel_note_tunings
MTS_SetMultiChannelNoteTuningset_multi_channel_note_tuning
MTS_FilterNoteMultiChannelfilter_note_multi_channel
MTS_ClearNoteFilterMultiChannelclear_note_filter_multi_channel

Client functions

C++Python
MTS_RegisterClientregister_client
MTS_DeregisterClientderegister_client
MTS_HasMasterhas_master
MTS_Client_ShouldUpdateLibraryclient_should_update_library
MTS_ShouldFilterNoteshould_filter_note
MTS_NoteToFrequencynote_to_frequency
MTS_RetuningInSemitonesretuning_in_semitones
MTS_RetuningAsRatioretuning_as_ratio
MTS_FrequencyToNotefrequency_to_note
MTS_FrequencyToNoteAndChannelfrequency_to_note_and_channel
MTS_GetScaleNameget_scale_name
MTS_GetPeriodRatioget_period_ratio
MTS_GetPeriodSemitonesget_period_semitones
MTS_GetMapSizeget_map_size
MTS_GetMapStartKeyget_map_start_key
MTS_GetRefKeyget_ref_key
MTS_ParseMIDIDataU-
MTS_ParseMIDIDataparse_midi_data
MTS_HasReceivedMTSSysExhas_received_mts_sysex