Changes in / [7be77bb:cefa29d]
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/tests/test_note2midi.py
r7be77bb rcefa29d 4 4 from __future__ import unicode_literals 5 5 6 from aubio import note2midi, freq2note, note2freq 6 from aubio import note2midi, freq2note, note2freq, float_type 7 7 from nose2.tools import params 8 8 import unittest … … 128 128 def test_note2freq_under(self): 129 129 " make sure note2freq(A4) == 440" 130 self.assertEqual(440, note2freq("A4")) 130 if float_type == 'float32': 131 self.assertEqual(440, note2freq("A4")) 132 else: 133 self.assertLess(abs(note2freq("A4")-440), 1.e-12) 131 134 132 135 if __name__ == '__main__': -
src/mathutils.c
r7be77bb rcefa29d 523 523 /* log(freq/A-2)/log(2) */ 524 524 midi = freq / 6.875; 525 midi = LOG (midi) / 0.6931471805599 5;525 midi = LOG (midi) / 0.6931471805599453; 526 526 midi *= 12; 527 527 midi -= 3; … … 535 535 if (midi > 140.) return 0.; // avoid infs 536 536 freq = (midi + 3.) / 12.; 537 freq = EXP (freq * 0.6931471805599 5);537 freq = EXP (freq * 0.6931471805599453); 538 538 freq *= 6.875; 539 539 return freq;
Note: See TracChangeset
for help on using the changeset viewer.