convert

ketos.audio.annotation.convert(x, unit)[source]

Convert a quantity specified as a string with SI units, e.g. “7kg” to a float with the specified unit, e.g. ‘g’.

If the input is not a string, the output will be the same as the input.

Args:
x: str

Value given as a string with SI units, e.g. “11kHz”

unit: str

Desired conversion unit “Hz”

Returns:
yfloat

Value in specified unit.