surge-synthesizer / surge

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

dynamic microtonal support #1209

Closed muziker closed 3 years ago

muziker commented 5 years ago

Is your feature request related to a problem? Please describe. I want to explore microtones, but not in the way most people do. The traditional method is to load up a scala file that defines the scale to be used.

Describe the solution you'd like I want to have a dynamically changing scale. So it could be bohlen pierce at one point then 17-EDO at others. One way of doing this is to change the way the synth responds to midi notes. Instead of midi notes, maybe just passing the fundamental frequency can enable the synth to generate the correct note. For instance f=443, would get the synth to look for the nearest possible note, and dynamically shift the note to the correct frequency either through calculating the correct midi bend or directly calculating the pitch shift required for the wavetable to work. At the moment, even notation software or daw editor doesn't have the features to do this. so it notation will probably be in an alternative form such as from pure data, tidalcycles or supercollider, where you can explicitly output the frequency.

Describe alternatives you've considered pure data can calculate the midi and bends, but it would be faster in a synth itself. Also having a sampler that can do this would mean exploring timbres that will be pretty interesting

baconpaul commented 4 years ago

So it’s an interesting idea - can I feed the synth a “frequency stream” rather than a “note stream”

The answer, also, is “kind of yes kind of”. With the scl tuning support I put into 1.6.2 we do have a more advanced way to calculate frequency. But it’s a lot of plumbing.

So let me ask you a couple of questions

  1. The VST3, AU, VST2 and LV2 APIs don’t support any way for this frequency information to come in. They are midi at their core. Are you imagining surge running in some other form? Like a standalone bound to an OSC port or something?

  2. Do you have any such setup in any other synth in the world?

  3. When you do this with PD, what’s the input you use to even make the music? You can’t play a keyboard to do this for instance.

This is a neat request but my guess is it would be quite a lot of work. So my other question is: Are you a developer? If so would you be interested in collaborating on the synth to see if it could support the thing you are envisaging? That’s a great thing about open source! But we’re all volunteers and have a long list so worry this one may take a long while to emerge (depending on your answers above) absent someone actually doing it!

And thanks for contributing the idea. Each one is interesting - and this one is very interesting.

mkruselj commented 4 years ago

http://www.microtonal-synthesis.com/MIDItuning.html

Possibly very relevant.

muziker commented 4 years ago

Yes thanks, i've been thinking about it for some time, but haven't got around to trying this out. I was motivated by questioning what has never been done by the xenharmonic group, and wanting to transfer that to an electroacoustic setting. I can do some programming and have compiled many of the open source plugins, so yes i don't mind getting my hands dirty, but need to do some in real life related tasks first. So to answer the question:

  1. I'm pretty sure no DAW can do this yet, and so in the context of the composition, i envision myself using tidal cycles as a sequencer to feed data into pure data where i can tweak the midi data to a format that can be handled by the synth. I don't think the midi frequency tuning in the microtonal-synthesis.com site works on the synth.

  2. There isn't anything like this in the synth world. Compositions have fixed scales. They modulate their key based on this and will never change it in between. On the other hand human vocal singers traditionally harmonise to each other while singing, so their sense of scale changes as the music plays in as much as they don't harmonise to any instruments. I want to explicitly explore changes in scale while playing the piece, and use normal instrument sounds instead of sine/triangle/square waves.

  3. In the xenharmonic world, there are other keyboard layouts that use hexagonal shapes or like the Roli seaboard an added dimension to the traditional keys, or even laser harps. But usually what happens is a scala tuning file is loaded into the synthesizer, and the player uses the traditional black and white keys that map each key to every note in the scale. So if you've got a 19 EDO ( 19 equal division of the octave ) instead of 12, every note in 19 EDO gets mapped onto the keyboard and it is up to the player to select the correct one to play.

So to faciliate this modulation of the scale divisions, my suggestion is first to allow the synth to use frequency data fed into it instead of midi notes. In the end, it would be fun to hear this being performed by pianos, vibraphones, etc.

baconpaul commented 4 years ago

funny I'm just sitting here with my roli now fixing an MPE bug!

Right now you are correct the midi tuning on the microtonal website is not supported. @mkruselj was suggesting in our slack that implementing that in surge could solve your problem though. It is probably the most standards based way and it would work in DAWs. I wonder if that's the best approach?

Basically the entire synth works on a concept of a "note" and a "note" has a "pitch" were the default frequency is 440 * 2^((note-69)/12) but what's stored is the exponent (so in standard tuning the pitch table increases linearly). That table is resettable so the way we support SCL is to set that table to the correct pitch values. This is all in SurgeStorage.cpp

So it's pretty easy to imagine a note coming with a frequency and then resetting the note table or retuning in real time. There's a lot of subtlety in the oscillators but doable. I just did it for SCL tuning. But what context to run in - what's the actual executable - is the hard part.

That's why @mkruselj thought of using the midi tuning standard. I think that could be very interesting and tractable approach.

muziker commented 4 years ago

Hey ok so i've built surge from source again and am looking through the source code. I'm looking for the main entry point into the code. How is everything laid out? I assume the common library is for the usual code and every other compile target code is in their own directory.

muziker commented 4 years ago

And what are you using for gui and look n feel?

baconpaul commented 4 years ago

The code is dll only mostly, since it is plugins. There’s entry points in src/au src/vst2 src/vst3 and src/lv2

There is a standalone which plays the synth dsp engine with no GUI in src/headless. That is GUI free by design

The GUI is all done with vstgui which is a submodule in vstgui.surge and is interfaced to in src/common/gui (mostly). The gui is overcoupled to the dsp engine in a couple of ways now which #1117 aims to fix later this year

If you just want to make noise though the src/headless code shows you how to render a midi stream to a wav file in a standalone exe for instance

muziker commented 4 years ago

https://www.youtube.com/watch?v=Xd54l8gfi7M

Looks like jacob collier has done it to his composition, though the way i thought of this many years ago is to have it work for instruments.

baconpaul commented 4 years ago

yeah that 1/2 sharp stuff he did ... well it's definitely an interesting harmonic approach!

mkruselj commented 4 years ago

So yeah basically #1045 is the way to close this one. In my eyes this issue is essentially a duplicate of #1045.

baconpaul commented 4 years ago

Also the MTS support it seems would let a lot of this happen, were it to emerge.

mkruselj commented 3 years ago

Closing as a duplicate of #1045. Eventually we'll get to implementing MIDI Tuning Standard, and then DAWs which support this (Cubase and Logic, at the very least) will be able to make use of it. Or also DAWs which can just send SysEx, too (like Reaper, say).