Showing the changes to python/ext (1 of 1 file). Show all
Unified · Split
| @@ -12,53 +12,78 @@ typedef struct · 11 unmodified lines | ||
| 12 | 12 | } Py_sink; |
| 13 | 13 | |
| 14 | 14 | static char Py_sink_doc[] = "" |
| 15 | −" __new__(path, samplerate = 44100, channels = 1)\n" | |
| 15 | +"sink(path, samplerate=44100, channels=1)\n" | |
| 16 | 16 | "\n" |
| 17 | −" Create a new sink, opening the given path for writing.\n" | |
| 17 | +"Open `path` to write a WAV file.\n" | |
| 18 | 18 | "\n" |
| 19 | −" Examples\n" | |
| 20 | −" --------\n" | |
| 19 | +"Parameters\n" | |
| 20 | +"----------\n" | |
| 21 | +"path : str\n" | |
| 22 | +" Pathname of the file to be opened for writing.\n" | |
| 23 | +"samplerate : int\n" | |
| 24 | +" Sampling rate of the file, in Hz.\n" | |
| 25 | +"channels : int\n" | |
| 26 | +" Number of channels to create the file with.\n" | |
| 21 | 27 | "\n" |
| 22 | −" Create a new sink at 44100Hz, mono:\n" | |
| 28 | +"Examples\n" | |
| 29 | +"--------\n" | |
| 23 | 30 | "\n" |
| 24 | −" >>> sink('/tmp/t.wav')\n" | |
| 31 | +"Create a new sink at 44100Hz, mono:\n" | |
| 25 | 32 | "\n" |
| 26 | −" Create a new sink at 8000Hz, mono:\n" | |
| 33 | +">>> snk = aubio.sink('out.wav')\n" | |
| 27 | 34 | "\n" |
| 28 | −" >>> sink('/tmp/t.wav', samplerate = 8000)\n" | |
| 35 | +"Create a new sink at 32000Hz, stereo, write 100 samples into it:\n" | |
| 29 | 36 | "\n" |
| 30 | −" Create a new sink at 32000Hz, stereo:\n" | |
| 37 | +">>> snk = aubio.sink('out.wav', samplerate=16000, channels=3)\n" | |
| 38 | +">>> snk(aubio.fvec(100), 100)\n" | |
| 31 | 39 | "\n" |
| 32 | −" >>> sink('/tmp/t.wav', samplerate = 32000, channels = 2)\n" | |
| 40 | +"Open a new sink at 48000Hz, stereo, write `1234` samples into it:\n" | |
| 33 | 41 | "\n" |
| 34 | −" Create a new sink at 32000Hz, 5 channels:\n" | |
| 42 | +">>> with aubio.sink('out.wav', samplerate=48000, channels=2) as src:\n" | |
| 43 | +"... snk(aubio.fvec(1024), 1024)\n" | |
| 44 | +"... snk(aubio.fvec(210), 210)\n" | |
| 45 | +"...\n" | |
| 35 | 46 | "\n" |
| 36 | −" >>> sink('/tmp/t.wav', channels = 5, samplerate = 32000)\n" | |
| 37 | −"\n" | |
| 38 | −" __call__(vec, write)\n" | |
| 39 | −" x(vec,write) <==> x.do(vec, write)\n" | |
| 40 | −"\n" | |
| 41 | −" Write vector to sink.\n" | |
| 42 | −"\n" | |
| 43 | −" See also\n" | |
| 44 | −" --------\n" | |
| 45 | −" aubio.sink.do\n" | |
| 47 | +"See also\n" | |
| 48 | +"--------\n" | |
| 49 | +"source: read audio samples from a file.\n" | |
| 46 | 50 | "\n"; |
| 47 | 51 | |
| 48 | 52 | static char Py_sink_do_doc[] = "" |
| 49 | −"x.do(vec, write) <==> x(vec, write)\n" | |
| 53 | +"do(vec, write)\n" | |
| 50 | 54 | "\n" |
| 51 | −"write monophonic vector to sink"; | |
| 55 | +"Write a single channel vector to sink.\n" | |
| 56 | +"\n" | |
| 57 | +"Parameters\n" | |
| 58 | +"----------\n" | |
| 59 | +"vec : fvec\n" | |
| 60 | +" input vector `(n,)` where `n >= 0`.\n" | |
| 61 | +"write : int\n" | |
| 62 | +" Number of samples to write.\n" | |
| 63 | +""; | |
| 52 | 64 | |
| 53 | 65 | static char Py_sink_do_multi_doc[] = "" |
| 54 | −"x.do_multi(mat, write)\n" | |
| 66 | +"do_multi(mat, write)\n" | |
| 67 | +"\n" | |
| 68 | +"Write a matrix containing vectors from multiple channels to sink.\n" | |
| 55 | 69 | "\n" |
| 56 | −"write polyphonic vector to sink"; | |
| 70 | +"Parameters\n" | |
| 71 | +"----------\n" | |
| 72 | +"mat : numpy.ndarray\n" | |
| 73 | +" input matrix of shape `(channels, n)`, where `n >= 0`.\n" | |
| 74 | +"write : int\n" | |
| 75 | +" Number of frames to write.\n" | |
| 76 | +""; | |
| 57 | 77 | |
| 58 | 78 | static char Py_sink_close_doc[] = "" |
| 59 | −"x.close()\n" | |
| 79 | +"close()\n" | |
| 80 | +"\n" | |
| 81 | +"Close this sink now.\n" | |
| 60 | 82 | "\n" |
| 61 | −"close this sink now"; | |
| 83 | +"By default, the file gets closed when deleting the object. Explicitely\n" | |
| 84 | +"closing a sink can be useful to control the number of file opened\n" | |
| 85 | +"simultaneously.\n" | |
| 86 | +""; | |
| 62 | 87 | |
| 63 | 88 | static PyObject * |
| 64 | 89 | Py_sink_new (PyTypeObject * pytype, PyObject * args, PyObject * kwds) |
| @@ -188,11 +213,11 @@ Py_sink_do_multi(Py_sink * self, PyObject * args) · 123 unmodified lines | ||
| 188 | 213 | |
| 189 | 214 | static PyMemberDef Py_sink_members[] = { |
| 190 | 215 | {"uri", T_STRING, offsetof (Py_sink, uri), READONLY, |
| 191 | − "path at which the sink was created"}, | |
| 216 | + "str (read-only): Path at which the sink was created."}, | |
| 192 | 217 | {"samplerate", T_INT, offsetof (Py_sink, samplerate), READONLY, |
| 193 | − "samplerate at which the sink was created"}, | |
| 218 | + "int (read-only): Samplerate at which the sink was created."}, | |
| 194 | 219 | {"channels", T_INT, offsetof (Py_sink, channels), READONLY, |
| 195 | − "number of channels with which the sink was created"}, | |
| 220 | + "int (read-only): Number of channels with which the sink was created."}, | |
| 196 | 221 | { NULL } // sentinel |
| 197 | 222 | }; |
| 198 | 223 | |