nickgirardo / gt-sound-sculptor

SFX builder for the GameTank
0 stars 1 forks source link

Instrument Editor #4

Open clydeshaffer opened 3 days ago

clydeshaffer commented 3 days ago

In another tab or view of Sound Sculptor it shouldn't be too hard to set the parameters of an instrument and test it out with either manually triggered notes or a looped melody.

This is what the struct for instruments looks like

#define OPS_PER_CHANNEL 4
typedef struct {
    unsigned char env_initial[OPS_PER_CHANNEL];
    unsigned char env_decay[OPS_PER_CHANNEL];
    unsigned char env_sustain[OPS_PER_CHANNEL];
    signed char op_transpose[OPS_PER_CHANNEL];
    unsigned char feedback;
    signed char transpose;
} Instrument;

The instrument struct defines envelopes for each operator of the instrument. All amplitude values are 8-bits, where the lower four bits represent fractional values, analogous to subpixels. The upper four bits are used as the integer value for amplitude.

clydeshaffer commented 3 days ago

Eventually it would make sense to export a bin that gets imported but I think simply generating the C struct literal to paste into code would also be a reasonable starting point.

Example:

Instrument slapbass = {
  0x58, 0x88, 0x58, 0x5f,
  0x18, 0x08, 0x04, 0x02,
  0x18, 0x08, 0x04, 0x02,
  28, 12, 0, 12,
  0,
  -24
};