comparison src/scalar.c @ 205:f6fcf3bec020

Add xtract_midicent() convenience function to convert from frequency to MIDI cent
author Jamie Bullock <jamie@jamiebullock.com>
date Tue, 11 Mar 2014 18:14:45 +0000
parents 951035634fb1
children c6488df9e5c0
comparison
equal deleted inserted replaced
204:f262144347e7 205:f6fcf3bec020
981 } 981 }
982 982
983 return XTRACT_SUCCESS; 983 return XTRACT_SUCCESS;
984 } 984 }
985 985
986 986 int xtract_midicent(const double *data, const int N, const void *argv, double *result)
987 {
988 double f0 = *(double *)argv;
989 double note = 0.0;
990
991 note = 69 + log(f0 / 440.f) * 17.31234;
992 note *= 100;
993 note = round(note);
994
995 return XTRACT_SUCCESS;
996 }
997