Ignore:
Timestamp:
Nov 10, 2018, 11:58:54 AM (5 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/timestretch, fix/ffmpeg5, master
Children:
ed09ba7c
Parents:
568fc60 (diff), 9ef3c6e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into feature/pytest

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/spectral/filterbank_mel.c

    r568fc60 r893e699  
    5555  }
    5656
    57   if (freqs->data[freqs->length - 1] > samplerate / 2) {
    58     AUBIO_WRN ("Nyquist frequency is %fHz, but highest frequency band ends at \
    59 %fHz\n", samplerate / 2, freqs->data[freqs->length - 1]);
     57  for (fn = 0; fn < freqs->length; fn++) {
     58    if (freqs->data[fn] < 0) {
     59      AUBIO_ERR("filterbank_mel: freqs must contain only positive values.\n");
     60      return AUBIO_FAIL;
     61    } else if (freqs->data[fn] > samplerate / 2) {
     62      AUBIO_WRN("filterbank_mel: freqs should contain only "
     63          "values < samplerate / 2.\n");
     64    } else if (fn > 0 && freqs->data[fn] < freqs->data[fn-1]) {
     65      AUBIO_ERR("filterbank_mel: freqs should be a list of frequencies "
     66          "sorted from low to high, but freq[%d] < freq[%d-1]\n", fn, fn);
     67      return AUBIO_FAIL;
     68    } else if (fn > 0 && freqs->data[fn] == freqs->data[fn-1]) {
     69      AUBIO_WRN("filterbank_mel: set_triangle_bands received a list "
     70          "with twice the frequency %f\n", freqs->data[fn]);
     71    }
    6072  }
    6173
     
    92104  /* zeroing of all filters */
    93105  fmat_zeros (filters);
    94 
    95   if (fft_freqs->data[1] >= lower_freqs->data[0]) {
    96     /* - 1 to make sure we don't miss the smallest power of two */
    97     uint_t min_win_s =
    98         (uint_t) FLOOR (samplerate / lower_freqs->data[0]) - 1;
    99     AUBIO_WRN ("Lowest frequency bin (%.2fHz) is higher than lowest frequency \
    100 band (%.2f-%.2fHz). Consider increasing the window size from %d to %d.\n",
    101         fft_freqs->data[1], lower_freqs->data[0],
    102         upper_freqs->data[0], (win_s - 1) * 2,
    103         aubio_next_power_of_two (min_win_s));
    104   }
    105106
    106107  /* building each filter table */
     
    161162  del_fvec (fft_freqs);
    162163
    163   return 0;
     164  return AUBIO_OK;
    164165}
    165166
Note: See TracChangeset for help on using the changeset viewer.