surge-synthesizer / surge

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

Open Wavetable standard idea. #7668

Open trynsta opened 1 week ago

trynsta commented 1 week ago

Is your feature request related to a problem? Please describe! I think it might be useful to implement some kind of standardization for WT. I described my idea below.

Describe the solution you'd like:

I’ve got an idea for a portable format which could store wavetables. It should be an open standard with his own git repository with documentation. This standard should be under license which allows using it also in proprietary software (MIT? Creative Commons Zero?).

Pros:

Cons/ issues:

How it could look in JSON:

{
    "global_wavetable_phase": 0,
    "FFTs": {
        "FFT_1": {
            "fft_number": 1,
            "fft_value": 20,
            "fft_phase": 180
            },
        "FFT_2": {
            "fft_number": 4,
            "fft_value": 20,
            "fft_phase": 180
        }
    }
}

Description:

To reduce file space we can use JSON arrays (first value is fft_number, then fft_value and fft_phase):

{
    "Global_phase": 0,
    "FFTs": {
            "FFT_1": [1, 20, 180],
            "FFT_2": [4, 20, 180]
        }
    }
}

That was an example of a single-frame wavetable. This format should be able to store multiple wavetables with various interpolation types between them. This standard should contain at least all interpolation types from the Vital synthesizer. There also should be at least two types of wavetables: FFT based (just like "Wave source" in Vital) and those indicated by points and curves between them (like "Line source" in Vital). Example:

{
    "Wavetables": {
        "Wavetable_1": {
            "Wavetable_type": "FFT",
            "Interpolation_type": "Spectral blend",
            "Interpolation_value": null,
            "Keyframe_x_position": 0,
            "FFTs": {
                    "FFT_1": [1, 20, 180],
                    "FFT_2": [4, 20, 180]
                },
        },
        "Wavetable_2": {
            "Wavetable_type": "FFT",
            "Interpolation_type": "Exponential",
            "Interpolation_value": -0.4,
            "Keyframe_x_position": 0.3,
            "FFTs": {
                    "FFT_1": [1, 20, 180],
                    "FFT_2": [4, 20, 180]
                },
        },
        "Wavetable_3": {
            "Wavetable_type": "Line source",
            "Keyframe_x_position": 1.0,
            "grid_scale": [5, 5],
            "Points": {
                "Point_1": {
                    "point_nr": 1,
                    "position_x": 1,
                    "position_y": 3,
                    "curve_type": "linear",
                    "curve_type_value": null
                },
                "Point_2": {
                    "point_nr": 2,
                    "position_x": 3,
                    "position_y": 5,
                    "curve_type": "linear",
                    "curve_type_value": null
                },
                "Point_3": {
                    "point_nr": 3,
                    "position_x": 3,
                    "position_y": 1,
                    "curve_type": "linear",
                    "curve_type_value": null
                },
                "Point_4": {
                    "point_nr": 4,
                    "position_x": 5,
                    "position_y": 3,
                    "curve_type": null,
                    "curve_type_value": null
                }
            }
        }
    }
}

If the value of "Wavetable_type" is "Line source," then:

vv

Other parameters which might be useful:

I think that even if Surge currently doesn't support all functions mentioned above, this standard should have a wide variety of parameters so that it supports a wide range of software. Also, if Surge gets one of these futures, we don't need to change the specification.

mkruselj commented 1 week ago

I think majority of the wavetable world seems to have taken the Serum method as de-facto standard, more or less. The other end is u-he's UHM format, but this one has some closed source bits (certain interpolation algos etc).

My personal opinion is that this is a lot of work, I'm not sure if we really want to maintain this, it's not really a standard if we don't get anyone else on board (and why would Serum, Vital, u-he etc. do this when they already did the work their own way?). And xkcd 927...

trynsta commented 1 week ago

Yeah I am not sure if other plugins would adopt it but anyways including some type of WT in text format would make WT in Surge more flexible.

baconpaul commented 1 week ago

We had a draft and partly coded lua wavetable generator we never finished - I kinda concluded we would need too much dsp code to make it useful

I think the project you are suggesting - which is a good but ambitious one - is a little dsl to control an engine which renders frames. That as a standalone c++ library could then be included in surge but also in python and others. But it’s a big project!