Devlog #2 - Smart Pedal & Key Release Mechanics
-
Hey everyone!
Time for another update on my Grand Piano VST project. After getting the core samples mapped, I realized the piano felt a bit too clinical. It was time to get my hands dirty with the mechanical noises and body resonances that make a virtual instrument truly breathe.

- Note Off Mechanic: 5 RR - 2 VELOCITY
-I created a separate sampler for pure mechanical Key Up (wood/felt) sounds. Since many MIDI keyboards send a Note On with a velocity of 0 instead of a true Note Off, I scripted a memory array (const var onVels = [];) to store the strike velocity.
-Inside the onNoteOff, the script recalls the exact velocity of the initial strike and triggers the Note Off sample accordingly. This ensures the mechanical clack dynamically matches the intensity of the performance.
- I set a natural AHDSR fade-out (500ms) for the main piano samples upon Note-Off. Simultaneously, a dedicated mechanical sampler set to One-Shot triggers the pure wood/felt release sounds.
- Building a 3-Pedal Engine (CC 64, 66, 67) - 5 RR
I didn't want to stop at just the Sustain pedal. I wanted Sostenuto and Una Corda to physically behave differently.
-Sustain (CC 64): Triggers the massive resonance and damper lift noise, followed by a heavy "thump" upon release.
-Soft / Sostenuto (CC 67, 66): These pedals don't lift all the dampers. For these, I mapped dry mechanical action samples to dummy keys.
- Integrating the Sympathetic Resonance Engine
To simulate the true sympathetic string resonance, I built an algorithmic engine rather than relying on heavy samples. When you hold a chord and strike a new note, the undamped strings should naturally vibrate. To replicate this massive web of possibilities, the engine generates pure Sine Waves tuned to the appropriate harmonic frequencies of the active notes. I then run these sine waves through custom saturation and EQ to turn them from digital beeps into warm, vibrating steel strings but it feels like WUU sound xd. It perfectly masks the fadeouts and makes the instrument feel incredibly alive


Triggers: If the new note has a harmonic relationship with any of the un-damped strings (specifically the 1st Octave, 5th, 2nd Octave, and Major 3rd defined in the Triggers array), it excites a targeted sine wave at that exact frequency.
- UI & Acoustic Masking
Added Key Noise and Pedal Noise knobs to the UI. The biggest mixing challenge was finding the default dB values. I applied the Acoustic Masking rule: when you play a pianissimo chord, you should clearly hear the mechanics. When you smash a fortissimo chord, the string resonance should completely swallow the mechanical clicks. I locked these sweet spots in as the defaultValue properties in the UI.
The piano is finally starting to feel like a massive, 500kg wooden beast living inside the DAW.
-
I'll keep the future updates in my main topic to keep things organized. I accidentally created a new topic

-
You've been busy :)
@omerdal said in Devlog #2 - Smart Pedal & Key Release Mechanics:
(const var onVels = [];)
You can use a MIDI list here.