3 #include "hrtf/entry.h" 5 #include "frequency_domain/multiband_filter.h" 7 #include "utilities/map.h" 13 inline auto hrtf_band_centres_hz() {
14 return frequency_domain::band_centres<entry::bands>(audible_range);
17 inline auto hrtf_band_centres(
double sample_rate) {
18 return util::map([&](
auto i) {
return i / sample_rate; },
19 hrtf_band_centres_hz());
22 inline auto hrtf_band_params_hz() {
23 return frequency_domain::compute_multiband_params<entry::bands>(
27 inline auto hrtf_band_params(
double sample_rate) {
28 const auto hz = hrtf_band_params_hz();
29 return frequency_domain::make_edges_and_width_factor(
30 util::map([&](
auto i) {
return i / sample_rate; }, hz.edges),
34 template <
typename It,
typename Callback>
35 void multiband_filter(It begin,
38 const Callback& callback) {
39 frequency_domain::multiband_filter(
40 begin, end, hrtf_band_params(sample_rate), callback);
43 template <
typename It>
44 auto per_band_energy(It begin, It end,
double sample_rate) {
45 return frequency_domain::per_band_energy(
46 begin, end, hrtf_band_params(sample_rate));