Miscellaneous functions

pitchmeld.lin2db(value: float) float

Convert a linear amplitude value to a decibel value.

Parameters:

value – on a linear scale.

Returns:

  • float - The value on a decibel scale.

pitchmeld.db2lin(value: float) float

Convert a decibel value to a linear amplitude value.

Parameters:

value – on a decibel scale.

Returns:

  • float - The value on a linear scale.

Multiprocessing

Pitchmeld Python SDK uses a C/C++ python extension and this is generally not safe to use with the ‘fork’ start method (ex. like pytorch, tensorflow, etc.) Thus, when using multiprocessing, you need to use the ‘spawn’ start method instead of the ‘fork’ start method.

import multiprocessing
multiprocessing.set_start_method('spawn', force=True)

Slow connection

In case you are on a slow connection, you can increase the timeout for the connection to the server.

export PITCHMELD_TIMEOUT=20
python -c "import pitchmeld; print(pitchmeld.__version__)"

Exit On Interrupt (EOI)

Many C/C++ written python modules won’t react to a ctrl-c interruption (or equivalent). The C/C++ part will first finish its execution and the python part will then handle any ctrl-c.

Calling pitchmeld.eoi() after loading the module

import pitchmeld
pitchmeld.eoi()

allows any ctrl-c to kill the C/C++ part immediately.

You can deactivate eoi() with pitchmeld.uneoi()

By default, this uncommon behavior is disabled.