This commit is contained in:
2026-07-03 14:15:12 -05:00
parent 6913736476
commit 41f7499c23
3 changed files with 59 additions and 4 deletions

View File

@@ -13,7 +13,7 @@ PianoString::PianoString(ConfigService* config, LoggerService* logger) : Instrum
void PianoString::noteOn(float frequency, float velocity) {
active_ = true;
frequency_ = frequency;
frequency_ = frequency / 1.03746174945f; // empirical adjustment (original was 83 cents sharp)
damping_ = 0.5f;
rms_ = 5.0f;
@@ -84,9 +84,9 @@ float PianoString::process(bool& scopeTrigger) {
}
phaseTracker_ += frequency_ / sampleRate_;
if(phaseTracker_ > 1.0f) {
phaseTracker_ -= 1.0f;
scopeTrigger = true;
if(phaseTracker_ > 2.0f) {
phaseTracker_ -= 2.0f;
if(!scopeTrigger) scopeTrigger = true;
}
float sampleOut = stringY_next_[static_cast<size_t>(samplePosition_*segmentCount_)];