Changeset fc5bc72


Ignore:
Timestamp:
Jul 22, 2006, 11:43:30 AM (15 years ago)
Author:
Paul Brossier <piem@altern.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master, pitchshift, sampler, timestretch, yinfft+
Children:
4cab19e
Parents:
7524d0b
Message:

update aubiotrack to new tempo objects
update aubiotrack to new tempo objects

File:
1 edited

Legend:

Unmodified
Added
Removed
  • examples/aubiotrack.c

    r7524d0b rfc5bc72  
    1717*/
    1818
     19#include <aubio.h>
    1920#include "utils.h"
    20 #include "beattracking.h"
    2121
    2222unsigned int pos          = 0;    /* frames%dspblocksize */
    23 unsigned int pos2         = 0;    /* frames%dspblocksize */
    2423uint_t usepitch           = 0;
    25 fvec_t * dfframe          = NULL;
    2624fvec_t * out              = NULL;
    27 aubio_beattracking_t * bt = NULL;
    28 uint_t winlen             = 512;
    29 uint_t step               = 0;
     25aubio_tempo_t * bt        = NULL;
    3026uint_t istactus           = 0;
    3127
     
    3430  unsigned int i;       /*channels*/
    3531  unsigned int j;       /*frames*/
    36   smpl_t * btoutput = out->data[0];
    3732  for (j=0;j<(unsigned)nframes;j++) {
    3833    if(usejack) {
     
    4742    if (pos == overlap_size-1) {         
    4843      /* block loop */
    49       aubio_pvoc_do (pv,ibuf, fftgrain);
    50       aubio_onsetdetection(o,fftgrain, onset);
    51       if (usedoubled) {
    52         aubio_onsetdetection(o2,fftgrain, onset2);
    53         onset->data[0][0] *= onset2->data[0][0];
    54       }
    55       /* execute every overlap_size*step */
    56       if (pos2 == step -1 ) {
    57              
    58         /* check dfframe */
    59         /*
    60         outmsg("\n");
    61         for (i = 0; i < winlen; i++ )
    62                 outmsg("%f,", dfframe->data[0][i]);
    63         outmsg("\n");
    64         */
    65                        
    66         aubio_beattracking_do(bt,dfframe,out);
    67 
    68         /* rotate dfframe */
    69         for (i = 0 ; i < winlen - step; i++ )
    70                 dfframe->data[0][i] = dfframe->data[0][i+step];
    71         for (i = winlen - step ; i < winlen; i++ )
    72                 dfframe->data[0][i] = 0.;
    73                
    74         pos2 = -1;
    75       }
    76       pos2++;
    77       isonset = aubio_peakpick_pimrt_wt(onset,parms,&(dfframe->data[0][winlen - step + pos2]));
    78       /* end of second level loop */
    79       istactus = 0;
    80       i=0;
    81       for (i = 1; i < btoutput[0]; i++ ) {
    82               if (pos2 == btoutput[i]) {
    83                       //printf("pos2: %d\n", pos2);
    84                       //printf("tempo:\t%3.5f bpm \n",
    85                       //60.*44100./overlap_size/abs(btoutput[2]-btoutput[1]));
    86                       /* test for silence */
    87                       if (aubio_silence_detection(ibuf, silence)==1) {
    88                               isonset  = 0;
    89                               istactus = 0;
    90                       } else {
    91                               istactus = 1;
    92                       }
    93               }
    94       }
    95 
    96       if (istactus ==1) {
     44      aubio_tempo(bt,ibuf,out);
     45      if (out->data[0][0]==1)
     46        istactus = 1;
     47      else
     48        istactus = 0;
     49      if (istactus) {
    9750              for (pos = 0; pos < overlap_size; pos++)
    9851                      obuf->data[0][pos] = woodblock->data[0][pos];
     
    12578  /* override default settings */
    12679  examples_common_init(argc,argv);
    127   /* configure peak picker */
    128   //aubio_peakpicker_set_thresholdfn(parms,vec_mean);
    129   //aubio_peakpicker_set_threshold(parms,0.);
    130   winlen = SQR(512)/overlap_size;
    13180
    132   dfframe = new_fvec(winlen,channels);
    133   step = winlen/4;
    134   out = new_fvec(step,channels);
    135 
    136   /* test input : impulses starting from 15, at intervals of 50 samples */
    137   //for(i=0;i<16;i++){
    138   //        dfframe->data[0][50*i+14] = 1.;
    139   //}
    140 
    141   bt = new_aubio_beattracking(winlen,channels);
     81  out = new_fvec(2,channels);
     82  bt  = new_aubio_tempo(type_onset,buffer_size,overlap_size,channels);
    14283
    14384  examples_common_process(aubio_process,process_print);
     85
     86  del_aubio_tempo(bt);
     87  del_fvec(out);
    14488
    14589  examples_common_del();
Note: See TracChangeset for help on using the changeset viewer.