コード例 #1
0
ファイル: wavetable.c プロジェクト: Craig-J/RhythMIR
void aubio_wavetable_do_multi ( aubio_wavetable_t * s, fmat_t * input, fmat_t * output)
{
    uint_t i, j;
    if (s->playing) {
        smpl_t pos = s->last_pos;
        for (j = 0; j < output->length; j++) {
            smpl_t inc = aubio_parameter_get_next_value( s->freq );
            smpl_t amp = aubio_parameter_get_next_value ( s->amp );
            inc *= (smpl_t)(s->wavetable_length) / (smpl_t) (s->samplerate);
            pos += inc;
            while (pos > s->wavetable_length) {
                pos -= s->wavetable_length;
            }
            for (i = 0; i < output->height; i++) {
                output->data[i][j] = amp * interp_2(s->wavetable, pos);
            }
        }
        s->last_pos = pos;
    } else {
        for (j = 0; j < output->length; j++) {
            aubio_parameter_get_next_value ( s->freq );
            aubio_parameter_get_next_value ( s->amp );
        }
        fmat_zeros (output);
    }
    // add output to input if needed
    if (input && input != output) {
        for (i = 0; i < output->height; i++) {
            for (j = 0; j < output->length; j++) {
                output->data[i][j] += input->data[i][j];
            }
        }
    }
}
コード例 #2
0
ファイル: wavetable.c プロジェクト: Craig-J/RhythMIR
void aubio_wavetable_do ( aubio_wavetable_t * s, fvec_t * input, fvec_t * output)
{
    uint_t i;
    if (s->playing) {
        smpl_t pos = s->last_pos;
        for (i = 0; i < output->length; i++) {
            smpl_t inc = aubio_parameter_get_next_value( s->freq );
            inc *= (smpl_t)(s->wavetable_length) / (smpl_t) (s->samplerate);
            pos += inc;
            while (pos > s->wavetable_length) {
                pos -= s->wavetable_length;
            }
            output->data[i] = aubio_parameter_get_next_value ( s->amp );
            output->data[i] *= interp_2(s->wavetable, pos);
        }
        s->last_pos = pos;
    } else {
        for (i = 0; i < output->length; i++) {
            aubio_parameter_get_next_value ( s->freq );
            aubio_parameter_get_next_value ( s->amp );
        }
        fvec_zeros (output);
    }
    // add input to output if needed
    if (input && input != output) {
        for (i = 0; i < output->length; i++) {
            output->data[i] += input->data[i];
        }
    }
}
コード例 #3
0
void get_some_steps ( aubio_parameter_t * param )
{
  uint_t i = 0;
  uint_t steps = aubio_parameter_get_steps ( param );

  PRINT_MSG("next steps (%d) values:", steps );
  for (i = 0; i < steps; i ++ ) {
    PRINT_MSG(" %f", aubio_parameter_get_next_value (param) );
  }
  PRINT_MSG("\n");

  PRINT_MSG("next 3 values:");
  for (i = 0; i < 3; i ++ ) {
    PRINT_MSG(" %f", aubio_parameter_get_next_value (param) );
  }
  PRINT_MSG("\n");

}