Changeset 2eb52bd for src/spectral
- Timestamp:
- Nov 17, 2018, 4:36:09 PM (6 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master
- Children:
- 62c2d00, a95b386
- Parents:
- adde1ba (diff), 8eecb9f (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. - Location:
- src/spectral
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/spectral/filterbank_mel.h
radde1ba r2eb52bd 56 56 57 57 \param fb filterbank object 58 \param samplerate audio sampling rate 58 \param samplerate audio sampling rate, in Hz 59 59 60 60 The filter coefficients are built to match exactly Malcolm Slaney's Auditory -
src/spectral/mfcc.c
radde1ba r2eb52bd 52 52 fvec_t *output; 53 53 #endif 54 smpl_t scale; 54 55 }; 55 56 … … 75 76 /* filterbank allocation */ 76 77 mfcc->fb = new_aubio_filterbank (n_filters, mfcc->win_s); 77 aubio_filterbank_set_mel_coeffs_slaney (mfcc->fb, samplerate); 78 if (n_filters == 40) 79 aubio_filterbank_set_mel_coeffs_slaney (mfcc->fb, samplerate); 80 else 81 aubio_filterbank_set_mel_coeffs(mfcc->fb, samplerate, 82 0, samplerate/2.); 78 83 79 84 /* allocating buffers */ … … 97 102 mfcc->output = new_fvec (n_filters); 98 103 #endif 104 105 mfcc->scale = 1.; 99 106 100 107 return mfcc; … … 128 135 fvec_t tmp; 129 136 #endif 137 130 138 /* compute filterbank */ 131 139 aubio_filterbank_do (mf->fb, in, mf->in_dct); … … 134 142 fvec_log10 (mf->in_dct); 135 143 136 /* raise power */ 137 //fvec_pow (mf->in_dct, 3.); 144 if (mf->scale != 1) fvec_mul (mf->in_dct, mf->scale); 138 145 139 146 /* compute mfccs */ … … 151 158 return; 152 159 } 160 161 uint_t aubio_mfcc_set_power (aubio_mfcc_t *mf, smpl_t power) 162 { 163 return aubio_filterbank_set_power(mf->fb, power); 164 } 165 166 uint_t aubio_mfcc_get_power (aubio_mfcc_t *mf) 167 { 168 return aubio_filterbank_get_power(mf->fb); 169 } 170 171 uint_t aubio_mfcc_set_scale (aubio_mfcc_t *mf, smpl_t scale) 172 { 173 mf->scale = scale; 174 return AUBIO_OK; 175 } 176 177 uint_t aubio_mfcc_get_scale (aubio_mfcc_t *mf) 178 { 179 return mf->scale; 180 } 181 182 uint_t aubio_mfcc_set_mel_coeffs (aubio_mfcc_t *mf, smpl_t freq_min, 183 smpl_t freq_max) 184 { 185 return aubio_filterbank_set_mel_coeffs(mf->fb, mf->samplerate, 186 freq_min, freq_max); 187 } 188 189 uint_t aubio_mfcc_set_mel_coeffs_htk (aubio_mfcc_t *mf, smpl_t freq_min, 190 smpl_t freq_max) 191 { 192 return aubio_filterbank_set_mel_coeffs_htk(mf->fb, mf->samplerate, 193 freq_min, freq_max); 194 } 195 196 uint_t aubio_mfcc_set_mel_coeffs_slaney (aubio_mfcc_t *mf) 197 { 198 return aubio_filterbank_set_mel_coeffs_slaney (mf->fb, mf->samplerate); 199 } -
src/spectral/mfcc.h
radde1ba r2eb52bd 74 74 void aubio_mfcc_do (aubio_mfcc_t * mf, const cvec_t * in, fvec_t * out); 75 75 76 /** set power parameter 77 78 \param mf mfcc object, as returned by new_aubio_mfcc() 79 \param power Raise norm of the input spectrum norm to this power before 80 computing filterbank. Defaults to `1`. 81 82 See aubio_filterbank_set_power(). 83 84 */ 85 uint_t aubio_mfcc_set_power (aubio_mfcc_t *mf, smpl_t power); 86 87 /** get power parameter 88 89 \param mf mfcc object, as returned by new_aubio_mfcc() 90 \return current power parameter. Defaults to `1`. 91 92 See aubio_filterbank_get_power(). 93 94 */ 95 uint_t aubio_mfcc_get_power (aubio_mfcc_t *mf); 96 97 /** set scaling parameter 98 99 \param mf mfcc object, as returned by new_aubio_mfcc() 100 \param scale Scaling value to apply. 101 102 Scales the output of the filterbank after taking its logarithm and before 103 computing the DCT. Defaults to `1`. 104 105 */ 106 uint_t aubio_mfcc_set_scale (aubio_mfcc_t *mf, smpl_t scale); 107 108 /** get scaling parameter 109 110 \param mf mfcc object, as returned by new_aubio_mfcc() 111 \return current scaling parameter. Defaults to `1`. 112 113 */ 114 uint_t aubio_mfcc_get_scale (aubio_mfcc_t *mf); 115 116 /** Mel filterbank initialization 117 118 \param mf mfcc object 119 \param fmin start frequency, in Hz 120 \param fmax end frequency, in Hz 121 122 The filterbank will be initialized with bands linearly spaced in the mel 123 scale, from `fmin` to `fmax`. 124 125 See also 126 -------- 127 128 aubio_filterbank_set_mel_coeffs() 129 130 */ 131 uint_t aubio_mfcc_set_mel_coeffs (aubio_mfcc_t *mf, 132 smpl_t fmin, smpl_t fmax); 133 134 /** Mel filterbank initialization 135 136 \param mf mfcc object 137 \param fmin start frequency, in Hz 138 \param fmax end frequency, in Hz 139 140 The bank of filters will be initalized to to cover linearly spaced bands in 141 the Htk mel scale, from `fmin` to `fmax`. 142 143 See also 144 -------- 145 146 aubio_filterbank_set_mel_coeffs_htk() 147 148 */ 149 uint_t aubio_mfcc_set_mel_coeffs_htk (aubio_mfcc_t *mf, 150 smpl_t fmin, smpl_t fmax); 151 152 /** Mel filterbank initialization (Auditory Toolbox's parameters) 153 154 \param mf mfcc object 155 \param samplerate audio sampling rate, in Hz 156 157 The filter coefficients are built to match exactly Malcolm Slaney's Auditory 158 Toolbox implementation. The number of filters should be 40. 159 160 This is the default filterbank when `mf` was created with `n_filters = 40`. 161 162 See also 163 -------- 164 165 aubio_filterbank_set_mel_coeffs_slaney() 166 167 */ 168 uint_t aubio_mfcc_set_mel_coeffs_slaney (aubio_mfcc_t *mf); 169 76 170 #ifdef __cplusplus 77 171 }
Note: See TracChangeset
for help on using the changeset viewer.