Exemplo n.º 1
0
static PyObject *
Py_fft_rdo(Py_fft * self, PyObject * args)
{
    PyObject *input;
    fvec_t out;

    if (!PyArg_ParseTuple (args, "O", &input)) {
        return NULL;
    }

    if (!PyAubio_PyCvecToCCvec (input, &(self->cvecin)) ) {
        return NULL;
    }

    if (self->cvecin.length != self->win_s / 2 + 1) {
        PyErr_Format(PyExc_ValueError,
                     "input cvec has length %d, but fft expects length %d",
                     self->cvecin.length, self->win_s / 2 + 1);
        return NULL;
    }

    Py_INCREF(self->rdoout);
    if (!PyAubio_ArrayToCFvec(self->rdoout, &out) ) {
        return NULL;
    }
    // compute the function
    aubio_fft_rdo (self->o, &(self->cvecin), &out);
    return self->rdoout;
}
Exemplo n.º 2
0
void aubio_pvoc_rdo(aubio_pvoc_t *pv,cvec_t * fftgrain, fvec_t * synthnew) {
  /* calculate rfft */
  aubio_fft_rdo(pv->fft,fftgrain,pv->synth);
  /* unshift */
  fvec_shift(pv->synth);
  aubio_pvoc_addsynth(pv->synth->data,pv->synthold->data,
      synthnew->data,pv->win_s,pv->hop_s);
}
Exemplo n.º 3
0
int main (void)
{
  int return_code = 0;
  uint_t i, n_iters = 100; // number of iterations
  uint_t win_s = 500; // window size
  fvec_t * in = new_fvec (win_s); // input buffer
  cvec_t * fftgrain = new_cvec (win_s); // fft norm and phase
  fvec_t * out = new_fvec (win_s); // output buffer
  // create fft object
  aubio_fft_t * fft = new_aubio_fft(win_s);

  if (!fft) {
    return_code = 1;
    goto beach;
  }

  // fill input with some data
  in->data[0] = 1;
  in->data[1] = 2;
  in->data[2] = 3;
  in->data[3] = 4;
  in->data[4] = 5;
  in->data[5] = 6;
  in->data[6] = 5;
  in->data[7] = 6;
  //fvec_print(in);

  for (i = 0; i < n_iters; i++) {
    // execute stft
    aubio_fft_do (fft,in,fftgrain);
    cvec_print(fftgrain);

    // execute inverse fourier transform
    aubio_fft_rdo(fft,fftgrain,out);
  }

  // cleam up
  //fvec_print(out);
  del_aubio_fft(fft);
beach:
  del_fvec(in);
  del_cvec(fftgrain);
  del_fvec(out);
  aubio_cleanup();
  return return_code;
}