Skip to content

Instantly share code, notes, and snippets.

View geraintluff's full-sized avatar

Geraint geraintluff

View GitHub Profile
@geraintluff
geraintluff / bark-scale.hpp
Created June 15, 2026 07:26
C++ Bark-scale approximation
template<typename Sample=double>
struct BarkScale {
Sample barkToHz(Sample bark) const {
return (a + b*bark)/(c + d*bark);
}
Sample hzToBark(Sample hz) const {
return (c*hz - a)/(b - d*hz);
}
Sample barkToBw(Sample bark) const {
Sample div = c + d*bark;