Changeset 16e2bb0
 Timestamp:
 Oct 26, 2018, 7:19:49 PM (3 years ago)
 Branches:
 feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master
 Children:
 58eb250
 Parents:
 7a7dea2
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

python/ext/pymusicutils.h
r7a7dea2 r16e2bb0 3 3 4 4 static char Py_aubio_window_doc[] = "" 5 "window(string, integer) > fvec\n" 6 "\n" 7 "Create a window\n" 8 "\n" 9 "Example\n" 10 "\n" 11 "\n" 12 ">>> window('hanningz', 1024)\n" 5 "window(window_type, size)\n" 6 "\n" 7 "Create a window of length `size`. `window_type` should be one\n" 8 "of the following:\n" 9 "\n" 10 " `default` (same as `hanningz`).\n" 11 " `ones`\n" 12 " `rectangle`\n" 13 " `hamming`\n" 14 " `hanning`\n" 15 " `hanningz` [1]_\n" 16 " `blackman`\n" 17 " `blackman_harris`\n" 18 " `gaussian`\n" 19 " `welch`\n" 20 " `parzen`\n" 21 "\n" 22 "Parameters\n" 23 "\n" 24 "window_type : str\n" 25 " Type of window.\n" 26 "size : int\n" 27 " Length of window.\n" 28 "\n" 29 "Returns\n" 30 "\n" 31 "fvec\n" 32 " Array of shape `(length,)` containing the new window.\n" 33 "\n" 34 "See Also\n" 35 "\n" 36 "pvoc, fft\n" 37 "\n" 38 "Examples\n" 39 "\n" 40 "Compute a zerophase Hann window on `1024` points:\n" 41 "\n" 42 ">>> aubio.window('hanningz', 1024)\n" 13 43 "array([ 0.00000000e+00, 9.41753387e06, 3.76403332e05, ...,\n" 14 " 8.46982002e05, 3.76403332e05, 9.41753387e06], dtype=float32)"; 44 " 8.46982002e05, 3.76403332e05, 9.41753387e06], dtype=float32)\n" 45 "\n" 46 "Plot different window types with `matplotlib <https://matplotlib.org/>`_:\n" 47 "\n" 48 ">>> import matplotlib.pyplot as plt\n" 49 ">>> modes = ['default', 'ones', 'rectangle', 'hamming', 'hanning',\n" 50 "... 'hanningz', 'blackman', 'blackman_harris', 'gaussian',\n" 51 "... 'welch', 'parzen']; n = 2048\n" 52 ">>> for m in modes: plt.plot(aubio.window(m, n), label=m)\n" 53 "...\n" 54 ">>> plt.legend(); plt.show()\n" 55 "\n" 56 "Note\n" 57 "\n" 58 "The following examples contain the equivalent source code to compute\n" 59 "each type of window with `NumPy <https://numpy.org>`_:\n" 60 "\n" 61 ">>> n = 1024; x = np.arange(n, dtype=aubio.float_type)\n" 62 ">>> ones = np.ones(n).astype(aubio.float_type)\n" 63 ">>> rectangle = 0.5 * ones\n" 64 ">>> hanning = 0.5  0.5 * np.cos(2 * np.pi * x / n)\n" 65 ">>> hanningz = 0.5 * (1  np.cos(2 * np.pi * x / n))\n" 66 ">>> hamming = 0.54  0.46 * np.cos(2.*np.pi * x / (n  1))\n" 67 ">>> blackman = 0.42 \\\n" 68 "...  0.50 * np.cos(2 * np.pi * x / (n  1)) \\\n" 69 "... + 0.08 * np.cos(4 * np.pi * x / (n  1))\n" 70 ">>> blackman_harris = 0.35875 \\\n" 71 "...  0.48829 * np.cos(2 * np.pi * x / (n  1)) \\\n" 72 "... + 0.14128 * np.cos(4 * np.pi * x / (n  1)) \\\n" 73 "... + 0.01168 * np.cos(6 * np.pi * x / (n  1))\n" 74 ">>> gaussian = np.exp(  0.5 * ((x  0.5 * (n  1)) \\\n" 75 "... / (0.25 * (n  1)) )**2 )\n" 76 ">>> welch = 1  ((2 * x  n) / (n + 1))**2\n" 77 ">>> parzen = 1  np.abs((2 * x  n) / (n + 1))\n" 78 ">>> default = hanningz\n" 79 "References\n" 80 "\n" 81 #if 0 82 "`Window function <https://en.wikipedia.org/wiki/Window_function>`_ on\n" 83 "Wikipedia.\n" 84 "\n" 85 #endif 86 ".. [1] Amalia de Götzen, Nicolas Bernardini, and Daniel Arfib. Traditional\n" 87 " (?) implementations of a phase vocoder: the tricks of the trade.\n" 88 " In *Proceedings of the International Conference on Digital Audio\n" 89 " Effects* (DAFx00), pages 37–44, University of Verona, Italy, 2000.\n" 90 " (`online version <" 91 "https://www.cs.princeton.edu/courses/archive/spr09/cos325/Bernardini.pdf" 92 ">`_).\n" 93 ""; 15 94 16 95 PyObject * Py_aubio_window(PyObject *self, PyObject *args);
Note: See TracChangeset
for help on using the changeset viewer.