dynamic string tuning

This commit is contained in:
2026-06-22 21:31:53 -05:00
parent b4df8657dd
commit 3e94d64f4a
7 changed files with 191 additions and 44 deletions

View File

@@ -6,6 +6,9 @@ Synth::Synth(ConfigService* config, LoggerService* logger, ScopeBuffer* scope, N
voices_.fill(Voice(config_, logger_));
filter_.setSampleRate(44100.0f);
filter_.setParams(Filter::Type::BiquadLowpass, 1000.0f, 0.707f);
}
void Synth::handleNoteEvent(const NoteEvent& event) {
@@ -56,13 +59,13 @@ void Synth::process(float* out, size_t nFrames) {
float mix = 0.0f;
for(size_t j = 0; j < voices_.size(); j++) {
bool temp = false;
//if(!voices_[j].isActive()) continue;
if(!voices_[j].isActive()) continue;
mix += voices_[j].process(temp);
if(j == lowestVoice) triggered = temp;
}
mix = tanh(mix/4.0f); // prevent clipping
sampleOut = mix;
sampleOut = filter_.biquadProcess(mix);
out[2*i] = sampleOut;
out[2*i+1] = sampleOut;
@@ -96,4 +99,4 @@ Voice* Synth::findVoiceByNote(uint8_t note) {
}
}
return nullptr;
}
}