Calculate beat confidence based on rhythmic consistency.
152 {
153
155
156 return 0.6f;
157 }
158
159
161
162
164
165
166 float cv = (avgIBI > 0.0f) ? (stdDev / avgIBI) : 1.0f;
167
168
169
170
171
172 float confidence =
fl::max(0.0f, 1.0f - (cv * 2.0f));
173
174
175 float ibiDiff =
fl::abs(currentIBI - avgIBI);
176 float ibiError = (avgIBI > 0.0f) ? (ibiDiff / avgIBI) : 1.0f;
177 float ibiBonus =
fl::max(0.0f, 1.0f - (ibiError * 4.0f));
178
179
180 return (confidence * 0.7f) + (ibiBonus * 0.3f);
181}
deque< u32 > mIBIHistory
Inter-beat interval history (in frames)
float getAverageIBI() const
Get inter-beat interval (IBI) statistics.
float calculateIBIStdDev() const
Calculate standard deviation of IBI history.
constexpr common_type_t< T, U > max(T a, U b) FL_NOEXCEPT
constexpr enable_if< is_fixed_point< T >::value, T >::type abs(T x) FL_NOEXCEPT