Open KPY7030P opened 4 months ago
{{4, 7, 1, 0, 0, 1, 0, {{ 15, 0, 22, 0, 8, 1, 9, 31, 15, 0, 0 }, {...}, {...}, {...}}, 36 }; {{algo, Fb, Pan, AMS, FMS, LFO, Ch3 {{ TL, AR, MUL, DT, RS, AM, D1R, D2R, SL, RR, SSG}, {...}, {...}, {...}}, DrumRootNote};
I think my code is not working correctly. Please help me figure out the structure of the presets from the "presets.c" file. I also noticed that the FMS and AMS in the description of the preset of the tool and in the interface are reversed, but I may be mistaken. please correct me if this is the case.
The structure of the instrumental preset is defined by the FmChannel
struct, in synth.h:
struct FmChannel {
u8 algorithm;
u8 feedback;
u8 stereo;
u8 ams;
u8 fms;
u8 octave; // ignored - can be just set to 0
u16 freqNumber; // ignored - can be just set to 0
Operator operators[MAX_FM_OPERATORS]; // MAX_FM_OPERATORS = 4
};
struct Operator {
u8 multiple;
u8 detune;
u8 attackRate;
u8 rateScaling;
u8 firstDecayRate;
u8 amplitudeModulation;
u8 secondaryAmplitude;
u8 secondaryDecayRate;
u8 releaseRate;
u8 totalLevel;
u8 ssgEg;
};
Percussive presets are defined by the PercussionPreset
struct in midi_fm.h:
struct PercussionPreset {
FmChannel channel;
u8 key;
};
They are essentially the same, but have an additional key
field, which tells the interface which frequency (defined as a MIDI pitch) the percussion sound should be played at.
I noticed that the order of the preset parameters (what is described above) and the order of the parameters in the WIKI do not match, I suggest fixing the WIKI? if it doesn't take a lot of time and effort :)
Among other things, the order of parameters is different in the interface. If possible, I suggest unifying the parameter order based on the VGI file specification. Multiplier Detune Total Level Rate Scaling Attack Rate Decay Rate & AMenable Sustain Rate Release Rate Sustain Level SSG-EG https://vgmrips.net/wiki/VGI_File_Format
Yes you're right there's probably too much variation there. I'll have a think about what to do with the UI and Wiki. I can't do much about the order of fields in the struct
as that would be a breaking change for anything which generates those files.
For now, I've fleshed out the FM Presets page of the Wiki to better explain how to define presets.
I'm also considering replacing the terminology of "Second Decay Rate (D2R)" and "Secondary Amplitude (D1L/SL)" to "Sustain Rate (SR)" and "Sustain Level (SL)" accordingly. I think that's the more popular terminology these days.
I want to give you a code (JS) that will convert a folder with VGI files into a preset file. this is my contribution to the community. generate_presets_v2.zip