VST Plugin: Play any scale with it!


Tone tone semitone, tone tone tone semitone - and you get a major scale. That’s what my guitar teacher taught me when I was 14. Although I remember this one clearly, I always forget the minor scale formula and have no clue about Arabic scales, pentatonic scales, harmonics scales and so on.
The concept for this VST plugin was to map any musical scale to the white keys of the keyboard and automate scale changes over time, similar to how Toontrack's EZKeys lets you sequence chords. Imagine hitting play in your DAW, and as your song progresses, your live MIDI input seamlessly shifts from C Major to F Lydian to A Minor, all according to a pre-programmed timeline.
Structure
Blueprint
The Technical Architecture
ScaleEngine
Timeline
The Tricky Bits
Conclusion
Blueprint
The core features of the plugin were:
Timeline-based Scale Automation: The ability to add “Scale Blocks” to a timeline synced with the DAW. Each block would contain a root note and a scale type (Major, Minor Pentatonic, Dorian, etc.). New blocks can be created by simply dragging on the timeline.
Real-time MIDI Processing: The plugin had to intercept incoming MIDI notes and conform them to the active scale on the timeline, in real time.
But the real challenge lay in the special features, which elevated the plugin from a simple utility to a sophisticated musical instrument:
Creative Tonic Locking: Options to either map every scale's root to the C key (for easy white-key playing) or to its “Natural Key” (so a G# minor scale would be mapped to start on G and map up to F, all on the white keys), providing a more intuitive experience.
Scale Wrap Mode: A clever solution for non-heptatonic scales, like a pentatonic scale. This mode distributes the scale's notes evenly across the 7 white keys. When turned off, the 5 notes of pentatonic would map to the first 5 white keys starting from the tonic note and the next 2 keys would be dead. Thus, the next octave would again start from the tonic key, of the next octave.
Adaptive Note Mode: This feature defines what happens to a held note when the scale changes underneath it. The user could choose to either ‘Preserve’ the note (the note of the last scale block keeps playing) or ‘Auto-Conform’ it to the new scale block in the timeline.
Random Sequence Generator: A fun, creative feature to spark ideas by generating a random sequence of scale blocks.
The Technical Architecture
To build this, I used JUCE framework, esp for its robust handling of audio/MIDI processing and cross-platform GUI development. The project was split into two primary components, a standard practice in JUCE development:
ScaleLockProcessor (The Backend): Essentially, the plugin's brain which handles all the core logic. It lives in the processBlock() method, the heart of any real-time plugin. Receives MIDI messages from the DAW, doesn't touch the audio buffer and owns the main processing engines and managers that do the heavy lifting.
ScaleLockEditor (The Frontend): The plugin’s face i.e. GUI the user interacts with. It holds all the visual elements like the timeline, dropdown menus for scales, and a virtual keyboard for feedback. Its job is to send user commands to the ScaleLockProcessor and visually represent the plugin's current state.
ScaleEngine
At the core of the ScaleLockProcessor is the ScaleEngine where note-mapping happens. I broke its logic down into a few parts:
MidiScaleEngine: The main gateway. It receives a MIDI message and does the transformation process.
ScaleMappingEngine: Takes an incoming MIDI note number and, based on the currently active root and scale provided by the TimelineManager, calculates the new target note number.
ScaleDefinitions: Holds the interval data for every supported musical scale. A “music theory library” for the plugin, so our bedroom producers can produce intuitively ;)
Timeline
The client's “unique twist” required a dedicated system for managing the scale changes.
TimelineManager: This manager is the bridge between the DAW's playback and the ScaleEngine. It keeps track of all the ScaleBlock data objects (start time, duration, root, scale). During playback, it constantly checks the DAW's playhead position and tells the ScaleEngine which scale should be active at that exact moment.
TimelineComponent & BlockComponent: These are the UI elements for the timeline. They allow the user to visually add, drag, resize, and edit the ScaleBlock data. This visual feedback is crucial for making the complex automation feel intuitive.
The Tricky Bits
Implementing the special features required careful logic and attention to musical detail.
Adaptive Note Mode & Voice Management
This was the most challenging part. When a held chord transitions from one scale to another, what should happen?
Preserve Held Note: The simple option. The plugin just lets the old notes ring out.
Auto-Conform: Much trickier. When a note becomes dissonant, the plugin re-triggers it to the nearest valid note in the new scale.
To manage this, a VoiceManager was used to track every active MIDI note (note-on messages without a corresponding note-off) and thus know which notes are currently “held” and need to be adapted(preserved or auto-conformed) when scale changes occur.
Scale Wrap & Tonic Locking
Implementing these features involved creating dynamic mapping algorithms. Instead of a static “this key always plays this note” system, the plugin calculates the keyboard mapping on the fly whenever the scale or settings change. The Scale Wrap feature, for example, required an algorithm to distribute a 5-note scale's intervals either across the keyboard continuously(when turned on) or the scale always starting at the same note(when turned off).
I also implemented a live keyboard display to show the note mappings and indicate which note is playing. A mark on the keyboard also shows the tonic note.
Conclusion
This project was a fantastic deep-dive into the intersection of VST/AU plugin development and musical creativity. From the core real-time MIDI processing to the nuanced user-experience features, every component builds towards a highly useful plugin, making music production more accessible.
Subscribe to my newsletter
Read articles from Advait directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Advait
Advait
Passionate AI Dev | Proficient in Deep Learning | GenAI Enthusiast