annotate src/descriptors.c @ 55:4ea1a8838b14

Finished the essentials of descriptors.c
author Jamie Bullock <jamie@postlude.co.uk>
date Sun, 21 Jan 2007 14:40:23 +0000
parents 9762d7e3d129
children 450712b21565
rev   line source
jamie@50 1 /* libxtract feature extraction library
jamie@50 2 *
jamie@50 3 * Copyright (C) 2006 Jamie Bullock
jamie@50 4 *
jamie@50 5 * This program is free software; you can redistribute it and/or modify
jamie@50 6 * it under the terms of the GNU General Public License as published by
jamie@50 7 * the Free Software Foundation; either version 2 of the License, or
jamie@50 8 * (at your option) any later version.
jamie@50 9 *
jamie@50 10 * This program is distributed in the hope that it will be useful,
jamie@50 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
jamie@50 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
jamie@50 13 * GNU General Public License for more details.
jamie@50 14 *
jamie@50 15 * You should have received a copy of the GNU General Public License
jamie@50 16 * along with this program; if not, write to the Free Software
jamie@50 17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
jamie@50 18 * USA.
jamie@50 19 */
jamie@50 20
jamie@50 21 #include "xtract/libxtract.h"
jamie@50 22 #include <stdlib.h>
jamie@50 23 #include <string.h>
jamie@50 24 #define XTRACT
jamie@50 25
jamie@50 26 void *xtract_make_descriptors(){
jamie@52 27
jamie@50 28 t_function_descriptor *fd, *d;
jamie@55 29 t_type *argv_type;
jamie@50 30 int f , F;
jamie@55 31 char *name, *p_name, *desc, *p_desc, *author, *argv_donor;
jamie@55 32 float *argv_min, *argv_max, *argv_def, *result_min, *result_max;
jamie@51 33 int *argc, *year;
jamie@54 34 t_vector *data_format;
jamie@55 35 t_unit *data_unit, *argv_unit, *result_unit;
jamie@55 36 t_bool *is_scalar;
jamie@55 37 t_vector *result_format;
jamie@52 38
jamie@50 39 f = F = XTRACT_FEATURES;
jamie@50 40
jamie@50 41 fd = malloc(XTRACT_FEATURES * sizeof(t_function_descriptor));
jamie@50 42
jamie@55 43 /* FIX - this file probably needs a rewrite for readability */
jamie@51 44
jamie@50 45 while(f--){
jamie@51 46
jamie@50 47 d = &fd[f];
jamie@51 48 argc = &d->argc;
jamie@55 49 argv_type = &d->argv.type;
jamie@51 50
jamie@50 51 switch(f){
jamie@52 52
jamie@50 53 case VARIANCE:
jamie@50 54 case STANDARD_DEVIATION:
jamie@50 55 case AVERAGE_DEVIATION:
jamie@52 56 case SPECTRAL_VARIANCE:
jamie@52 57 case SPECTRAL_STANDARD_DEVIATION:
jamie@52 58 case SPECTRAL_AVERAGE_DEVIATION:
jamie@52 59 case SPECTRAL_INHARMONICITY:
jamie@50 60 case ODD_EVEN_RATIO:
jamie@50 61 case LOWEST_VALUE:
jamie@50 62 case F0:
jamie@50 63 case FAILSAFE_F0:
jamie@50 64 case TONALITY:
jamie@51 65 *argc = 1;
jamie@55 66 *argv_type = FLOAT;
jamie@50 67 break;
jamie@50 68 case SKEWNESS:
jamie@50 69 case KURTOSIS:
jamie@52 70 case SPECTRAL_SKEWNESS:
jamie@52 71 case SPECTRAL_KURTOSIS:
jamie@54 72 case SPECTRUM:
jamie@52 73 case PEAK_SPECTRUM:
jamie@52 74 case HARMONIC_SPECTRUM:
jamie@50 75 case NOISINESS:
jamie@50 76 case CREST:
jamie@55 77 case ROLLOFF:
jamie@51 78 *argc = 2;
jamie@55 79 *argv_type = FLOAT;
jamie@50 80 break;
jamie@50 81 case MFCC:
jamie@51 82 *argc = 1;
jamie@55 83 *argv_type = MEL_FILTER;
jamie@50 84 break;
jamie@50 85 case BARK_COEFFICIENTS:
jamie@51 86 *argc = BARK_BANDS;
jamie@55 87 *argv_type = INT;
jamie@50 88 break;
jamie@55 89 case MEAN:
jamie@55 90 case SPECTRAL_MEAN:
jamie@52 91 case SPECTRAL_CENTROID:
jamie@50 92 case IRREGULARITY_K:
jamie@50 93 case IRREGULARITY_J:
jamie@50 94 case TRISTIMULUS_1:
jamie@50 95 case TRISTIMULUS_2:
jamie@50 96 case TRISTIMULUS_3:
jamie@50 97 case SMOOTHNESS:
jamie@50 98 case FLATNESS:
jamie@50 99 case SPREAD:
jamie@50 100 case ZCR:
jamie@50 101 case LOUDNESS:
jamie@50 102 case HIGHEST_VALUE:
jamie@50 103 case SUM:
jamie@50 104 case RMS_AMPLITUDE:
jamie@50 105 case POWER:
jamie@50 106 case SHARPNESS:
jamie@52 107 case SPECTRAL_SLOPE:
jamie@50 108 case HPS:
jamie@50 109 case FLUX:
jamie@50 110 case ATTACK_TIME:
jamie@50 111 case DECAY_TIME:
jamie@50 112 case DELTA_FEATURE:
jamie@50 113 case AUTOCORRELATION_FFT:
jamie@50 114 case DCT:
jamie@50 115 case AUTOCORRELATION:
jamie@50 116 case AMDF:
jamie@50 117 case ASDF:
jamie@55 118 default:
jamie@51 119 *argc = 0;
jamie@50 120 break;
jamie@55 121 }
jamie@55 122
jamie@55 123 argv_min = &d->argv.min[0];
jamie@55 124 argv_max = &d->argv.max[0];
jamie@55 125 argv_def = &d->argv.def[0];
jamie@55 126 argv_unit = &d->argv.unit[0];
jamie@55 127
jamie@55 128 switch (f) {
jamie@55 129 /* argc = 1 */
jamie@55 130 case VARIANCE:
jamie@55 131 case SPECTRAL_VARIANCE:
jamie@55 132 case STANDARD_DEVIATION:
jamie@55 133 case AVERAGE_DEVIATION:
jamie@55 134 case SPECTRAL_STANDARD_DEVIATION:
jamie@55 135 case SPECTRAL_AVERAGE_DEVIATION:
jamie@55 136 case LOWEST_VALUE:
jamie@55 137 case TONALITY:
jamie@55 138 case MFCC:
jamie@55 139 *argv_min = ANY;
jamie@55 140 *argv_max = ANY;
jamie@55 141 *argv_def = ANY;
jamie@55 142 *argv_unit = ANY;
jamie@55 143 case SPECTRAL_INHARMONICITY:
jamie@55 144 case ODD_EVEN_RATIO:
jamie@55 145 *argv_min = 0.f;
jamie@55 146 *argv_max = SR_UPPER_LIMIT / 2;
jamie@55 147 *argv_def = FUNDAMENTAL_DEFAULT;
jamie@55 148 *argv_unit = HERTZ;
jamie@55 149 case F0:
jamie@55 150 case FAILSAFE_F0:
jamie@55 151 *argv_min = SR_LOWER_LIMIT;
jamie@55 152 *argv_max = SR_UPPER_LIMIT;
jamie@55 153 *argv_def = SR_DEFAULT;
jamie@55 154 *argv_unit = HERTZ;
jamie@55 155 /* argc = 2 */;
jamie@55 156 case ROLLOFF:
jamie@55 157 *argv_min = FFT_BANDS_MIN;
jamie@55 158 *argv_max = FFT_BANDS_MAX;
jamie@55 159 *argv_def = SPEC_BW_DEF ;
jamie@55 160 *argv_unit = HERTZ;
jamie@55 161 *(argv_min + 1) = 0.f;
jamie@55 162 *(argv_max + 1) = 100.f;
jamie@55 163 *(argv_def + 1) = 95.f;
jamie@55 164 *(argv_unit + 1) = PERCENT;
jamie@55 165 case SPECTRUM:
jamie@55 166 *argv_min = SR_LOWER_LIMIT / 2;
jamie@55 167 *argv_max = SR_UPPER_LIMIT / 2;
jamie@55 168 *argv_def = SR_DEFAULT / 2;
jamie@55 169 *argv_unit = HERTZ;
jamie@55 170 *(argv_min + 1) = 0;
jamie@55 171 *(argv_max + 1) = 3 ;
jamie@55 172 *(argv_def + 1) = 0;
jamie@55 173 *(argv_unit + 1) = NONE;
jamie@55 174 case PEAK_SPECTRUM:
jamie@55 175 *argv_min = SR_LOWER_LIMIT / 2;
jamie@55 176 *argv_max = SR_UPPER_LIMIT / 2;
jamie@55 177 *argv_def = SR_DEFAULT / 2;
jamie@55 178 *argv_unit = HERTZ;
jamie@55 179 *(argv_min + 1) = 0.f;
jamie@55 180 *(argv_max + 1) = 100.f ;
jamie@55 181 *(argv_def + 1) = 10.f ;
jamie@55 182 *(argv_unit + 1) = PERCENT;
jamie@55 183 case HARMONIC_SPECTRUM:
jamie@55 184 *argv_min = 0.f;
jamie@55 185 *argv_max = SR_UPPER_LIMIT / 2;
jamie@55 186 *argv_def = FUNDAMENTAL_DEFAULT;
jamie@55 187 *argv_unit = HERTZ;
jamie@55 188 *(argv_min + 1) = 0.f;
jamie@55 189 *(argv_max + 1) = 1.f ;
jamie@55 190 *(argv_def + 1) = .1f ;
jamie@55 191 *(argv_unit + 1) = NONE;
jamie@55 192 case NOISINESS:
jamie@55 193 case SKEWNESS:
jamie@55 194 case KURTOSIS:
jamie@55 195 case SPECTRAL_SKEWNESS:
jamie@55 196 case SPECTRAL_KURTOSIS:
jamie@55 197 case CREST:
jamie@55 198 *argv_min = NONE;
jamie@55 199 *argv_max = NONE;
jamie@55 200 *argv_def = NONE;
jamie@55 201 *argv_unit = NONE;
jamie@55 202 *(argv_min + 1) = NONE;
jamie@55 203 *(argv_max + 1) = NONE;
jamie@55 204 *(argv_def + 1) = NONE;
jamie@55 205 *(argv_unit + 1) = NONE;
jamie@55 206 case BARK_COEFFICIENTS:
jamie@55 207 /* BARK_COEFFICIENTS is special because argc = BARK_BANDS */
jamie@50 208 default:
jamie@55 209 *argv_min = NONE;
jamie@55 210 *argv_max = NONE;
jamie@55 211 *argv_def = NONE;
jamie@55 212 *argv_unit = NONE;
jamie@55 213 }
jamie@55 214
jamie@55 215 argv_donor = &d->argv.donor[0];
jamie@55 216
jamie@55 217 switch (f) {
jamie@55 218 /* argc = 1 */
jamie@55 219 case VARIANCE:
jamie@55 220 *argv_donor = MEAN;
jamie@55 221 break;
jamie@55 222 case SPECTRAL_VARIANCE:
jamie@55 223 *argv_donor = SPECTRAL_MEAN;
jamie@55 224 break;
jamie@55 225 case STANDARD_DEVIATION:
jamie@55 226 *argv_donor = VARIANCE;
jamie@55 227 break;
jamie@55 228 case AVERAGE_DEVIATION:
jamie@55 229 *argv_donor = MEAN;
jamie@55 230 break;
jamie@55 231 case SPECTRAL_STANDARD_DEVIATION:
jamie@55 232 *argv_donor = SPECTRAL_VARIANCE;
jamie@55 233 break;
jamie@55 234 case SPECTRAL_AVERAGE_DEVIATION:
jamie@55 235 *argv_donor = SPECTRAL_MEAN;
jamie@55 236 break;
jamie@55 237 case SPECTRAL_INHARMONICITY:
jamie@55 238 case ODD_EVEN_RATIO:
jamie@55 239 *argv_donor = FAILSAFE_F0;
jamie@55 240 break;
jamie@55 241 case TONALITY:
jamie@55 242 *argv_donor = FLATNESS;
jamie@55 243 break;
jamie@55 244 case LOWEST_VALUE:
jamie@55 245 case F0:
jamie@55 246 case FAILSAFE_F0:
jamie@55 247 *argv_donor = ANY;
jamie@55 248 break;
jamie@55 249 case MFCC:
jamie@55 250 *argv_donor = INIT_MFCC;
jamie@55 251 break;
jamie@55 252 /* argc = 2 */;
jamie@55 253 case SPECTRUM:
jamie@55 254 case ROLLOFF:
jamie@55 255 case PEAK_SPECTRUM:
jamie@55 256 *argv_donor = ANY;
jamie@55 257 *(argv_donor + 1) = ANY;
jamie@55 258 break;
jamie@55 259 case SKEWNESS:
jamie@55 260 case KURTOSIS:
jamie@55 261 *argv_donor = MEAN;
jamie@55 262 *(argv_donor + 1) = STANDARD_DEVIATION;
jamie@55 263 break;
jamie@55 264 case SPECTRAL_SKEWNESS:
jamie@55 265 case SPECTRAL_KURTOSIS:
jamie@55 266 *argv_donor = SPECTRAL_MEAN;
jamie@55 267 *(argv_donor + 1) = SPECTRAL_STANDARD_DEVIATION;
jamie@55 268 break;
jamie@55 269 case HARMONIC_SPECTRUM:
jamie@55 270 *argv_donor = FAILSAFE_F0;
jamie@55 271 *(argv_donor + 1) = ANY;
jamie@55 272 break;
jamie@55 273 case NOISINESS:
jamie@55 274 *argv_donor = SUM;
jamie@55 275 *(argv_donor + 1) = SUM;
jamie@55 276 break;
jamie@55 277 case CREST:
jamie@55 278 *argv_donor = HIGHEST_VALUE;
jamie@55 279 *(argv_donor + 1) = SPECTRAL_MEAN;
jamie@55 280 break;
jamie@55 281 /* argc = BARK_BANDS */
jamie@55 282 case BARK_COEFFICIENTS:
jamie@55 283 *argv_donor = INIT_BARK;
jamie@55 284 break;
jamie@55 285 default:
jamie@55 286 *argv_donor = ANY;
jamie@50 287 break;
jamie@50 288 }
jamie@51 289
jamie@54 290 data_format = &d->data.format;
jamie@54 291
jamie@54 292 switch(f){
jamie@54 293
jamie@54 294 case MEAN:
jamie@54 295 case VARIANCE:
jamie@54 296 case STANDARD_DEVIATION:
jamie@54 297 case AVERAGE_DEVIATION:
jamie@54 298 case SKEWNESS:
jamie@54 299 case KURTOSIS:
jamie@54 300 case LOWEST_VALUE:
jamie@54 301 case HIGHEST_VALUE:
jamie@54 302 case SUM:
jamie@54 303 case ZCR:
jamie@54 304 *data_format = ARBITRARY_SERIES;
jamie@54 305 break;
jamie@54 306 case SPECTRAL_MEAN:
jamie@54 307 case SPECTRAL_VARIANCE:
jamie@54 308 case SPECTRAL_STANDARD_DEVIATION:
jamie@54 309 case SPECTRAL_AVERAGE_DEVIATION:
jamie@54 310 case SPECTRAL_SKEWNESS:
jamie@54 311 case SPECTRAL_KURTOSIS:
jamie@54 312 case SPECTRAL_CENTROID:
jamie@54 313 case SPECTRAL_SLOPE:
jamie@54 314 case PEAK_SPECTRUM:
jamie@54 315 case HARMONIC_SPECTRUM:
jamie@54 316 *data_format = SPECTRAL;
jamie@54 317 break;
jamie@54 318 case ROLLOFF:
jamie@54 319 case NOISINESS:
jamie@54 320 case BARK_COEFFICIENTS:
jamie@54 321 case CREST:
jamie@54 322 case IRREGULARITY_K:
jamie@54 323 case IRREGULARITY_J:
jamie@54 324 case SMOOTHNESS:
jamie@54 325 case FLATNESS:
jamie@54 326 case SPREAD:
jamie@54 327 case RMS_AMPLITUDE:
jamie@54 328 case POWER:
jamie@54 329 case SHARPNESS:
jamie@54 330 case HPS:
jamie@54 331 *data_format = SPECTRAL_MAGNITUDES;
jamie@54 332 break;
jamie@54 333 case SPECTRAL_INHARMONICITY:
jamie@54 334 *data_format = SPECTRAL_PEAKS;
jamie@54 335 break;
jamie@54 336 case ODD_EVEN_RATIO:
jamie@54 337 *data_format = SPECTRAL_HARMONICS_FREQUENCIES;
jamie@54 338 break;
jamie@54 339 case F0:
jamie@54 340 case FAILSAFE_F0:
jamie@54 341 case SPECTRUM:
jamie@54 342 case MFCC:
jamie@54 343 case AUTOCORRELATION:
jamie@54 344 case AUTOCORRELATION_FFT:
jamie@54 345 case DCT:
jamie@54 346 case AMDF:
jamie@54 347 case ASDF:
jamie@54 348 *data_format = AUDIO_SAMPLES;
jamie@54 349 break;
jamie@54 350 case TONALITY:
jamie@54 351 *data_format = NO_DATA;
jamie@54 352 break;
jamie@54 353 case TRISTIMULUS_1:
jamie@54 354 case TRISTIMULUS_2:
jamie@54 355 case TRISTIMULUS_3:
jamie@54 356 *data_format = SPECTRAL_HARMONICS_MAGNITUDES;
jamie@54 357 break;
jamie@54 358 case LOUDNESS:
jamie@54 359 *data_format = BARK_COEFFS;
jamie@54 360 break;
jamie@54 361 case FLUX:
jamie@54 362 case ATTACK_TIME:
jamie@54 363 case DECAY_TIME:
jamie@54 364 case DELTA_FEATURE:
jamie@54 365 default:
jamie@54 366 *data_format = NO_DATA;
jamie@54 367 break;
jamie@54 368 }
jamie@54 369
jamie@55 370 data_unit = &d->data.unit;
jamie@55 371
jamie@55 372 switch(f){
jamie@55 373
jamie@55 374 case MEAN:
jamie@55 375 case VARIANCE:
jamie@55 376 case STANDARD_DEVIATION:
jamie@55 377 case AVERAGE_DEVIATION:
jamie@55 378 case SKEWNESS:
jamie@55 379 case KURTOSIS:
jamie@55 380 case LOWEST_VALUE:
jamie@55 381 case HIGHEST_VALUE:
jamie@55 382 case SUM:
jamie@55 383 case ZCR:
jamie@55 384 case PEAK_SPECTRUM:
jamie@55 385 case TRISTIMULUS_1:
jamie@55 386 case TRISTIMULUS_2:
jamie@55 387 case TRISTIMULUS_3:
jamie@55 388 case DCT:
jamie@55 389 case AMDF:
jamie@55 390 case ASDF:
jamie@55 391 case IRREGULARITY_K:
jamie@55 392 case IRREGULARITY_J:
jamie@55 393 case ATTACK_TIME:
jamie@55 394 case DECAY_TIME:
jamie@55 395 case DELTA_FEATURE:
jamie@55 396 case FLUX:
jamie@55 397 case F0:
jamie@55 398 case FAILSAFE_F0:
jamie@55 399 case MFCC:
jamie@55 400 case AUTOCORRELATION:
jamie@55 401 case AUTOCORRELATION_FFT:
jamie@55 402 case ROLLOFF:
jamie@55 403 case NOISINESS:
jamie@55 404 case CREST:
jamie@55 405 case FLATNESS:
jamie@55 406 case POWER:
jamie@55 407 case BARK_COEFFICIENTS:
jamie@55 408 case RMS_AMPLITUDE:
jamie@55 409 case SMOOTHNESS:
jamie@55 410 case SPREAD:
jamie@55 411 case SHARPNESS:
jamie@55 412 case HPS:
jamie@55 413 case SPECTRUM:
jamie@55 414 case TONALITY:
jamie@55 415 case LOUDNESS:
jamie@55 416 *data_unit = ANY;
jamie@55 417 break;
jamie@55 418 case SPECTRAL_MEAN:
jamie@55 419 case SPECTRAL_VARIANCE:
jamie@55 420 case SPECTRAL_STANDARD_DEVIATION:
jamie@55 421 case SPECTRAL_AVERAGE_DEVIATION:
jamie@55 422 case SPECTRAL_SKEWNESS:
jamie@55 423 case SPECTRAL_KURTOSIS:
jamie@55 424 case SPECTRAL_CENTROID:
jamie@55 425 case SPECTRAL_SLOPE:
jamie@55 426 case HARMONIC_SPECTRUM:
jamie@55 427 case SPECTRAL_INHARMONICITY:
jamie@55 428 *data_unit = ANY_AMPLITUDE_HERTZ;
jamie@55 429 break;
jamie@55 430 case ODD_EVEN_RATIO:
jamie@55 431 *data_unit = HERTZ;
jamie@55 432 break;
jamie@55 433 }
jamie@55 434
jamie@50 435 name = d->algo.name;
jamie@51 436 p_name = d->algo.p_name;
jamie@51 437 desc = d->algo.desc;
jamie@51 438 p_desc = d->algo.p_desc;
jamie@51 439 author = d->algo.author;
jamie@51 440 year = &d->algo.year;
jamie@51 441
jamie@51 442 *year = 0;
jamie@51 443
jamie@50 444 switch(f){
jamie@50 445 case MEAN:
jamie@50 446 strcpy(name, "mean");
jamie@52 447 strcpy(p_name, "Mean");
jamie@51 448 strcpy(desc, "Extract the mean of an input vector");
jamie@52 449 strcpy(p_desc, "Extract the mean of a range of values");
jamie@51 450 strcpy(author, "");
jamie@55 451 d->argv.type = NONE;
jamie@50 452 break;
jamie@50 453 case VARIANCE:
jamie@50 454 strcpy(name, "variance");
jamie@51 455 strcpy(p_name, "Variance");
jamie@51 456 strcpy(desc, "Extract the variance of an input vector");
jamie@52 457 strcpy(p_desc, "Extract the variance of a range of values");
jamie@51 458 strcpy(author, "");
jamie@50 459 break;
jamie@50 460 case STANDARD_DEVIATION:
jamie@50 461 strcpy(name, "standard_deviation");
jamie@51 462 strcpy(p_name, "Standard Deviation");
jamie@52 463 strcpy(desc,
jamie@52 464 "Extract the standard deviation of an input vector");
jamie@52 465 strcpy(p_desc,
jamie@52 466 "Extract the standard deviation of a range of values");
jamie@51 467 strcpy(author, "");
jamie@50 468 break;
jamie@50 469 case AVERAGE_DEVIATION:
jamie@50 470 strcpy(name, "average_deviation");
jamie@51 471 strcpy(p_name, "Average Deviation");
jamie@52 472 strcpy(desc,
jamie@52 473 "Extract the average deviation of an input vector");
jamie@52 474 strcpy(p_desc,
jamie@52 475 "Extract the average deviation of a range of values");
jamie@52 476 strcpy(author, "");
jamie@52 477 break;
jamie@52 478 case SPECTRAL_MEAN:
jamie@52 479 strcpy(name, "spectral_mean");
jamie@52 480 strcpy(p_name, "Spectral Mean");
jamie@52 481 strcpy(desc, "Extract the mean of an input spectrum");
jamie@52 482 strcpy(p_desc, "Extract the mean of an audio spectrum");
jamie@52 483 strcpy(author, "");
jamie@52 484 break;
jamie@52 485 case SPECTRAL_VARIANCE:
jamie@52 486 strcpy(name, "spectral_variance");
jamie@52 487 strcpy(p_name, "Spectral Variance");
jamie@52 488 strcpy(desc, "Extract the variance of an input spectrum");
jamie@52 489 strcpy(p_desc, "Extract the variance of an audio spectrum");
jamie@52 490 strcpy(author, "");
jamie@52 491 break;
jamie@52 492 case SPECTRAL_STANDARD_DEVIATION:
jamie@52 493 strcpy(name, "spectral_standard_deviation");
jamie@52 494 strcpy(p_name, "Spectral Standard Deviation");
jamie@52 495 strcpy(desc,
jamie@52 496 "Extract the standard deviation of an input spectrum");
jamie@52 497 strcpy(p_desc,
jamie@52 498 "Extract the standard deviation of an audio spectrum");
jamie@52 499 strcpy(author, "");
jamie@52 500 break;
jamie@52 501 case SPECTRAL_AVERAGE_DEVIATION:
jamie@52 502 strcpy(name, "spectral_average_deviation");
jamie@52 503 strcpy(p_name, "Spectral Average Deviation");
jamie@52 504 strcpy(desc,
jamie@52 505 "Extract the average deviation of an input spectrum");
jamie@52 506 strcpy(p_desc,
jamie@52 507 "Extract the average deviation of an audio spectrum");
jamie@51 508 strcpy(author, "");
jamie@50 509 break;
jamie@50 510 case ROLLOFF:
jamie@52 511 strcpy(name, "spectral_rolloff");
jamie@51 512 strcpy(p_name, "Spectral Rolloff");
jamie@52 513 strcpy(desc,
jamie@52 514 "Extract the rolloff point of a spectrum");
jamie@52 515 strcpy(p_desc,
jamie@52 516 "Extract the rolloff point of an audio spectrum");
jamie@52 517 strcpy(author, "Bee Suan Ong");
jamie@52 518 *year = 2005;
jamie@50 519 break;
jamie@52 520 case SPECTRAL_INHARMONICITY:
jamie@52 521 strcpy(name, "spectral_inharmonicity");
jamie@51 522 strcpy(p_name, "Inharmonicity");
jamie@51 523 strcpy(desc, "Extract the inharmonicity of a spectrum");
jamie@52 524 strcpy(p_desc,
jamie@52 525 "Extract the inharmonicity of an audio spectrum");
jamie@50 526 break;
jamie@54 527 case SPECTRUM:
jamie@54 528 strcpy(name, "spectrum");
jamie@54 529 strcpy(p_name, "Spectrum");
jamie@52 530 strcpy(desc,
jamie@54 531 "Extract the spectrum of an input vector");
jamie@52 532 strcpy(p_desc,
jamie@54 533 "Extract the spectrum of an audio signal");
jamie@51 534 strcpy(author, "");
jamie@50 535 break;
jamie@50 536 case ODD_EVEN_RATIO:
jamie@50 537 strcpy(name, "odd_even_ratio");
jamie@51 538 strcpy(p_name, "Odd/Even Harmonic Ratio");
jamie@52 539 strcpy(desc,
jamie@52 540 "Extract the odd-to-even harmonic ratio of a spectrum");
jamie@52 541 strcpy(p_desc,
jamie@52 542 "Extract the odd-to-even harmonic ratio of an audio spectrum");
jamie@51 543 strcpy(author, "");
jamie@50 544 break;
jamie@50 545 case LOWEST_VALUE:
jamie@50 546 strcpy(name, "lowest_value");
jamie@51 547 strcpy(p_name, "Lowest Value");
jamie@51 548 strcpy(desc, "Extract the lowest value from an input vector");
jamie@51 549 strcpy(p_desc, "Extract the lowest value from a given range");
jamie@51 550 strcpy(author, "");
jamie@50 551 break;
jamie@50 552 case F0:
jamie@50 553 strcpy(name, "f0");
jamie@51 554 strcpy(p_name, "Fundamental Frequency");
jamie@51 555 strcpy(desc, "Extract the fundamental frequency of a signal");
jamie@52 556 strcpy(p_desc,
jamie@52 557 "Extract the fundamental frequency of an audio signal");
jamie@51 558 strcpy(author, "");
jamie@50 559 break;
jamie@50 560 case FAILSAFE_F0:
jamie@50 561 strcpy(name, "failsafe_f0");
jamie@51 562 strcpy(p_name, "Fundamental Frequency (failsafe)");
jamie@51 563 strcpy(desc, "Extract the fundamental frequency of a signal");
jamie@52 564 strcpy(p_desc,
jamie@52 565 "Extract the fundamental frequency of an audio signal");
jamie@51 566 strcpy(author, "");
jamie@50 567 break;
jamie@50 568 case TONALITY:
jamie@50 569 strcpy(name, "tonality");
jamie@51 570 strcpy(p_name, "Tonality");
jamie@51 571 strcpy(desc, "Extract the tonality of a spectrum");
jamie@51 572 strcpy(p_desc, "Extract the tonality an audio spectrum");
jamie@52 573 strcpy(author, "Tristan Jehan");
jamie@52 574 *year = 2005;
jamie@50 575 break;
jamie@52 576 case SPECTRAL_SKEWNESS:
jamie@52 577 strcpy(name, "spectral_skewness");
jamie@51 578 strcpy(p_name, "Spectral Skewness");
jamie@52 579 strcpy(desc, "Extract the skewness of an input spectrum");
jamie@51 580 strcpy(p_desc, "Extract the skewness of an audio spectrum");
jamie@51 581 strcpy(author, "");
jamie@50 582 break;
jamie@52 583 case SPECTRAL_KURTOSIS:
jamie@52 584 strcpy(name, "spectral_kurtosis");
jamie@51 585 strcpy(p_name, "Spectral Kurtosis");
jamie@52 586 strcpy(desc, "Extract the kurtosis of an input spectrum");
jamie@51 587 strcpy(p_desc, "Extract the kurtosis of an audio spectrum");
jamie@51 588 strcpy(author, "");
jamie@50 589 break;
jamie@52 590 case PEAK_SPECTRUM:
jamie@52 591 strcpy(name, "peak_spectrum");
jamie@52 592 strcpy(p_name, "Peak Spectrum");
jamie@51 593 strcpy(desc, "Extract the spectral peaks from of a spectrum");
jamie@52 594 strcpy(p_desc,
jamie@52 595 "Extract the spectral peaks from an audio spectrum");
jamie@51 596 strcpy(author, "");
jamie@50 597 break;
jamie@52 598 case HARMONIC_SPECTRUM:
jamie@52 599 strcpy(p_name, "harmonic_spectrum");
jamie@52 600 strcpy(p_name, "Harmonic Spectrum");
jamie@51 601 strcpy(desc, "Extract the harmonics from a spectrum");
jamie@51 602 strcpy(p_desc, "Extract the harmonics from an audio spectrum");
jamie@51 603 strcpy(author, "");
jamie@50 604 break;
jamie@50 605 case NOISINESS:
jamie@50 606 strcpy(name, "noisiness");
jamie@51 607 strcpy(p_name, "Noisiness");
jamie@51 608 strcpy(desc, "Extract the noisiness of a spectrum");
jamie@51 609 strcpy(p_desc, "Extract the noisiness of an audio spectrum");
jamie@52 610 strcpy(author, "Tae Hong Park");
jamie@52 611 *year = 2000;
jamie@50 612 break;
jamie@50 613 case CREST:
jamie@50 614 strcpy(name, "crest");
jamie@51 615 strcpy(p_name, "Spectral Crest Measure");
jamie@52 616 strcpy(desc,
jamie@52 617 "Extract the spectral crest measure of a spectrum");
jamie@52 618 strcpy(p_desc,
jamie@52 619 "Extract the spectral crest measure of a audio spectrum");
jamie@52 620 strcpy(author, "Peeters");
jamie@52 621 *year = 2003;
jamie@50 622 break;
jamie@50 623 case MFCC:
jamie@50 624 strcpy(name, "mfcc");
jamie@52 625 strcpy(p_name, "Mel-Frequency Cepstral Coefficients");
jamie@51 626 strcpy(desc, "Extract MFCC from a spectrum");
jamie@51 627 strcpy(p_desc, "Extract MFCC from an audio spectrum");
jamie@52 628 strcpy(author, "Rabiner");
jamie@50 629 break;
jamie@50 630 case BARK_COEFFICIENTS:
jamie@50 631 strcpy(name, "bark_coefficients");
jamie@51 632 strcpy(p_name, "Bark Coefficients");
jamie@51 633 strcpy(desc, "Extract bark coefficients from a spectrum");
jamie@52 634 strcpy(p_desc,
jamie@52 635 "Extract bark coefficients from an audio spectrum");
jamie@51 636 strcpy(author, "");
jamie@50 637 break;
jamie@52 638 case SPECTRAL_CENTROID:
jamie@52 639 strcpy(name, "spectral_centroid");
jamie@51 640 strcpy(p_name, "Spectral Centroid");
jamie@51 641 strcpy(desc, "Extract the spectral centroid of a spectrum");
jamie@52 642 strcpy(p_desc,
jamie@52 643 "Extract the spectral centroid of an audio spectrum");
jamie@51 644 strcpy(author, "");
jamie@50 645 break;
jamie@50 646 case IRREGULARITY_K:
jamie@50 647 strcpy(name, "irregularity_k");
jamie@51 648 strcpy(p_name, "Irregularity I");
jamie@51 649 strcpy(desc, "Extract the irregularity of a spectrum");
jamie@52 650 strcpy(p_desc,
jamie@52 651 "Extract the irregularity of an audio spectrum");
jamie@52 652 strcpy(author, "Krimphoff");
jamie@52 653 *year = 1994;
jamie@50 654 break;
jamie@50 655 case IRREGULARITY_J:
jamie@50 656 strcpy(name, "irregularity_j");
jamie@51 657 strcpy(p_name, "Irregularity II");
jamie@51 658 strcpy(desc, "Extract the irregularity of a spectrum");
jamie@52 659 strcpy(p_desc,
jamie@52 660 "Extract the irregularity of an audio spectrum");
jamie@52 661 strcpy(author, "Jensen");
jamie@52 662 *year = 1999;
jamie@50 663 break;
jamie@50 664 case TRISTIMULUS_1:
jamie@50 665 strcpy(name, "tristimulus_1");
jamie@51 666 strcpy(p_name, "Tristimulus I");
jamie@51 667 strcpy(desc, "Extract the tristimulus (type I) of a spectrum");
jamie@52 668 strcpy(p_desc,
jamie@52 669 "Extract the tristimulus (type I) of an audio spectrum");
jamie@52 670 strcpy(author, "Pollard and Jansson");
jamie@52 671 *year = 1982;
jamie@50 672 break;
jamie@50 673 case TRISTIMULUS_2:
jamie@50 674 strcpy(name, "tristimulus_2");
jamie@51 675 strcpy(p_name, "Tristimulus II");
jamie@51 676 strcpy(desc, "Extract the tristimulus (type II) of a spectrum");
jamie@52 677 strcpy(p_desc,
jamie@52 678 "Extract the tristimulus (type II) of an audio spectrum");
jamie@52 679 strcpy(author, "Pollard and Jansson");
jamie@52 680 *year = 1982;
jamie@50 681 break;
jamie@50 682 case TRISTIMULUS_3:
jamie@50 683 strcpy(name, "tristimulus_3");
jamie@51 684 strcpy(p_name, "Tristimulus III");
jamie@52 685 strcpy(desc,
jamie@52 686 "Extract the tristimulus (type III) of a spectrum");
jamie@52 687 strcpy(p_desc,
jamie@52 688 "Extract the tristimulus (type III) of an audio spectrum");
jamie@52 689 strcpy(author, "Pollard and Jansson");
jamie@52 690 *year = 1982;
jamie@50 691 break;
jamie@50 692 case SMOOTHNESS:
jamie@50 693 strcpy(name, "smoothness");
jamie@51 694 strcpy(p_name, "Spectral Smoothness");
jamie@51 695 strcpy(desc, "Extract the spectral smoothness of a spectrum");
jamie@52 696 strcpy(p_desc,
jamie@52 697 "Extract the spectral smoothness of an audio spectrum");
jamie@52 698 strcpy(author, "McAdams");
jamie@52 699 *year = 1999;
jamie@50 700 break;
jamie@50 701 case FLATNESS:
jamie@50 702 strcpy(name, "flatness");
jamie@51 703 strcpy(p_name, "Spectral Flatness");
jamie@51 704 strcpy(desc, "Extract the spectral flatness of a spectrum");
jamie@52 705 strcpy(p_desc,
jamie@52 706 "Extract the spectral flatness of an audio spectrum");
jamie@52 707 strcpy(author, "Tristan Jehan");
jamie@52 708 *year = 2005;
jamie@50 709 break;
jamie@50 710 case SPREAD:
jamie@50 711 strcpy(name, "spread");
jamie@51 712 strcpy(p_name, "Spectral Spread");
jamie@51 713 strcpy(desc, "Extract the spectral spread of a spectrum");
jamie@52 714 strcpy(p_desc,
jamie@52 715 "Extract the spectral spread of an audio spectrum");
jamie@52 716 strcpy(author, "Norman Casagrande");
jamie@52 717 *year = 2005;
jamie@50 718 break;
jamie@50 719 case ZCR:
jamie@50 720 strcpy(name, "zcr");
jamie@51 721 strcpy(p_name, "Zero Crossing Rate");
jamie@51 722 strcpy(desc, "Extract the zero crossing rate of a vector");
jamie@52 723 strcpy(p_desc,
jamie@52 724 "Extract the zero crossing rate of an audio signal");
jamie@51 725 strcpy(author, "");
jamie@50 726 break;
jamie@50 727 case LOUDNESS:
jamie@50 728 strcpy(name, "loudness");
jamie@51 729 strcpy(p_name, "Loudness");
jamie@52 730 strcpy(desc,
jamie@52 731 "Extract the loudness of a signal from its spectrum");
jamie@52 732 strcpy(p_desc,
jamie@52 733 "Extract the loudness of an audio signal from its spectrum");
jamie@52 734 strcpy(author, "Moore, Glasberg et al");
jamie@52 735 *year = 2005;
jamie@50 736 break;
jamie@50 737 case HIGHEST_VALUE:
jamie@50 738 strcpy(name, "highest_value");
jamie@51 739 strcpy(p_name, "Highest Value");
jamie@51 740 strcpy(desc, "Extract the highest value from an input vector");
jamie@51 741 strcpy(p_desc, "Extract the highest value from a given range");
jamie@51 742 strcpy(author, "");
jamie@50 743 break;
jamie@50 744 case SUM:
jamie@50 745 strcpy(name, "sum");
jamie@51 746 strcpy(p_name, "Sum of Values");
jamie@52 747 strcpy(desc,
jamie@52 748 "Extract the sum of the values in an input vector");
jamie@52 749 strcpy(p_desc,
jamie@52 750 "Extract the sum of the values in a given range");
jamie@51 751 strcpy(author, "");
jamie@50 752 break;
jamie@50 753 case RMS_AMPLITUDE:
jamie@50 754 strcpy(name, "rms_amplitude");
jamie@51 755 strcpy(p_name, "RMS Amplitude");
jamie@51 756 strcpy(desc, "Extract the RMS amplitude of a signal");
jamie@51 757 strcpy(p_desc, "Extract the RMS amplitude of an audio signal");
jamie@51 758 strcpy(author, "");
jamie@50 759 break;
jamie@50 760 case POWER:
jamie@50 761 strcpy(name, "power");
jamie@51 762 strcpy(p_name, "Spectral Power");
jamie@51 763 strcpy(desc, "Extract the spectral power of a spectrum");
jamie@52 764 strcpy(p_desc,
jamie@52 765 "Extract the spectral power of an audio spectrum");
jamie@52 766 strcpy(author, "Bee Suan Ong");
jamie@52 767 *year = 2005;
jamie@50 768 break;
jamie@50 769 case SHARPNESS:
jamie@50 770 strcpy(name, "sharpness");
jamie@51 771 strcpy(p_name, "Spectral Sharpness");
jamie@51 772 strcpy(desc, "Extract the spectral sharpness of a spectrum");
jamie@52 773 strcpy(p_desc,
jamie@52 774 "Extract the spectral sharpness of an audio spectrum");
jamie@51 775 strcpy(author, "");
jamie@50 776 break;
jamie@52 777 case SPECTRAL_SLOPE:
jamie@52 778 strcpy(name, "spectral_slope");
jamie@51 779 strcpy(p_name, "Spectral Slope");
jamie@51 780 strcpy(desc, "Extract the spectral slope of a spectrum");
jamie@52 781 strcpy(p_desc,
jamie@52 782 "Extract the spectral slope of an audio spectrum");
jamie@51 783 strcpy(author, "");
jamie@50 784 break;
jamie@50 785 case HPS:
jamie@50 786 strcpy(name, "hps");
jamie@51 787 strcpy(p_name, "Harmonic Product Spectrum");
jamie@52 788 strcpy(desc,
jamie@52 789 "Extract the harmonic product spectrum of a spectrum");
jamie@52 790 strcpy(p_desc,
jamie@52 791 "Extract the harmonic product spectrum of an audio spectrum");
jamie@51 792 strcpy(author, "");
jamie@50 793 break;
jamie@50 794 case FLUX:
jamie@50 795 strcpy(name, "flux");
jamie@51 796 strcpy(p_name, "Spectral Flux");
jamie@51 797 strcpy(desc, "Extract the spectral flux of a spectrum");
jamie@52 798 strcpy(p_desc,
jamie@52 799 "Extract the spectral flux of an audio spectrum");
jamie@51 800 strcpy(author, "");
jamie@50 801 break;
jamie@50 802 case ATTACK_TIME:
jamie@50 803 strcpy(name, "attack_time");
jamie@51 804 strcpy(p_name, "Attack Time");
jamie@51 805 strcpy(desc, "Extract the attack time of a signal");
jamie@51 806 strcpy(p_desc, "Extract the attack time of an audio signal");
jamie@51 807 strcpy(author, "");
jamie@50 808 break;
jamie@50 809 case DECAY_TIME:
jamie@50 810 strcpy(name, "decay_time");
jamie@51 811 strcpy(p_name, "Decay Time");
jamie@51 812 strcpy(desc, "Extract the decay time of a signal");
jamie@51 813 strcpy(p_desc, "Extract the decay time of an audio signal");
jamie@51 814 strcpy(author, "");
jamie@50 815 break;
jamie@50 816 case DELTA_FEATURE:
jamie@50 817 strcpy(name, "delta_feature");
jamie@51 818 strcpy(p_name, "Delta Feature");
jamie@51 819 strcpy(desc, "Extract the time derivative of a feature");
jamie@51 820 strcpy(p_desc, "Extract the time derivative of a feature");
jamie@51 821 strcpy(author, "");
jamie@50 822 break;
jamie@50 823 case AUTOCORRELATION_FFT:
jamie@50 824 strcpy(name, "autocorrelation_fft");
jamie@51 825 strcpy(p_name, "Autocorrelation (FFT method)");
jamie@51 826 strcpy(desc, "Extract the autocorrelation of a signal");
jamie@51 827 strcpy(p_desc, "Extract the autocorrelation of an audio signal");
jamie@51 828 strcpy(author, "");
jamie@50 829 break;
jamie@50 830 case DCT:
jamie@50 831 strcpy(name, "dct");
jamie@51 832 strcpy(p_name, "Discrete Cosine Transform");
jamie@51 833 strcpy(desc, "Extract the DCT of a signal");
jamie@51 834 strcpy(p_desc, "Extract the DCT of an audio signal");
jamie@51 835 strcpy(author, "");
jamie@50 836 break;
jamie@50 837 case AUTOCORRELATION:
jamie@50 838 strcpy(name, "autocorrelation");
jamie@51 839 strcpy(p_name, "Autocorrelation");
jamie@51 840 strcpy(desc, "Extract the autocorrelation of a signal");
jamie@52 841 strcpy(p_desc,
jamie@52 842 "Extract the autocorrelation of an audio signal");
jamie@51 843 strcpy(author, "");
jamie@50 844 break;
jamie@50 845 case AMDF:
jamie@50 846 strcpy(name, "amdf");
jamie@51 847 strcpy(p_name, "Average Magnitude Difference Function");
jamie@51 848 strcpy(desc, "Extract the AMDF of a signal");
jamie@51 849 strcpy(p_desc, "Extract the AMDF of an audio signal");
jamie@51 850 strcpy(author, "");
jamie@50 851 break;
jamie@50 852 case ASDF:
jamie@50 853 strcpy(name, "asdf");
jamie@51 854 strcpy(p_name, "Average Squared Difference Function");
jamie@51 855 strcpy(desc, "Extract the ASDF of a signal");
jamie@51 856 strcpy(p_desc, "Extract the ASDF of an audio signal");
jamie@51 857 strcpy(author, "");
jamie@50 858 break;
jamie@50 859 default:
jamie@51 860 strcpy(name, "");
jamie@52 861 strcpy(p_name, "");
jamie@51 862 strcpy(desc, "");
jamie@51 863 strcpy(p_desc, "");
jamie@51 864 strcpy(author, "");
jamie@50 865 break;
jamie@50 866 }
jamie@55 867
jamie@55 868
jamie@55 869 switch(f){
jamie@55 870
jamie@55 871 case VARIANCE:
jamie@55 872 case STANDARD_DEVIATION:
jamie@55 873 case AVERAGE_DEVIATION:
jamie@55 874 case SPECTRAL_VARIANCE:
jamie@55 875 case SPECTRAL_STANDARD_DEVIATION:
jamie@55 876 case SPECTRAL_AVERAGE_DEVIATION:
jamie@55 877 case SPECTRAL_INHARMONICITY:
jamie@55 878 case ODD_EVEN_RATIO:
jamie@55 879 case LOWEST_VALUE:
jamie@55 880 case F0:
jamie@55 881 case FAILSAFE_F0:
jamie@55 882 case TONALITY:
jamie@55 883 *argc = 1;
jamie@55 884 *argv_type = FLOAT;
jamie@55 885 break;
jamie@55 886 case SKEWNESS:
jamie@55 887 case KURTOSIS:
jamie@55 888 case SPECTRAL_SKEWNESS:
jamie@55 889 case SPECTRAL_KURTOSIS:
jamie@55 890 case SPECTRUM:
jamie@55 891 case PEAK_SPECTRUM:
jamie@55 892 case HARMONIC_SPECTRUM:
jamie@55 893 case NOISINESS:
jamie@55 894 case CREST:
jamie@55 895 case ROLLOFF:
jamie@55 896 *argc = 2;
jamie@55 897 *argv_type = FLOAT;
jamie@55 898 break;
jamie@55 899 case MFCC:
jamie@55 900 *argc = 1;
jamie@55 901 *argv_type = MEL_FILTER;
jamie@55 902 break;
jamie@55 903 case BARK_COEFFICIENTS:
jamie@55 904 *argc = BARK_BANDS;
jamie@55 905 *argv_type = INT;
jamie@55 906 break;
jamie@55 907 case MEAN:
jamie@55 908 case SPECTRAL_MEAN:
jamie@55 909 case SPECTRAL_CENTROID:
jamie@55 910 case IRREGULARITY_K:
jamie@55 911 case IRREGULARITY_J:
jamie@55 912 case TRISTIMULUS_1:
jamie@55 913 case TRISTIMULUS_2:
jamie@55 914 case TRISTIMULUS_3:
jamie@55 915 case SMOOTHNESS:
jamie@55 916 case FLATNESS:
jamie@55 917 case SPREAD:
jamie@55 918 case ZCR:
jamie@55 919 case LOUDNESS:
jamie@55 920 case HIGHEST_VALUE:
jamie@55 921 case SUM:
jamie@55 922 case RMS_AMPLITUDE:
jamie@55 923 case POWER:
jamie@55 924 case SHARPNESS:
jamie@55 925 case SPECTRAL_SLOPE:
jamie@55 926 case HPS:
jamie@55 927 case FLUX:
jamie@55 928 case ATTACK_TIME:
jamie@55 929 case DECAY_TIME:
jamie@55 930 case DELTA_FEATURE:
jamie@55 931 case AUTOCORRELATION_FFT:
jamie@55 932 case DCT:
jamie@55 933 case AUTOCORRELATION:
jamie@55 934 case AMDF:
jamie@55 935 case ASDF:
jamie@55 936 default:
jamie@55 937 *argc = 0;
jamie@55 938 break;
jamie@55 939 }
jamie@55 940
jamie@55 941 is_scalar = &d->is_scalar;
jamie@55 942
jamie@55 943 switch(f){
jamie@55 944 case MEAN:
jamie@55 945 case VARIANCE:
jamie@55 946 case STANDARD_DEVIATION:
jamie@55 947 case AVERAGE_DEVIATION:
jamie@55 948 case SKEWNESS:
jamie@55 949 case KURTOSIS:
jamie@55 950 case SPECTRAL_MEAN:
jamie@55 951 case SPECTRAL_VARIANCE:
jamie@55 952 case SPECTRAL_STANDARD_DEVIATION:
jamie@55 953 case SPECTRAL_AVERAGE_DEVIATION:
jamie@55 954 case SPECTRAL_SKEWNESS:
jamie@55 955 case SPECTRAL_KURTOSIS:
jamie@55 956 case SPECTRAL_CENTROID:
jamie@55 957 case IRREGULARITY_K:
jamie@55 958 case IRREGULARITY_J:
jamie@55 959 case TRISTIMULUS_1:
jamie@55 960 case TRISTIMULUS_2:
jamie@55 961 case TRISTIMULUS_3:
jamie@55 962 case SMOOTHNESS:
jamie@55 963 case SPREAD:
jamie@55 964 case ZCR:
jamie@55 965 case ROLLOFF:
jamie@55 966 case LOUDNESS:
jamie@55 967 case FLATNESS:
jamie@55 968 case TONALITY:
jamie@55 969 case CREST:
jamie@55 970 case NOISINESS:
jamie@55 971 case RMS_AMPLITUDE:
jamie@55 972 case SPECTRAL_INHARMONICITY:
jamie@55 973 case POWER:
jamie@55 974 case ODD_EVEN_RATIO:
jamie@55 975 case SHARPNESS:
jamie@55 976 case SPECTRAL_SLOPE:
jamie@55 977 case LOWEST_VALUE:
jamie@55 978 case HIGHEST_VALUE:
jamie@55 979 case SUM:
jamie@55 980 case HPS:
jamie@55 981 case F0:
jamie@55 982 case FAILSAFE_F0:
jamie@55 983 *is_scalar = TRUE;
jamie@55 984 break;
jamie@55 985 case AUTOCORRELATION:
jamie@55 986 case AMDF:
jamie@55 987 case ASDF:
jamie@55 988 case BARK_COEFFICIENTS:
jamie@55 989 case PEAK_SPECTRUM:
jamie@55 990 case SPECTRUM:
jamie@55 991 case AUTOCORRELATION_FFT:
jamie@55 992 case MFCC:
jamie@55 993 case DCT:
jamie@55 994 case HARMONIC_SPECTRUM:
jamie@55 995 *is_scalar = FALSE;
jamie@55 996 break;
jamie@55 997 default:
jamie@55 998 *is_scalar = TRUE;
jamie@55 999 break;
jamie@55 1000
jamie@55 1001 }
jamie@55 1002
jamie@55 1003 if(*is_scalar){
jamie@55 1004
jamie@55 1005 result_unit = &d->result.scalar.unit;
jamie@55 1006 result_min = &d->result.scalar.min;
jamie@55 1007 result_max = &d->result.scalar.max;
jamie@55 1008
jamie@55 1009 switch(f){
jamie@55 1010 case MEAN:
jamie@55 1011 case VARIANCE:
jamie@55 1012 case STANDARD_DEVIATION:
jamie@55 1013 case AVERAGE_DEVIATION:
jamie@55 1014 case SKEWNESS:
jamie@55 1015 case KURTOSIS:
jamie@55 1016 case RMS_AMPLITUDE:
jamie@55 1017 case LOWEST_VALUE:
jamie@55 1018 case HIGHEST_VALUE:
jamie@55 1019 case SUM:
jamie@55 1020 *result_unit = ANY;
jamie@55 1021 *result_min = ANY;
jamie@55 1022 *result_max = ANY;
jamie@55 1023 break;
jamie@55 1024 case SPECTRAL_SKEWNESS:
jamie@55 1025 case SPECTRAL_KURTOSIS:
jamie@55 1026 case IRREGULARITY_K:
jamie@55 1027 case IRREGULARITY_J:
jamie@55 1028 case TRISTIMULUS_1:
jamie@55 1029 case TRISTIMULUS_2:
jamie@55 1030 case TRISTIMULUS_3:
jamie@55 1031 case NOISINESS:
jamie@55 1032 case SMOOTHNESS:
jamie@55 1033 *result_unit = NONE;
jamie@55 1034 *result_min = ANY; /* FIX: need to check these */
jamie@55 1035 *result_max = ANY;
jamie@55 1036 break;
jamie@55 1037 case SPECTRAL_MEAN:
jamie@55 1038 case SPECTRAL_VARIANCE:
jamie@55 1039 case SPECTRAL_STANDARD_DEVIATION:
jamie@55 1040 case SPECTRAL_AVERAGE_DEVIATION:
jamie@55 1041 case SPECTRAL_CENTROID:
jamie@55 1042 case SPREAD:
jamie@55 1043 case F0:
jamie@55 1044 case FAILSAFE_F0:
jamie@55 1045 case HPS:
jamie@55 1046 case ROLLOFF:
jamie@55 1047 *result_unit = HERTZ;
jamie@55 1048 *result_min = 0.f;
jamie@55 1049 *result_max = SR_UPPER_LIMIT / 2;
jamie@55 1050 case ZCR:
jamie@55 1051 *result_unit = HERTZ;
jamie@55 1052 *result_min = 0.f;
jamie@55 1053 *result_max = ANY;
jamie@55 1054 case ODD_EVEN_RATIO:
jamie@55 1055 *result_unit = NONE;
jamie@55 1056 *result_min = 0.f;
jamie@55 1057 *result_max = 1.f;
jamie@55 1058 case LOUDNESS:
jamie@55 1059 case FLATNESS:
jamie@55 1060 case TONALITY:
jamie@55 1061 case CREST:
jamie@55 1062 case SPECTRAL_INHARMONICITY:
jamie@55 1063 case POWER:
jamie@55 1064 case SHARPNESS:
jamie@55 1065 case SPECTRAL_SLOPE:
jamie@55 1066 default:
jamie@55 1067 *result_unit = UNKNOWN;
jamie@55 1068 *result_min = UNKNOWN;
jamie@55 1069 *result_max = UNKNOWN;
jamie@55 1070 }
jamie@55 1071 }
jamie@55 1072 else {
jamie@55 1073
jamie@55 1074 result_min = NULL;
jamie@55 1075 result_max = NULL;
jamie@55 1076 result_unit = &d->result.vector.unit;
jamie@55 1077 result_format = &d->result.vector.format;
jamie@55 1078
jamie@55 1079 switch(f) {
jamie@55 1080 case AUTOCORRELATION:
jamie@55 1081 case AMDF:
jamie@55 1082 case ASDF:
jamie@55 1083 case DCT:
jamie@55 1084 *result_format = ARBITRARY_SERIES;
jamie@55 1085 *result_unit = ANY;
jamie@55 1086 case BARK_COEFFICIENTS:
jamie@55 1087 *result_format = BARK_COEFFS;
jamie@55 1088 *result_unit = UNKNOWN; /* FIX: check */
jamie@55 1089 case PEAK_SPECTRUM:
jamie@55 1090 case SPECTRUM:
jamie@55 1091 case HARMONIC_SPECTRUM:
jamie@55 1092 *result_format = SPECTRAL;
jamie@55 1093 *result_unit = ANY_AMPLITUDE_HERTZ;
jamie@55 1094 case AUTOCORRELATION_FFT:
jamie@55 1095 case MFCC:
jamie@55 1096 *result_format = MEL_COEFFS;
jamie@55 1097 *result_unit = UNKNOWN; /* FIX: check */
jamie@55 1098 default:
jamie@55 1099 break;
jamie@55 1100 }
jamie@55 1101 }
jamie@50 1102 }
jamie@50 1103
jamie@50 1104 return fd;
jamie@50 1105 }
jamie@50 1106
jamie@50 1107 int xtract_free_descriptors(void *fd){
jamie@50 1108
jamie@50 1109 if (fd != NULL) {
jamie@50 1110 free(fd);
jamie@50 1111 }
jamie@50 1112
jamie@50 1113 return SUCCESS;
jamie@50 1114 }
jamie@50 1115
jamie@50 1116
jamie@50 1117
jamie@50 1118
jamie@50 1119