- Timestamp:
- Oct 26, 2018, 8:51:32 PM (6 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master
- Children:
- 0629356
- Parents:
- d281698
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/ext/py-phasevoc.c
rd281698 r47b465c 1 1 #include "aubio-types.h" 2 2 3 static char Py_pvoc_doc[] = "pvoc object"; 3 static char Py_pvoc_doc[] = "" 4 "pvoc(win_s=512, hop_s=256)\n" 5 "\n" 6 "Phase vocoder.\n" 7 "\n" 8 "`pvoc` creates callable object implements a phase vocoder [1]_,\n" 9 "using the tricks detailed in [2]_.\n" 10 "\n" 11 "The call function takes one input of type `fvec` and of size\n" 12 "`hop_s`, and returns a `cvec` of length `win_s//2+1`.\n" 13 "\n" 14 "Parameters\n" 15 "----------\n" 16 "win_s : int\n" 17 " number of channels in the phase-vocoder.\n" 18 "hop_s : int\n" 19 " number of samples expected between each call\n" 20 "\n" 21 "Examples\n" 22 "--------\n" 23 ">>> x = aubio.fvec(256)\n" 24 ">>> pv = aubio.pvoc(512, 256)\n" 25 ">>> pv(x)\n" 26 "aubio cvec of 257 elements\n" 27 "\n" 28 "Default values for hop_s and win_s are provided:\n" 29 "\n" 30 ">>> pv = aubio.pvoc()\n" 31 ">>> pv.win_s, pv.hop_s\n" 32 "512, 256\n" 33 "\n" 34 "A `cvec` can be resynthesised using `rdo()`:\n" 35 "\n" 36 ">>> pv = aubio.pvoc(512, 256)\n" 37 ">>> y = aubio.cvec(512)\n" 38 ">>> x_reconstructed = pv.rdo(y)\n" 39 ">>> x_reconstructed.shape\n" 40 "(256,)\n" 41 "\n" 42 "References\n" 43 "----------\n" 44 ".. [1] James A. Moorer. The use of the phase vocoder in computer music\n" 45 " applications. `Journal of the Audio Engineering Society`,\n" 46 " 26(1/2):42–45, 1978.\n" 47 ".. [2] Amalia de Götzen, Nicolas Bernardini, and Daniel Arfib. Traditional\n" 48 " (?) implementations of a phase vocoder: the tricks of the trade.\n" 49 " In `Proceedings of the International Conference on Digital Audio\n" 50 " Effects` (DAFx-00), pages 37–44, University of Verona, Italy, 2000.\n" 51 " (`online version <" 52 "https://www.cs.princeton.edu/courses/archive/spr09/cos325/Bernardini.pdf" 53 ">`_).\n" 54 ""; 55 4 56 5 57 typedef struct … … 122 174 static PyMemberDef Py_pvoc_members[] = { 123 175 {"win_s", T_INT, offsetof (Py_pvoc, win_s), READONLY, 124 "size of the window"}, 176 "int: Size of phase vocoder analysis windows, in samples.\n" 177 ""}, 125 178 {"hop_s", T_INT, offsetof (Py_pvoc, hop_s), READONLY, 126 "size of the hop"}, 179 "int: Interval between two analysis, in samples.\n" 180 ""}, 127 181 { NULL } // sentinel 128 182 }; … … 176 230 static PyMethodDef Py_pvoc_methods[] = { 177 231 {"rdo", (PyCFunction) Py_pvoc_rdo, METH_VARARGS, 178 "synthesis of spectral grain"}, 179 {"set_window", (PyCFunction) Pyaubio_pvoc_set_window, METH_VARARGS, ""}, 232 "rdo(fftgrain)\n" 233 "\n" 234 "Read a new spectral grain and resynthesise the next `hop_s`\n" 235 "output samples.\n" 236 "\n" 237 "Parameters\n" 238 "----------\n" 239 "fftgrain : cvec\n" 240 " new input `cvec` to synthesize from, should be of size `win_s/2+1`\n" 241 "\n" 242 "Returns\n" 243 "-------\n" 244 "fvec\n" 245 " re-synthesised output of shape `(hop_s,)`\n" 246 "\n" 247 "Example\n" 248 "-------\n" 249 ">>> pv = aubio.pvoc(2048, 512)\n" 250 ">>> out = pv.rdo(aubio.cvec(2048))\n" 251 ">>> out.shape\n" 252 "(512,)\n" 253 ""}, 254 {"set_window", (PyCFunction) Pyaubio_pvoc_set_window, METH_VARARGS, 255 "set_window(window_type)\n" 256 "\n" 257 "Set window function\n" 258 "\n" 259 "Parameters\n" 260 "----------\n" 261 "window_type : str\n" 262 " the window type to use for this phase vocoder\n" 263 "\n" 264 "Raises\n" 265 "------\n" 266 "ValueError\n" 267 " If an unknown window type was given.\n" 268 "\n" 269 "See Also\n" 270 "--------\n" 271 "window : create a window.\n" 272 ""}, 180 273 {NULL} 181 274 };
Note: See TracChangeset
for help on using the changeset viewer.