Changeset 31907fd for src/spectral


Ignore:
Timestamp:
Nov 3, 2009, 6:23:04 PM (15 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, pitchshift, sampler, timestretch, yinfft+
Children:
bf2e7a7
Parents:
bafe71d
Message:

src/spectral/specdesc.{c,h}: rename aubio_onsetdetection to aubio_specdesc

Location:
src/spectral
Files:
2 moved

Legend:

Unmodified
Added
Removed
  • src/spectral/specdesc.c

    rbafe71d r31907fd  
    2323#include "cvec.h"
    2424#include "spectral/fft.h"
     25#include "spectral/specdesc.h"
    2526#include "mathutils.h"
    2627#include "utils/hist.h"
    27 #include "onset/onsetdetection.h"
    2828
    2929/** Energy based onset detection function
     
    3131  This function calculates the local energy of the input spectral frame.
    3232 
    33   \param o onset detection object as returned by new_aubio_onsetdetection()
    34   \param fftgrain input spectral frame
    35   \param onset output onset detection function
    36 
    37 */
    38 void aubio_onsetdetection_energy(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);
     33  \param o onset detection object as returned by new_aubio_specdesc()
     34  \param fftgrain input spectral frame
     35  \param onset output onset detection function
     36
     37*/
     38void aubio_specdesc_energy(aubio_specdesc_t *o, cvec_t * fftgrain, fvec_t * onset);
    3939/** High Frequency Content onset detection function
    4040 
     
    4545  Musical Signal. PhD dissertation, University of Bristol, UK, 1996.
    4646 
    47   \param o onset detection object as returned by new_aubio_onsetdetection()
    48   \param fftgrain input spectral frame
    49   \param onset output onset detection function
    50 
    51 */
    52 void aubio_onsetdetection_hfc(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);
     47  \param o onset detection object as returned by new_aubio_specdesc()
     48  \param fftgrain input spectral frame
     49  \param onset output onset detection function
     50
     51*/
     52void aubio_specdesc_hfc(aubio_specdesc_t *o, cvec_t * fftgrain, fvec_t * onset);
    5353/** Complex Domain Method onset detection function
    5454 
     
    5757  Effects Conference, DAFx-03, pages 90-93, London, UK, 2003.
    5858
    59   \param o onset detection object as returned by new_aubio_onsetdetection()
    60   \param fftgrain input spectral frame
    61   \param onset output onset detection function
    62 
    63 */
    64 void aubio_onsetdetection_complex(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);
     59  \param o onset detection object as returned by new_aubio_specdesc()
     60  \param fftgrain input spectral frame
     61  \param onset output onset detection function
     62
     63*/
     64void aubio_specdesc_complex(aubio_specdesc_t *o, cvec_t * fftgrain, fvec_t * onset);
    6565/** Phase Based Method onset detection function
    6666
     
    7070  Hong-Kong, 2003.
    7171
    72   \param o onset detection object as returned by new_aubio_onsetdetection()
    73   \param fftgrain input spectral frame
    74   \param onset output onset detection function
    75 
    76 */
    77 void aubio_onsetdetection_phase(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);
     72  \param o onset detection object as returned by new_aubio_specdesc()
     73  \param fftgrain input spectral frame
     74  \param onset output onset detection function
     75
     76*/
     77void aubio_specdesc_phase(aubio_specdesc_t *o, cvec_t * fftgrain, fvec_t * onset);
    7878/** Spectral difference method onset detection function
    7979
     
    8282  (ICME 2001), pages 881­884, Tokyo, Japan, August 2001.
    8383
    84   \param o onset detection object as returned by new_aubio_onsetdetection()
    85   \param fftgrain input spectral frame
    86   \param onset output onset detection function
    87 
    88 */
    89 void aubio_onsetdetection_specdiff(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);
     84  \param o onset detection object as returned by new_aubio_specdesc()
     85  \param fftgrain input spectral frame
     86  \param onset output onset detection function
     87
     88*/
     89void aubio_specdesc_specdiff(aubio_specdesc_t *o, cvec_t * fftgrain, fvec_t * onset);
    9090/** Kullback-Liebler onset detection function
    9191 
     
    9494  (ICMC), Singapore, 2003.
    9595 
    96   \param o onset detection object as returned by new_aubio_onsetdetection()
    97   \param fftgrain input spectral frame
    98   \param onset output onset detection function
    99 
    100 */
    101 void aubio_onsetdetection_kl(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);
     96  \param o onset detection object as returned by new_aubio_specdesc()
     97  \param fftgrain input spectral frame
     98  \param onset output onset detection function
     99
     100*/
     101void aubio_specdesc_kl(aubio_specdesc_t *o, cvec_t * fftgrain, fvec_t * onset);
    102102/** Modified Kullback-Liebler onset detection function
    103103
     
    106106  music, Queen Mary University of London, London, UK, 2006.
    107107
    108   \param o onset detection object as returned by new_aubio_onsetdetection()
    109   \param fftgrain input spectral frame
    110   \param onset output onset detection function
    111 
    112 */
    113 void aubio_onsetdetection_mkl(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);
     108  \param o onset detection object as returned by new_aubio_specdesc()
     109  \param fftgrain input spectral frame
     110  \param onset output onset detection function
     111
     112*/
     113void aubio_specdesc_mkl(aubio_specdesc_t *o, cvec_t * fftgrain, fvec_t * onset);
    114114/** Spectral Flux
    115115
     
    118118  Canada, 2006.
    119119
    120   \param o onset detection object as returned by new_aubio_onsetdetection()
    121   \param fftgrain input spectral frame
    122   \param onset output onset detection function
    123 
    124 */
    125 void aubio_onsetdetection_specflux(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);
     120  \param o onset detection object as returned by new_aubio_specdesc()
     121  \param fftgrain input spectral frame
     122  \param onset output onset detection function
     123
     124*/
     125void aubio_specdesc_specflux(aubio_specdesc_t *o, cvec_t * fftgrain, fvec_t * onset);
    126126
    127127/** onsetdetection types */
     
    136136        aubio_onset_specflux,       /**< spectral flux */
    137137        aubio_onset_default = aubio_onset_hfc, /**< default mode, set to hfc */
    138 } aubio_onsetdetection_type;
     138} aubio_specdesc_type;
    139139
    140140/** structure to store object state */
    141 struct _aubio_onsetdetection_t {
    142   aubio_onsetdetection_type onset_type; /**< onset detection type */
    143   /** Pointer to aubio_onsetdetection_<type> function */
    144   void (*funcpointer)(aubio_onsetdetection_t *o,
     141struct _aubio_specdesc_t {
     142  aubio_specdesc_type onset_type; /**< onset detection type */
     143  /** Pointer to aubio_specdesc_<type> function */
     144  void (*funcpointer)(aubio_specdesc_t *o,
    145145      cvec_t * fftgrain, fvec_t * onset);
    146146  smpl_t threshold;      /**< minimum norm threshold for phase and specdiff */
     
    154154
    155155/* Energy based onset detection function */
    156 void aubio_onsetdetection_energy  (aubio_onsetdetection_t *o UNUSED,
     156void aubio_specdesc_energy  (aubio_specdesc_t *o UNUSED,
    157157    cvec_t * fftgrain, fvec_t * onset) {
    158158  uint_t i,j;
     
    166166
    167167/* High Frequency Content onset detection function */
    168 void aubio_onsetdetection_hfc(aubio_onsetdetection_t *o UNUSED,
     168void aubio_specdesc_hfc(aubio_specdesc_t *o UNUSED,
    169169    cvec_t * fftgrain, fvec_t * onset){
    170170  uint_t i,j;
     
    179179
    180180/* Complex Domain Method onset detection function */
    181 void aubio_onsetdetection_complex (aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset) {
     181void aubio_specdesc_complex (aubio_specdesc_t *o, cvec_t * fftgrain, fvec_t * onset) {
    182182  uint_t i, j;
    183183  uint_t nbins = fftgrain->length;
     
    204204
    205205/* Phase Based Method onset detection function */
    206 void aubio_onsetdetection_phase(aubio_onsetdetection_t *o,
     206void aubio_specdesc_phase(aubio_specdesc_t *o,
    207207    cvec_t * fftgrain, fvec_t * onset){
    208208  uint_t i, j;
     
    236236
    237237/* Spectral difference method onset detection function */
    238 void aubio_onsetdetection_specdiff(aubio_onsetdetection_t *o,
     238void aubio_specdesc_specdiff(aubio_specdesc_t *o,
    239239    cvec_t * fftgrain, fvec_t * onset){
    240240  uint_t i, j;
     
    267267 * note we use ln(1+Xn/(Xn-1+0.0001)) to avoid
    268268 * negative (1.+) and infinite values (+1.e-10) */
    269 void aubio_onsetdetection_kl(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset){
     269void aubio_specdesc_kl(aubio_specdesc_t *o, cvec_t * fftgrain, fvec_t * onset){
    270270  uint_t i,j;
    271271  for (i=0;i<fftgrain->channels;i++) {
     
    283283 * note we use ln(1+Xn/(Xn-1+0.0001)) to avoid
    284284 * negative (1.+) and infinite values (+1.e-10) */
    285 void aubio_onsetdetection_mkl(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset){
     285void aubio_specdesc_mkl(aubio_specdesc_t *o, cvec_t * fftgrain, fvec_t * onset){
    286286  uint_t i,j;
    287287  for (i=0;i<fftgrain->channels;i++) {
     
    296296
    297297/* Spectral flux */
    298 void aubio_onsetdetection_specflux(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset){
     298void aubio_specdesc_specflux(aubio_specdesc_t *o, cvec_t * fftgrain, fvec_t * onset){
    299299  uint_t i, j;
    300300  for (i=0;i<fftgrain->channels;i++) {
     
    310310/* Generic function pointing to the choosen one */
    311311void
    312 aubio_onsetdetection_do (aubio_onsetdetection_t *o, cvec_t * fftgrain,
     312aubio_specdesc_do (aubio_specdesc_t *o, cvec_t * fftgrain,
    313313    fvec_t * onset) {
    314314  o->funcpointer(o,fftgrain,onset);
     
    318318 * depending on the choosen type, allocate memory as needed
    319319 */
    320 aubio_onsetdetection_t *
    321 new_aubio_onsetdetection (char_t * onset_mode,
     320aubio_specdesc_t *
     321new_aubio_specdesc (char_t * onset_mode,
    322322    uint_t size, uint_t channels){
    323   aubio_onsetdetection_t * o = AUBIO_NEW(aubio_onsetdetection_t);
     323  aubio_specdesc_t * o = AUBIO_NEW(aubio_specdesc_t);
    324324  uint_t rsize = size/2+1;
    325   aubio_onsetdetection_type onset_type;
     325  aubio_specdesc_type onset_type;
    326326  if (strcmp (onset_mode, "energy") == 0)
    327327      onset_type = aubio_onset_energy;
     
    389389  switch(onset_type) {
    390390    case aubio_onset_energy:
    391       o->funcpointer = aubio_onsetdetection_energy;
     391      o->funcpointer = aubio_specdesc_energy;
    392392      break;
    393393    case aubio_onset_hfc:
    394       o->funcpointer = aubio_onsetdetection_hfc;
     394      o->funcpointer = aubio_specdesc_hfc;
    395395      break;
    396396    case aubio_onset_complex:
    397       o->funcpointer = aubio_onsetdetection_complex;
     397      o->funcpointer = aubio_specdesc_complex;
    398398      break;
    399399    case aubio_onset_phase:
    400       o->funcpointer = aubio_onsetdetection_phase;
     400      o->funcpointer = aubio_specdesc_phase;
    401401      break;
    402402    case aubio_onset_specdiff:
    403       o->funcpointer = aubio_onsetdetection_specdiff;
     403      o->funcpointer = aubio_specdesc_specdiff;
    404404      break;
    405405    case aubio_onset_kl:
    406       o->funcpointer = aubio_onsetdetection_kl;
     406      o->funcpointer = aubio_specdesc_kl;
    407407      break;
    408408    case aubio_onset_mkl:
    409       o->funcpointer = aubio_onsetdetection_mkl;
     409      o->funcpointer = aubio_specdesc_mkl;
    410410      break;
    411411    case aubio_onset_specflux:
    412       o->funcpointer = aubio_onsetdetection_specflux;
     412      o->funcpointer = aubio_specdesc_specflux;
    413413      break;
    414414    default:
     
    419419}
    420420
    421 void del_aubio_onsetdetection (aubio_onsetdetection_t *o){
     421void del_aubio_specdesc (aubio_specdesc_t *o){
    422422  switch(o->onset_type) {
    423423    /* for both energy and hfc, only fftgrain->norm is required */
  • src/spectral/specdesc.h

    rbafe71d r31907fd  
    4141
    4242/** onsetdetection structure */
    43 typedef struct _aubio_onsetdetection_t aubio_onsetdetection_t;
     43typedef struct _aubio_specdesc_t aubio_specdesc_t;
    4444/** execute onset detection function on a spectral frame
    4545
    4646  Generic function to compute onset detection.
    4747 
    48   \param o onset detection object as returned by new_aubio_onsetdetection()
     48  \param o onset detection object as returned by new_aubio_specdesc()
    4949  \param fftgrain input signal spectrum as computed by aubio_pvoc_do
    5050  \param onset output vector (one sample long, to send to the peak picking)
    5151
    5252*/
    53 void aubio_onsetdetection_do (aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);
     53void aubio_specdesc_do (aubio_specdesc_t *o, cvec_t * fftgrain, fvec_t * onset);
    5454/** creation of an onset detection object
    5555
     
    5959
    6060*/
    61 aubio_onsetdetection_t * new_aubio_onsetdetection(char_t * onset_mode, uint_t buf_size, uint_t channels);
     61aubio_specdesc_t * new_aubio_specdesc(char_t * onset_mode, uint_t buf_size, uint_t channels);
    6262/** deletion of an onset detection object
    6363
    64   \param o onset detection object as returned by new_aubio_onsetdetection()
     64  \param o onset detection object as returned by new_aubio_specdesc()
    6565
    6666*/
    67 void del_aubio_onsetdetection(aubio_onsetdetection_t *o);
     67void del_aubio_specdesc(aubio_specdesc_t *o);
    6868
    6969#ifdef __cplusplus
Note: See TracChangeset for help on using the changeset viewer.