Changeset cefa29d


Ignore:
Timestamp:
Oct 30, 2018, 10:24:08 AM (6 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master
Children:
4bc10e2
Parents:
7be77bb (diff), 27ed546 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'feature/note2freq'

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/tests/test_note2midi.py

    r7be77bb rcefa29d  
    44from __future__ import unicode_literals
    55
    6 from aubio import note2midi, freq2note, note2freq
     6from aubio import note2midi, freq2note, note2freq, float_type
    77from nose2.tools import params
    88import unittest
     
    128128    def test_note2freq_under(self):
    129129        " 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)
    131134
    132135if __name__ == '__main__':
  • src/mathutils.c

    r7be77bb rcefa29d  
    523523  /* log(freq/A-2)/log(2) */
    524524  midi = freq / 6.875;
    525   midi = LOG (midi) / 0.69314718055995;
     525  midi = LOG (midi) / 0.6931471805599453;
    526526  midi *= 12;
    527527  midi -= 3;
     
    535535  if (midi > 140.) return 0.; // avoid infs
    536536  freq = (midi + 3.) / 12.;
    537   freq = EXP (freq * 0.69314718055995);
     537  freq = EXP (freq * 0.6931471805599453);
    538538  freq *= 6.875;
    539539  return freq;
Note: See TracChangeset for help on using the changeset viewer.