comparison src/descriptors.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 246c203cc733
children ef80f7c52c6d
comparison
equal deleted inserted replaced
204:f262144347e7 205:f6fcf3bec020
86 *argv_unit = XTRACT_HERTZ; 86 *argv_unit = XTRACT_HERTZ;
87 break; 87 break;
88 case XTRACT_F0: 88 case XTRACT_F0:
89 case XTRACT_FAILSAFE_F0: 89 case XTRACT_FAILSAFE_F0:
90 case XTRACT_WAVELET_F0: 90 case XTRACT_WAVELET_F0:
91 case XTRACT_MIDICENT:
91 *argv_min = XTRACT_SR_LOWER_LIMIT; 92 *argv_min = XTRACT_SR_LOWER_LIMIT;
92 *argv_max = XTRACT_SR_UPPER_LIMIT; 93 *argv_max = XTRACT_SR_UPPER_LIMIT;
93 *argv_def = XTRACT_SR_DEFAULT; 94 *argv_def = XTRACT_SR_DEFAULT;
94 *argv_unit = XTRACT_HERTZ; 95 *argv_unit = XTRACT_HERTZ;
95 break; 96 break;
228 break; 229 break;
229 case XTRACT_LOWEST_VALUE: 230 case XTRACT_LOWEST_VALUE:
230 case XTRACT_F0: 231 case XTRACT_F0:
231 case XTRACT_FAILSAFE_F0: 232 case XTRACT_FAILSAFE_F0:
232 case XTRACT_WAVELET_F0: 233 case XTRACT_WAVELET_F0:
234 case XTRACT_MIDICENT:
233 *argv_donor = XTRACT_ANY; 235 *argv_donor = XTRACT_ANY;
234 break; 236 break;
235 case XTRACT_MFCC: 237 case XTRACT_MFCC:
236 *argv_donor = XTRACT_INIT_MFCC; 238 *argv_donor = XTRACT_INIT_MFCC;
237 break; 239 break;
378 case XTRACT_DIFFERENCE_VECTOR: 380 case XTRACT_DIFFERENCE_VECTOR:
379 *data_format = XTRACT_SUBFRAMES; 381 *data_format = XTRACT_SUBFRAMES;
380 break; 382 break;
381 case XTRACT_ATTACK_TIME: 383 case XTRACT_ATTACK_TIME:
382 case XTRACT_DECAY_TIME: 384 case XTRACT_DECAY_TIME:
385 case XTRACT_MIDICENT:
383 default: 386 default:
384 *data_format = XTRACT_NO_DATA; 387 *data_format = XTRACT_NO_DATA;
385 break; 388 break;
386 } 389 }
387 390
618 strcpy(desc, "Extract the fundamental frequency of a signal (wavelet method)"); 621 strcpy(desc, "Extract the fundamental frequency of a signal (wavelet method)");
619 strcpy(p_desc, 622 strcpy(p_desc,
620 "Extract the fundamental frequency of an audio signal (wavelet method)"); 623 "Extract the fundamental frequency of an audio signal (wavelet method)");
621 strcpy(author, "Antoine Schmitt"); 624 strcpy(author, "Antoine Schmitt");
622 break; 625 break;
626 case XTRACT_MIDICENT:
627 strcpy(name, "midicent");
628 strcpy(p_name, "Frequency to MIDI Cent conversion");
629 strcpy(desc, "Convert frequency in Hertz to Pitch in MIDI cents");
630 strcpy(p_desc, "Convert frequency in Hertz to Pitch in MIDI cents");
631 strcpy(author, "Jamie Bullock");
632 break;
623 case XTRACT_TONALITY: 633 case XTRACT_TONALITY:
624 strcpy(name, "tonality"); 634 strcpy(name, "tonality");
625 strcpy(p_name, "Tonality"); 635 strcpy(p_name, "Tonality");
626 strcpy(desc, "Extract the tonality of a spectrum"); 636 strcpy(desc, "Extract the tonality of a spectrum");
627 strcpy(p_desc, "Extract the tonality an audio spectrum"); 637 strcpy(p_desc, "Extract the tonality an audio spectrum");
991 case XTRACT_SPECTRAL_INHARMONICITY: 1001 case XTRACT_SPECTRAL_INHARMONICITY:
992 case XTRACT_LOWEST_VALUE: 1002 case XTRACT_LOWEST_VALUE:
993 case XTRACT_F0: 1003 case XTRACT_F0:
994 case XTRACT_FAILSAFE_F0: 1004 case XTRACT_FAILSAFE_F0:
995 case XTRACT_WAVELET_F0: 1005 case XTRACT_WAVELET_F0:
1006 case XTRACT_MIDICENT:
996 case XTRACT_FLATNESS_DB: 1007 case XTRACT_FLATNESS_DB:
997 case XTRACT_TONALITY: 1008 case XTRACT_TONALITY:
998 *argc = 1; 1009 *argc = 1;
999 *argv_type = XTRACT_FLOAT; 1010 *argv_type = XTRACT_FLOAT;
1000 break; 1011 break;
1115 case XTRACT_SUM: 1126 case XTRACT_SUM:
1116 case XTRACT_HPS: 1127 case XTRACT_HPS:
1117 case XTRACT_F0: 1128 case XTRACT_F0:
1118 case XTRACT_FAILSAFE_F0: 1129 case XTRACT_FAILSAFE_F0:
1119 case XTRACT_WAVELET_F0: 1130 case XTRACT_WAVELET_F0:
1131 case XTRACT_MIDICENT:
1120 case XTRACT_FLUX: 1132 case XTRACT_FLUX:
1121 case XTRACT_LNORM: 1133 case XTRACT_LNORM:
1122 case XTRACT_NONZERO_COUNT: 1134 case XTRACT_NONZERO_COUNT:
1123 *is_scalar = XTRACT_TRUE; 1135 *is_scalar = XTRACT_TRUE;
1124 break; 1136 break;
1193 case XTRACT_SUM: 1205 case XTRACT_SUM:
1194 case XTRACT_HPS: 1206 case XTRACT_HPS:
1195 case XTRACT_F0: 1207 case XTRACT_F0:
1196 case XTRACT_FAILSAFE_F0: 1208 case XTRACT_FAILSAFE_F0:
1197 case XTRACT_WAVELET_F0: 1209 case XTRACT_WAVELET_F0:
1210 case XTRACT_MIDICENT:
1198 case XTRACT_NONZERO_COUNT: 1211 case XTRACT_NONZERO_COUNT:
1199 case XTRACT_AUTOCORRELATION: 1212 case XTRACT_AUTOCORRELATION:
1200 case XTRACT_AMDF: 1213 case XTRACT_AMDF:
1201 case XTRACT_ASDF: 1214 case XTRACT_ASDF:
1202 case XTRACT_BARK_COEFFICIENTS: 1215 case XTRACT_BARK_COEFFICIENTS:
1268 case XTRACT_ROLLOFF: 1281 case XTRACT_ROLLOFF:
1269 *result_unit = XTRACT_HERTZ; 1282 *result_unit = XTRACT_HERTZ;
1270 *result_min = 0.0; 1283 *result_min = 0.0;
1271 *result_max = XTRACT_SR_UPPER_LIMIT / 2.0; 1284 *result_max = XTRACT_SR_UPPER_LIMIT / 2.0;
1272 break; 1285 break;
1286 case XTRACT_MIDICENT:
1287 *result_unit = XTRACT_MIDI_CENT;
1288 *result_min = 0.0;
1289 *result_max = 12700;
1273 case XTRACT_ZCR: 1290 case XTRACT_ZCR:
1274 *result_unit = XTRACT_HERTZ; 1291 *result_unit = XTRACT_HERTZ;
1275 *result_min = 0.0; 1292 *result_min = 0.0;
1276 *result_max = XTRACT_ANY; 1293 *result_max = XTRACT_ANY;
1277 break; 1294 break;