shithub: aubio

Download patch

ref: 57ce9b2f6228bca21c1274137d100dc11bc199d3
parent: e3c4d00e60ec59b92cd40a38a787fb2a339d65ea
author: Paul Brossier <piem@piem.org>
date: Fri Oct 26 14:10:43 EDT 2018

[python] add docstrings to bintomidi and miditobin

--- a/python/ext/aubiomodule.c
+++ b/python/ext/aubiomodule.c
@@ -20,24 +20,60 @@
 ">>> b = alpha_norm(a, 9)";
 
 static char Py_bintomidi_doc[] = ""
-"bintomidi(float, samplerate = integer, fftsize = integer) -> float\n"
+"bintomidi(fftbin, samplerate, fftsize)\n"
 "\n"
-"Convert bin (float) to midi (float), given the sampling rate and the FFT size\n"
+"Convert FFT bin to frequency in midi note, given the sampling rate\n"
+"and the size of the FFT.\n"
 "\n"
+"Parameters\n"
+"----------\n"
+"fftbin : float\n"
+"   input frequency bin\n"
+"samplerate : float\n"
+"   sampling rate of the signal\n"
+"fftsize : float\n"
+"   size of the FFT\n"
+"\n"
+"Returns\n"
+"-------\n"
+"float\n"
+"   Frequency converted to midi note.\n"
+"\n"
 "Example\n"
 "-------\n"
 "\n"
-">>> midi = bintomidi(float, samplerate = 44100, fftsize = 1024)";
+">>> aubio.bintomidi(10, 44100, 1024)\n"
+"68.62871551513672\n"
+"";
 
 static char Py_miditobin_doc[] = ""
-"miditobin(float, samplerate = integer, fftsize = integer) -> float\n"
+"miditobin(midi, samplerate, fftsize)\n"
 "\n"
-"Convert midi (float) to bin (float), given the sampling rate and the FFT size\n"
+"Convert frequency in midi note to FFT bin, given the sampling rate\n"
+"and the size of the FFT.\n"
 "\n"
-"Example\n"
+"Parameters\n"
+"----------\n"
+"midi : float\n"
+"   input frequency, in midi note\n"
+"samplerate : float\n"
+"   sampling rate of the signal\n"
+"fftsize : float\n"
+"   size of the FFT\n"
+"\n"
+"Returns\n"
 "-------\n"
+"float\n"
+"   Frequency converted to FFT bin.\n"
 "\n"
-">>> bin = miditobin(midi, samplerate = 44100, fftsize = 1024)";
+"Examples\n"
+"--------\n"
+"\n"
+">>> aubio.miditobin(69, 44100, 1024)\n"
+"10.216779708862305\n"
+">>> aubio.miditobin(75.08, 32000, 512)\n"
+"10.002175331115723\n"
+"";
 
 static char Py_bintofreq_doc[] = ""
 "bintofreq(float, samplerate = integer, fftsize = integer) -> float\n"