diff --git a/speaker_experiments/identity_sliding_fft.cc b/speaker_experiments/identity_sliding_fft.cc index b198b9d..420a186 100644 --- a/speaker_experiments/identity_sliding_fft.cc +++ b/speaker_experiments/identity_sliding_fft.cc @@ -56,9 +56,11 @@ int FindMedian3xLeaker(double window) { */ } +constexpr int64_t kNumRotators = 128; + struct Rotator { std::complex rot[4] = {{1, 0}, 0}; - double window = 0.9999; // at 40 Hz. + double window = std::pow(0.9996, 128.0/kNumRotators); // at 40 Hz. double windowM1 = 1 - window; std::complex exp_mia; int advance = 0; @@ -142,11 +144,11 @@ class TaskExecutor { std::vector& thread_output = thread_outputs_[thread]; for (int i = 0; i < read_; ++i) { int delayed_ix = total_ + i - rot_left_[my_task].advance; + float delayed_l = history_[2 * (delayed_ix & kHistoryMask) + 1]; float delayed_r = history_[2 * (delayed_ix & kHistoryMask) + 0]; - float delayed_g = history_[2 * (delayed_ix & kHistoryMask) + 1]; - rot_left_[my_task].Increment(delayed_r); - rot_right_[my_task].Increment(delayed_g); + rot_left_[my_task].Increment(delayed_l); + rot_right_[my_task].Increment(delayed_r); double left = rot_left_[my_task].GetSample(); double right = rot_right_[my_task].GetSample(); @@ -178,7 +180,6 @@ void Process( std::vector output(output_channels * kBlockSize); std::vector rot_left, rot_right; - constexpr int64_t kNumRotators = 512; rot_left.reserve(kNumRotators); rot_right.reserve(kNumRotators); for (int i = 0; i < kNumRotators; ++i) {