Compare commits
2 Commits
385563e64e
...
c4499ce7c9
| Author | SHA1 | Date |
|---|---|---|
|
|
c4499ce7c9 | |
|
|
46ab0a131a |
|
|
@ -112,6 +112,7 @@ void block::process(const sample &pcm, sample &fft, sample &mfcc, float &freq) {
|
||||||
|
|
||||||
// calculate fft
|
// calculate fft
|
||||||
std::vector<std::complex<double> > mfspec;
|
std::vector<std::complex<double> > mfspec;
|
||||||
|
mfspec.reserve(m_block_size);
|
||||||
for (u32 i=0; i<m_block_size; ++i) {
|
for (u32 i=0; i<m_block_size; ++i) {
|
||||||
mfspec.push_back(std::complex<double>(m_fftw->m_spectrum[i][0],
|
mfspec.push_back(std::complex<double>(m_fftw->m_spectrum[i][0],
|
||||||
m_fftw->m_spectrum[i][1]));
|
m_fftw->m_spectrum[i][1]));
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,7 @@ void block_stream::init(u32 block_size, u32 overlap, window::type t, bool ditchp
|
||||||
m_window.set_current_type(t);
|
m_window.set_current_type(t);
|
||||||
|
|
||||||
m_blocks.clear();
|
m_blocks.clear();
|
||||||
|
m_blocks.reserve(MAX_BLOCKS);
|
||||||
sample dummy(block_size);
|
sample dummy(block_size);
|
||||||
for (u32 i=0; i<MAX_BLOCKS; i++) {
|
for (u32 i=0; i<MAX_BLOCKS; i++) {
|
||||||
m_blocks.push_back(block(0,"dummy",dummy,44100,m_window));
|
m_blocks.push_back(block(0,"dummy",dummy,44100,m_window));
|
||||||
|
|
|
||||||
|
|
@ -228,6 +228,7 @@ u32 brain::rev_search(const block &target, const search_params ¶ms) {
|
||||||
return furthest_index;
|
return furthest_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
// really slow - every to every comparison of blocks calculating average distance
|
// really slow - every to every comparison of blocks calculating average distance
|
||||||
double brain::calc_average_diff(search_params ¶ms) {
|
double brain::calc_average_diff(search_params ¶ms) {
|
||||||
double diff=0;
|
double diff=0;
|
||||||
|
|
@ -261,6 +262,7 @@ void brain::build_synapses_thresh(search_params ¶ms, double thresh) {
|
||||||
++outer_index;
|
++outer_index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
void brain::build_synapses_fixed(search_params ¶ms) {
|
void brain::build_synapses_fixed(search_params ¶ms) {
|
||||||
//m_average_error = calc_average_diff(params)*thresh;
|
//m_average_error = calc_average_diff(params)*thresh;
|
||||||
|
|
|
||||||
|
|
@ -62,8 +62,8 @@ public:
|
||||||
u32 rev_search(const block &target, const search_params ¶ms);
|
u32 rev_search(const block &target, const search_params ¶ms);
|
||||||
|
|
||||||
// synaptic search
|
// synaptic search
|
||||||
double calc_average_diff(search_params ¶ms);
|
// double calc_average_diff(search_params ¶ms);
|
||||||
void build_synapses_thresh(search_params ¶ms, double threshold);
|
// void build_synapses_thresh(search_params ¶ms, double threshold);
|
||||||
void build_synapses_fixed(search_params ¶ms);
|
void build_synapses_fixed(search_params ¶ms);
|
||||||
u32 search_synapses(const block &target, search_params ¶ms);
|
u32 search_synapses(const block &target, search_params ¶ms);
|
||||||
double get_current_error() { return m_current_error; }
|
double get_current_error() { return m_current_error; }
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue