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

Phase Distortion oscillator #3273

Open Altarberg opened 3 years ago

Altarberg commented 3 years ago

I was wondering if it would be possible to add a Phase Distortion Osc, like the Casio CZ line. I think that PD combined with the filters and modulation capabilities of Surge would be great.

baconpaul commented 3 years ago

I agree

magnetophon commented 3 years ago

That would be great! Maybe some inspiration can be found here: https://github.com/magnetophon/DigiDrie

baconpaul commented 3 years ago

oh yeah very interesting @magnetophon - which code has the model of the oscillator? my faust navigation is a little so-so but i would gladly use your model as a starting point!

magnetophon commented 3 years ago

Great, I was hoping you'd say that!

If you want, I can cook up a little oscillator-only dsp.

baconpaul commented 3 years ago

That would be profoundly useful yeah

You are AGPL3 and we are GPL3. I would consult your code and rewrite as GPL3 in C++. Presume that's not a problem for you but if the A matters, lemme know. I don't think we can AGPL3 and still support all our use cases for surge.

magnetophon commented 3 years ago

I'd be more than happy to make the oscillator GPL3.

Altarberg commented 3 years ago

I'm glad this has some interest! I'm just a musician and know nothing about programing, but i do have a CZ-5000 in superb shape. Just let me know if it could be useful!

baconpaul commented 3 years ago

I'd be more than happy to make the oscillator GPL3.

Fantastic!

And @Altarberg yeah we are about to release 1.8 (which is "all about MSEG, Filters, and Airwindows") but our 1.9 plan has a bunch of oscillator work imagined. We will definitely need testers and feedback as we go.

magnetophon commented 3 years ago

I'd be more than happy to make the oscillator GPL3.

On closer inspection, looks like I already did :)

This issue reminded me to do a long overdue PR to add anti-aliasing.

Those are only the bare oscillators though;

In DigiDrie, I also added some features to make them more versatile:

I made a repo that has these features, taken from DigiDrie, under GPL3. https://github.com/magnetophon/faustOscillators Let me know if you have any questions.

In the example, you can choose between a few filter types. In Surge, I imagine all filters to be available in the dropdown.

The parameters should all fit in the current Surge GUI, when you remove the OSC switch and replace it by a fader.

There's two oscillator-specific features of DigiDrie that I omitted because there isn't enough room in the GUI for them (yet):

It would be great to have those features in Surge as well, I'll open separate issues for them.

Finally: by default, faust runs all code all the time. It also has an undocumented feature to turn code off, but it doesn't work in all architectures. I use it to switch oscillator types, but commented it out to make sure the repo works everywhere. You can enable it by toggling the commenting of these lines.

baconpaul commented 3 years ago

Thank you very much. We are wrapping up 18 now but I will look at this when we start 19 (if not earlier).

On your extra features: The first I would do through the surge FM module, which we want to expand greatly in S19 (basically we want to go to 6 oscillators and a matrix). Then code PD to respond to external FM.

On the second - that's really hard but we are thinking some about expanded stereo panning, just not necessarily distinct stereo modulation.

mkruselj commented 3 years ago

We don't necessarily need to implement all the parameters from the Faust implementation one to one, but just having a PD oscillator with its base parameter set would already be quite alright and great to have in Surge.

baconpaul commented 3 years ago

yeah the faust code is super duper useful though. And @magnetophon has been thoughtful about the params. It is a very helpful document for when we turn to this.

magnetophon commented 3 years ago

6 oscillators and a matrix

So FM with 6 of any Surge osc? Perfect! :)

When you get around to it, I'd love to hear your thoughts on the sound of these things. Here's a little teaser: digiDrie.mp3. That's just the oscillators with some tasty modulation, no effects whatsoever. If you listen with headphones you'll hear the stereo-offset feature in full swing. The filter is also fairly evident in this clip.

baconpaul commented 3 years ago

So FM with 6 of any Surge osc? Perfect! :)

That is the plan. Quite a lot of work to get there. But i think it could be very powerful.