shithub: aubio

ref: 0bb2d633db7f614b18087b1c0adbe391e1259ef0
dir: /python/ext/py-musicutils.h/

View raw version
#ifndef PY_AUBIO_MUSICUTILS_H
#define PY_AUBIO_MUSICUTILS_H

static char Py_aubio_window_doc[] = ""
"window(string, integer) -> fvec\n"
"\n"
"Create a window\n"
"\n"
"Example\n"
"-------\n"
"\n"
">>> window('hanningz', 1024)\n"
"array([  0.00000000e+00,   9.41753387e-06,   3.76403332e-05, ...,\n"
"         8.46982002e-05,   3.76403332e-05,   9.41753387e-06], dtype=float32)";

PyObject * Py_aubio_window(PyObject *self, PyObject *args);

static char Py_aubio_level_lin_doc[] = ""
"level_lin(x)\n"
"\n"
"Compute sound pressure level of `x`, on a linear scale.\n"
"\n"
"Parameters\n"
"----------\n"
"x : fvec\n"
"   input vector\n"
"\n"
"Returns\n"
"-------\n"
"float\n"
"   Linear level of `x`.\n"
"\n"
"Example\n"
"-------\n"
"\n"
">>> aubio.level_lin(aubio.fvec(numpy.ones(1024)))\n"
"1.0\n"
"\n"
"Note\n"
"----\n"
"Computed as the average of the squared amplitudes:\n"
"\n"
".. math:: L = \\frac {\\sum_{n=0}^{N-1} {x_n}^2} {N}\n"
"\n"
"See Also\n"
"--------\n"
"db_spl, silence_detection, level_detection\n"
"";

PyObject * Py_aubio_level_lin(PyObject *self, PyObject *args);

static char Py_aubio_db_spl_doc[] = ""
"db_spl(x)\n"
"\n"
"Compute Sound Pressure Level (SPL) of `x`, in dB.\n"
"\n"
"Parameters\n"
"----------\n"
"x : fvec\n"
"   input vector\n"
"\n"
"Returns\n"
"-------\n"
"float\n"
"   Level of `x`, in dB SPL.\n"
"\n"
"Example\n"
"-------\n"
"\n"
">>> aubio.db_spl(aubio.fvec(np.ones(1024)))\n"
"1.0\n"
">>> aubio.db_spl(0.7*aubio.fvec(np.ones(32)))\n"
"-3.098040819168091\n"
"\n"
"Note\n"
"----\n"
"Computed as `log10` of :py:func:`level_lin`:\n"
"\n"
".. math::\n"
"\n"
"   {SPL}_{dB} = log10{\\frac {\\sum_{n=0}^{N-1}{x_n}^2} {N}}\n"
"\n"
"This quantity is often incorrectly called 'loudness'.\n"
"\n"
"See Also\n"
"--------\n"
"level_lin, silence_detection, level_detection\n"
"";

PyObject * Py_aubio_db_spl(PyObject *self, PyObject *args);

static char Py_aubio_silence_detection_doc[] = ""
"silence_detection(vec, level)\n"
"\n"
"Check if level of `vec`, in dB SPL, is under a given threshold.\n"
"\n"
"Parameters\n"
"----------\n"
"vec : fvec\n"
"   input vector\n"
"level : float\n"
"   level threshold, in dB SPL\n"
"\n"
"Returns\n"
"-------\n"
"int\n"
"   `1` if level of `vec`, in dB SPL, is under `level`,\n"
"   `0` otherwise.\n"
"\n"
"Examples\n"
"--------\n"
"\n"
">>> aubio.silence_detection(aubio.fvec(32), -100.)\n"
"1\n"
">>> aubio.silence_detection(aubio.fvec(np.ones(32)), 0.)\n"
"0\n"
"\n"
"See Also\n"
"--------\n"
"level_detection, db_spl, level_lin\n"
"";

PyObject * Py_aubio_silence_detection(PyObject *self, PyObject *args);

static char Py_aubio_level_detection_doc[] = ""
"level_detection(vec, level)\n"
"\n"
"Check if `vec` is above threshold `level`, in dB SPL.\n"
"\n"
"Parameters\n"
"----------\n"
"vec : fvec\n"
"   input vector\n"
"level : float\n"
"   level threshold, in dB SPL\n"
"\n"
"Returns\n"
"-------\n"
"float\n"
"   `1.0` if level of `vec` in dB SPL is under `level`,\n"
"   `db_spl(vec)` otherwise.\n"
"\n"
"Example\n"
"-------\n"
"\n"
">>> aubio.level_detection(0.7*aubio.fvec(np.ones(1024)), -3.)\n"
"1.0\n"
">>> aubio.level_detection(0.7*aubio.fvec(np.ones(1024)), -4.)\n"
"-3.0980708599090576\n"
"\n"
"See Also\n"
"--------\n"
"silence_detection, db_spl, level_lin\n"
"";

PyObject * Py_aubio_level_detection(PyObject *self, PyObject *args);

static char Py_aubio_shift_doc[] = ""
"Swap left and right partitions of a vector\n"
"\n"
"Returns the swapped vector. The input vector is also modified.\n"
"\n"
"For a vector of length N, the partition is split at index N - N//2.\n"
"\n"
"Example\n"
"-------\n"
"\n"
">>> import numpy\n"
">>> shift(numpy.arange(3, dtype=aubio.float_type))\n"
"array([2., 0., 1.], dtype=" AUBIO_NPY_SMPL_STR ")";
PyObject * Py_aubio_shift(PyObject *self, PyObject *args);

static char Py_aubio_ishift_doc[] = ""
"Swap right and left partitions of a vector\n"
"\n"
"Returns the swapped vector. The input vector is also modified.\n"
"\n"
"Unlike with shift(), the partition is split at index N//2.\n"
"\n"
"Example\n"
"-------\n"
"\n"
">>> import numpy\n"
">>> ishift(numpy.arange(3, dtype=aubio.float_type))\n"
"array([1., 2., 0.], dtype=" AUBIO_NPY_SMPL_STR ")";
PyObject * Py_aubio_ishift(PyObject *self, PyObject *args);

#endif /* PY_AUBIO_MUSICUTILS_H */