annotate branches/carfac_cpp/src/CARFAC.cpp @ 706:f8e90b5d85fd tip

Delete CARFAC code from this repository. It has been moved to https://github.com/google/carfac Please email me with your github username to get access. I've also created a new mailing list to discuss CARFAC development: https://groups.google.com/forum/#!forum/carfac-dev
author ronw@google.com
date Thu, 18 Jul 2013 20:56:51 +0000
parents d59c0d65624b
children
rev   line source
Ulf@546 1 #include <cmath>
Ulf@546 2
Ulf@538 3 #include "CARFAC.h"
Ulf@538 4 #include "CAR.h"
Ulf@538 5 #include "IHC.h"
Ulf@538 6 #include "AGC.h"
Ulf@564 7 #include "Ear.h"
Ulf@587 8 #include "unit_conversion.h"
Ulf@545 9 #include "CARFAC_common.h"
Ulf@538 10
Ulf@586 11 CARFAC::CARFAC(int fs,
Ulf@586 12 CAR_parameters* car_params,
Ulf@586 13 IHC_parameters* ihc_params,
Ulf@586 14 AGC_parameters* agc_params,
Ulf@586 15 int n_ears){
Ulf@538 16
Ulf@564 17 fs_ = fs;
Ulf@538 18
Ulf@545 19 float pole_hz = car_params->first_pole_theta_* fs / (2*kPi);
Ulf@545 20 while (pole_hz > car_params->min_pole_hz_){
Ulf@547 21 pole_freqs_.push_back(pole_hz); // TODO: STL specific
Ulf@545 22 pole_hz = pole_hz - car_params->erb_per_step_ *
Ulf@555 23 ERB_Hz(pole_hz, car_params->erb_break_freq_,
Ulf@555 24 car_params->erb_q_);
Ulf@545 25 }
Ulf@547 26 n_ch_ = pole_freqs_.size();
Ulf@546 27 max_channels_per_octave_ = log(2) / log(pole_freqs_[0]/pole_freqs_[1]);
Ulf@546 28
Ulf@564 29 n_ears_ = n_ears;
Ulf@586 30 Ear ear = Ear(car_params, ihc_params, agc_params, pole_freqs_, n_ch_, fs);
Ulf@586 31 ears_.assign(n_ears_, ear);
Ulf@545 32 }