projects
/
aubio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
[py] midi2note rounds to nearest integer midi note
[aubio.git]
/
python
/
lib
/
aubio
/
midiconv.py
diff --git
a/python/lib/aubio/midiconv.py
b/python/lib/aubio/midiconv.py
index
d3dc554
..
2161afe
100644
(file)
--- a/
python/lib/aubio/midiconv.py
+++ b/
python/lib/aubio/midiconv.py
@@
-72,4
+72,5
@@
def midi2note(midi):
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)