Ignore:
Timestamp:
Dec 4, 2009, 1:47:17 AM (14 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:
f7b05d4
Parents:
4621cd6
Message:

tests/src: switch to mono

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/src/test-phasevoc-jack.c

    r4621cd6 raea235c  
    2222uint_t pos      = 0;  /* frames%dspblocksize for jack loop */
    2323
    24 fvec_t * in;
    25 cvec_t * fftgrain;
    26 fvec_t * out;
     24fvec_t * in[2];
     25cvec_t * fftgrain[2];
     26fvec_t * out[2];
    2727
    28 aubio_pvoc_t * pv;
     28aubio_pvoc_t * pv[2];
    2929
    3030int aubio_process(float **input, float **output, int nframes);
     
    3232int main(){
    3333        /* allocate some memory */
    34         in       = new_fvec (hop_s, channels); /* input buffer       */
    35         fftgrain = new_cvec (win_s, channels); /* fft norm and phase */
    36         out      = new_fvec (hop_s, channels); /* output buffer      */
     34  uint_t i;
     35    for (i=0;i<channels;i++) {
     36        in[i]       = new_fvec (hop_s); /* input buffer       */
     37        fftgrain[i] = new_cvec (win_s); /* fft norm and phase */
     38        out[i]      = new_fvec (hop_s); /* output buffer      */
    3739        /* allocate fft and other memory space */
    38         pv = new_aubio_pvoc(win_s,hop_s,channels);
     40        pv[i] = new_aubio_pvoc(win_s,hop_s);
     41    }
    3942
    4043#ifdef HAVE_JACK
     
    5356#endif
    5457       
    55         del_aubio_pvoc(pv);
    56         del_cvec(fftgrain);
    57         del_fvec(in);
    58         del_fvec(out);
     58    for (i=0;i<channels;i++) {
     59        del_aubio_pvoc(pv[i]);
     60        del_cvec(fftgrain[i]);
     61        del_fvec(in[i]);
     62        del_fvec(out[i]);
     63    }
    5964        aubio_cleanup();
    6065        return 0;
     
    6772    for (i=0;i<channels;i++) {
    6873      /* write input to datanew */
    69       fvec_write_sample(in, input[i][j], i, pos);
     74      fvec_write_sample(in[i], input[i][j], pos);
    7075      /* put synthnew in output */
    71       output[i][j] = fvec_read_sample(out, i, pos);
     76      output[i][j] = fvec_read_sample(out[i], pos);
    7277    }
    7378    /*time for fft*/
    7479    if (pos == hop_s-1) {
    7580      /* block loop */
    76       aubio_pvoc_do (pv,in, fftgrain);
     81    for (i=0;i<channels;i++) {
     82      aubio_pvoc_do (pv[i], in[i], fftgrain[i]);
    7783      // zero phases of first channel
    78       for (i=0;i<fftgrain->length;i++) fftgrain->phas[0][i] = 0.;
     84      for (i=0;i<fftgrain[i]->length;i++) fftgrain[0]->phas[i] = 0.;
    7985      // double phases of second channel
    80       for (i=0;i<fftgrain->length;i++) {
    81         fftgrain->phas[1][i] =
    82           aubio_unwrap2pi (fftgrain->phas[1][i] * 2.);
     86      for (i=0;i<fftgrain[i]->length;i++) {
     87        fftgrain[1]->phas[i] =
     88          aubio_unwrap2pi (fftgrain[1]->phas[i] * 2.);
    8389      }
    8490      // copy second channel to third one
    85       aubio_pvoc_rdo(pv,fftgrain,out);
     91      aubio_pvoc_rdo(pv[i], fftgrain[i], out[i]);
    8692      pos = -1;
     93    }
    8794    }
    8895    pos++;
Note: See TracChangeset for help on using the changeset viewer.