Supporting alternate tunings is tricky. You have to parse and interpret SCL and KBM files, you need to test in a bunch of ranges, you need to think about edge cases. When we turned to do it in Surge, we got it wrong more often than we got it right. And, since we are committed to open source, we thought about sharing that experience.
So we took our core tuning implementation from Surge and converted it into a standalone MIT licensed C++-14 header-only library. We used this to build the Tuning Workbench Synth. Soon we will also backport it into Surge!
But you can use it today!
So if you are a developer writing a virtual instrument, and you want to add support for SCL/KBM tuning, simply add our code to your source tree and use our data structures. We provide functions that given an SCL and KBM file or data source will give you an object which tells you the frequency of the entire keyboard in a mapping-aware fashion.
The details are at our GitHub repository for the project but the short version is
The Tuning Workbench Synth provides a complete working example of doing this in a JUCE plugin.
Also, the code is open source! We welcome pull requests and API enhancements and discussions about what to do next. Our plans for new features are in the issue list and we welcome any and all participants!
Finally, we licensed the project under an MIT license to allow a broader group of users to add alternative tunings to their code. You can include this library in commercial projects and closed source; you can make changes and not contribute them back; you can do all the things the MIT license allows. We made this choice since we want to see microtunable virtual instruments flourish! But while there is no obligation to do so, if you would like to let us know when you integrate the library with your synth that would be super polite, and if you want to add the project to the list of open source libraries you consume, you can do so using the URL for this page.