shithub: aubio

Download patch

ref: 1f07bdd657ec5113d783d01e5d7a650d8e9412cb
parent: 44582b0995d84c9289e362100172885d953a7263
author: Paul Brossier <piem@piem.org>
date: Mon Oct 29 19:57:00 EDT 2018

[py] move midiconv.py import to file header

--- a/python/lib/aubio/midiconv.py
+++ b/python/lib/aubio/midiconv.py
@@ -4,6 +4,8 @@
 __all__ = ['note2midi', 'midi2note', 'freq2note']
 
 import sys
+from ._aubio import freqtomidi
+
 py3 = sys.version_info[0] == 3
 if py3:
     str_instances = str
@@ -71,6 +73,5 @@
 
 def freq2note(freq):
     " convert frequency in Hz to nearest note name, e.g. [0, 22050.] -> [C-1, G9] "
-    from aubio import freqtomidi
     nearest_note = int(freqtomidi(freq) + .5)
     return midi2note(nearest_note)