History

[py] move midiconv.py import to file header

Paul Brossier committed 8 years ago

Commit 1f07bdd1 parent 44582b01 file · +2 −1Browse files

Showing the changes to python/lib (1 of 1 file). Show all

Unified · Split

python/lib/aubio/midiconv.py+2−1
@@ -4,6 +4,8 @@ · 3 unmodified lines
4__all__ = ['note2midi', 'midi2note', 'freq2note']4__all__ = ['note2midi', 'midi2note', 'freq2note']
5 5
6import sys6import sys
7from ._aubio import freqtomidi
8
7py3 = sys.version_info[0] == 39py3 = sys.version_info[0] == 3
8if py3:10if py3:
9 str_instances = str11 str_instances = str
@@ -71,6 +73,5 @@ def midi2note(midi): · 61 unmodified lines
71 73
72def freq2note(freq):74def freq2note(freq):
73 " convert frequency in Hz to nearest note name, e.g. [0, 22050.] -> [C-1, G9] "75 " convert frequency in Hz to nearest note name, e.g. [0, 22050.] -> [C-1, G9] "
74 from aubio import freqtomidi
75 nearest_note = int(freqtomidi(freq) + .5)76 nearest_note = int(freqtomidi(freq) + .5)
76 return midi2note(nearest_note)77 return midi2note(nearest_note)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t