libcm is a C development framework with an emphasis on audio signal processing applications.
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

cmOnset.h 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #ifndef cmOnset_h
  2. #define cmOnset_h
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. enum
  7. {
  8. kOkOnRC = cmOkRC,
  9. kDspProcFailOnRC,
  10. kDspAudioFileFailOnRC,
  11. kDspTextFileFailOnRC,
  12. };
  13. typedef cmRC_t cmOnRC_t;
  14. typedef cmHandle_t cmOnH_t;
  15. enum { kNoneFiltId, kSmoothFiltId, kMedianFiltId };
  16. typedef struct
  17. {
  18. double wndMs;
  19. unsigned hopFact;
  20. unsigned audioChIdx;
  21. unsigned wndFrmCnt; // Detection window length
  22. double preWndMult; // Detection window stretch factor prior to current location.
  23. double threshold; // Spectal flux detection threshold
  24. double maxFrqHz; // Ignore frequencies above maxFrqHz during processing.
  25. double filtCoeff; // smoothing filter coeff (-.7)
  26. double medFiltWndMs;// median filter window in milliseconds
  27. unsigned filterId; // kSmoothFiltId || kMedianFiltId
  28. double preDelayMs; // move each detection preDelayMs backwards in time
  29. // on the audio output. (compensates for detection delay due to filtering)
  30. } cmOnsetCfg_t;
  31. extern cmOnH_t cmOnsetNullHandle;
  32. cmOnRC_t cmOnsetInitialize( cmCtx_t* c, cmOnH_t* hp );
  33. cmOnRC_t cmOnsetFinalize( cmOnH_t* hp );
  34. bool cmOnsetIsValid( cmOnH_t h );
  35. cmOnRC_t cmOnsetProc(
  36. cmOnH_t h,
  37. const cmOnsetCfg_t* cfg,
  38. const cmChar_t* inAudioFn );
  39. // Return count of detected onsets.
  40. unsigned cmOnsetCount( cmOnH_t h );
  41. // Return location of detected onsets as a sample offset into the file.
  42. unsigned cmOnsetSampleIndex( cmOnH_t h, unsigned idx );
  43. unsigned cmOnsetHopSampleCount( cmOnH_t h );
  44. cmOnRC_t cmOnsetWrite(
  45. cmOnH_t h,
  46. const cmChar_t* outAudioFn,
  47. const cmChar_t* outTextFn);
  48. cmOnRC_t cmOnsetTest( cmCtx_t* c );
  49. #ifdef __cplusplus
  50. }
  51. #endif
  52. #endif