shithub: aubio

Download patch

ref: 44582b0995d84c9289e362100172885d953a7263
parent: 4afeac2e223f4f13d2d754cee9dc41fc02103f85
author: Paul Brossier <piem@piem.org>
date: Mon Oct 29 19:55:51 EDT 2018

[py] midi2note rounds to nearest integer midi note

--- a/python/lib/aubio/midiconv.py
+++ b/python/lib/aubio/midiconv.py
@@ -72,4 +72,5 @@
 def freq2note(freq):
     " convert frequency in Hz to nearest note name, e.g. [0, 22050.] -> [C-1, G9] "
     from aubio import freqtomidi
-    return midi2note(int(freqtomidi(freq)))
+    nearest_note = int(freqtomidi(freq) + .5)
+    return midi2note(nearest_note)