예제 #1
0
파일: mathutils.c 프로젝트: EQ4/aubio-mod
smpl_t
fvec_moving_thres (fvec_t * vec, fvec_t * tmpvec,
    uint_t post, uint_t pre, uint_t pos)
{
  uint_t k;
  smpl_t *medar = (smpl_t *) tmpvec->data;
  uint_t win_length = post + pre + 1;
  uint_t length = vec->length;
  /* post part of the buffer does not exist */
  if (pos < post + 1) {
    for (k = 0; k < post + 1 - pos; k++)
      medar[k] = 0.;            /* 0-padding at the beginning */
    for (k = post + 1 - pos; k < win_length; k++)
      medar[k] = vec->data[k + pos - post];
    /* the buffer is fully defined */
  } else if (pos + pre < length) {
    for (k = 0; k < win_length; k++)
      medar[k] = vec->data[k + pos - post];
    /* pre part of the buffer does not exist */
  } else {
    for (k = 0; k < length - pos + post; k++)
      medar[k] = vec->data[k + pos - post];
    for (k = length - pos + post; k < win_length; k++)
      medar[k] = 0.;            /* 0-padding at the end */
  }
  return fvec_median (tmpvec);
}
예제 #2
0
uint_t Note2midi::get_note (fvec_t * note_buffer, fvec_t * note_buffer2){
    uint_t i;
    for (i = 0; i < note_buffer->length; i++) {
        note_buffer2->data[i] = note_buffer->data[i];
    }
    return fvec_median (note_buffer2);
}
예제 #3
0
float fvec_median_const (const float *f, int n) 
{
  float *f2 = fvec_new (n); 
  fvec_cpy (f2, f, n);
  float med = fvec_median (f2, n);
  free (f2);
  return med;
}
예제 #4
0
파일: notes.c 프로젝트: anthonylauzon/aubio
static smpl_t
aubio_notes_get_latest_note (aubio_notes_t *o)
{
  fvec_copy(o->note_buffer, o->note_buffer2);
  return fvec_median (o->note_buffer2) / AUBIO_DEFAULT_CENT_PRECISION;
}