surge-synthesizer / surge

Synthesizer plug-in (previously released as Vember Audio Surge)
https://surge-synthesizer.github.io/
GNU General Public License v3.0
3.14k stars 400 forks source link

Support KBM files #1041

Closed baconpaul closed 4 years ago

baconpaul commented 5 years ago

Right now we only support .scl files for tuning, not .scl and .kbm.

http://www.huygens-fokker.org/scala/help.htm#mappings

We should probably support KBM also

But as mentioned in #828 I want to ship SCL first and then add features based on usage and comments so tagging this 1.6.3

ghost commented 4 years ago

KBM Concert Pitch.zip

Hi Paul. Cross-posting from the Slack workspace for when they might be of use.

This archive contains a collection of basic linear keyboard mapping files (KBM) that may be used in virtual-instruments that support loading both the Scala SCL and KBM microtuning format files, such as Pianoteq, as well as for creating custom microtuning mappings within the Scala application itself for exporting to other popular formats, such as TUN, MTS and KSP.

This small linear KBM collection may be used for mapping the starting 1/1 MIDI Note, as well as the Reference Frequency MIDI Note, to the standard concert-pitch chromatic notes.

The file naming convention indicates:

The 1/1 starting MIDI Note for the mapping.

The rounded Reference Frequency.

The mapping for the Reference Frequency MIDI Note.

The standard letter format concert-pitch chromatic scale degree.

For example: 60-262-60 Concert C, indicates at a glance that:

The 1/1 of the microtuning will be mapped to MIDI Note 60.

The Reference Frequency is 262 Hz.

The MIDI Note on which the Reference Frequency is mapped is 60.

*** Please note here that the KBM format is flexible enough that the above parameters can be arbitrarily and independently mapped, such that for instance, a microtuning could have its diapason mapped to the standard concert-pitch of MIDI Note A.69 @ 440 Hz, while the 1/1 starting note could be mapped on 60.C, or any other MIDI Note required of the musical scenario at hand. Such a mapping would look like this:

60-440-69.kbm | Range : 0.C .. 127.G Middle : 60.C Reference : 440.000000 Hertz at note 69.A Octave degree : 0 (highest degree of scale) Mapping : linear

This potential for arbitrary mapping of pitches to MIDI Notes, is the very nature and definition of what's referred to as 'full keyboard microtuning'.

Thanks,

Jacky Ligon

baconpaul commented 4 years ago

OK @JackyLigon I just pushed a functionally complete version of keyboard mapping with a few things left to do. Will take about 45 minutes to get the nightly out. But I wrote extensive unit tests and have tested a variety of keyboard tuning combos.

Here's what I know works

1: Tuning center shifts (so a440 with an arbitrary scale) 2: Keyboard mappings with skipped notes 3: Load that from the UI and reset it 4: In theory the HTML will be correct but not complete

here's what I have left to do still

[ ] Save the KBM in the DAW state along with the tuning [ ] Show the KBM in the HTML

Would appreciate any tests you may have.

ghost commented 4 years ago

I'm attaching here a ZIP archive with four simple just-intonation tunings: octave sections of the harmonic series, 6-12, 8-16, 10-20 and 12-24. These are good for checking the intonation, since under modal rotation, they are 'sum free' - in other words - there is a different collection of intervals on every starting degree of the scale.

In this ZIP archive, I've also included a directory: VI Intonation Test KBM Files, which contains some KBM that can be used to check the tuning of concert C and A, 1/4-tone -/+. If we can get it to pass this slightly more rigorous check, we'll know it's really close.

Also, in the other directory (the same one I've already shared before) there are KBM for shifting the base MIDI notes and frequencies to all of the chromatic pitches. Any of these will be useful for verifying that it's working as it should.

Surge SCL-KBM Test.zip

ghost commented 4 years ago

Attached here is an archive of 148 basic SCL-KBM files that I compiled as a learning device some years ago. Included are a range of equal temperaments, some just-intonation, BP and microtunings by Wendy Carlos. Playing through this small selection of tunings will give newcomers to microtonal tuning a good introduction to the vast potential of this kind of music making.

Surge SCL-KBM Microtuning Library.zip

baconpaul commented 4 years ago

I’m keeping this open just so we can

1) ~put @JackyLigon’s scales in the “resources/data” directory and install it in the Application~ ~Support; and add a “open example tunings folder” menu item to the tuning menu.~

2) ~support drag n drop for KBM just like we do for SCL~

3) ~daw stream the kbm~

4) ~show the kbm in the html ~

Then this one is all wrapped. Easy as pie

baconpaul commented 4 years ago

@JackyLigon I am pushing a change this evening which completes the KBM support (streams to DAW, shows in HTML, etc...). If once the next nightly builds you could do some more testing, that would be great, since this is the version I would otherwise ship to 1.6.5 without feedback.

Thank you!