From 64b79a13cb82cb521e38981946247e4ab0cbdd23 Mon Sep 17 00:00:00 2001 From: Alex St-Onge Date: Mon, 30 Oct 2023 18:35:40 -0700 Subject: [PATCH] Sympatetic string --- src/string_ensemble.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/string_ensemble.cpp b/src/string_ensemble.cpp index a066ba9..e684aa2 100644 --- a/src/string_ensemble.cpp +++ b/src/string_ensemble.cpp @@ -12,8 +12,8 @@ void StringEnsemble::Init(float samplerate, const std::array string_outs; + + constexpr float kTransmissionRatio = 0.10f; + float transmission = 0.f; float output = 0.f; for (auto i = 0; i < kStringCount; ++i) { string_outs[i] = strings_[i].NextOut(); output += string_outs[i]; + transmission += string_outs[i] * kTransmissionRatio; + string_outs[i] *= (1.f - kTransmissionRatio); } // filter the bridge output - std::array scattered_out = Scatter(string_outs, 0.5f); + transmission = transmission_filter_.Tick(transmission); for (size_t i = 0; i < kStringCount; ++i) { - strings_[i].Tick(scattered_out[i]); + strings_[i].Tick(string_outs[i] + transmission * 0.25f); } - return output; + return string_outs[3] + transmission * 0.25f; }