Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VGI to preset.c (js) #38

Open
KPY7030P opened this issue Jun 28, 2024 · 8 comments
Open

VGI to preset.c (js) #38

KPY7030P opened this issue Jun 28, 2024 · 8 comments

Comments

@KPY7030P
Copy link

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

@KPY7030P
Copy link
Author

KPY7030P commented Jun 29, 2024

{{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.

@rhargreaves
Copy link
Owner

rhargreaves commented Jul 1, 2024

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.

@KPY7030P
Copy link
Author

KPY7030P commented Aug 3, 2024

image
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 :)

@KPY7030P
Copy link
Author

KPY7030P commented Aug 3, 2024

image
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

@rhargreaves
Copy link
Owner

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.

@rhargreaves
Copy link
Owner

rhargreaves commented Aug 3, 2024

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.

@vitaflo
Copy link

vitaflo commented Dec 14, 2024

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.

It is. Anyone who has worked with a Twisted Electron's MegaFM or Sonicware's Liven Mega Synthesis (like myself) is used to those terms on those devices. For myself, I'd love for them to be consistent across all those devices so I can easily move between them.

For the record, here's some of the terminology of the operators of those devices:

Total Level (TL)
Multiplier (MUL)
Detune (DT)
Attack Rate (AR)
Decay Rate (DR)
Sustain Level (SL)
Sustain Rate (SR)
Release Rate (RR)

BTW, I just found out about your project today and it was very easy to get up and running (using genMDM editor). Was super pumped to get sounds coming out of my actual Genesis via midi. Keep up the good work man it's awesome.

@vitaflo
Copy link

vitaflo commented Dec 14, 2024

Doh, I see you already updated these in these labels in the repo. I was looking at the last release (1.23). Sorry for the confusion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants