## General informations

- All the samples should be mono and loopable. That's sure.
- You have 2 layers (Layer0 and Layer1) that correspond (roughly) to open/close throttle (respectively).
- Each layer can have an arbitrary number of samples (.wav files), specified in "Numamples".
- Each sample (within a layer) is named sample0, sample1, ... and contains:
- The .wav filename.
- An arbitrary number of points (NumPoints); I think there should always be at least 3 points.
- each point (point0, point1, ...) has:
- A Value: the value multiplied by the MaxValue (top of the file) gives you the RPMs.
- A Volume (between 0 and 1).
- Values for RefPitch, MinPitch and MaxPitch.

## The samples

The basics: within a layer (e.g. layer0 for throttle ON), you want to "play" one specific sample (e.g. sample0) only over a given range of RPM.

Of course GPB will "modulate" (alter the pitch, in fact) of that sample depending on the RPMs in the range.

This is done this way:

- RefPitch is 0.176471: if you multiply it by MaxValue (17000) you get 3,000 RPM. This is probably the RPMs at which the sample was captured/generated.

- MinPitch is 0.000000: you multiply that by RefPitch and by MaXValue and you get ...well, 0,000 RPM.

- MaxPitch is 1.273335: you multiply that by RefPitch and by MaXValue and you get ...well, 3,820 RPM.

- This means that this specific sample will be used for RPMS between 0 and 3,820. The pitch of the .wav will be varied according to the RPMs.

Now, when RPM gets above 3,820 you want to switch to the next sample. But doing it naively would be terrible.

Here's how it's done:

- sample0 has 3 points: if you multiply the points' Value by MaxValue you get (respectively) 0, 3,020 and 3,820 RPMs. Notice how the first and last point (0 and 3,820) match the RPM values of MinPitch and MaxPitch.

- Each of the 3 points has Volume of (respectively) 1, 1 and 0: this means that between 1st and 2nd point (0 and 3,020 RPM) we'll play the sample at volume 1, while between 3,020 and 3,820 the volume will (linearly, I guess) go down to 0.

- Now look the next sample (sample 1): if you redo the math for RefPitch, MinPitch and MaxPitch you get 4,000, 2,980 and 5,020 RPM.

- If you redo the math for the 4 points of sample1 you get: 2,980, 3,780, 4,420 and 5,220 RPM for vlumes 0, 1, 1, 0 respectively.

- This means that sample0 fades-out between RPMs 3,020 and 3,820 while sample1 fades-in between RPMs 2,980 and 3,780. No idea why there's a slight difference between the two ranges (most likely, it's an oversight).

You can check the rest of Layer0 and, of course, do the same for Layer1.

The final thing is that Layer0 (throttle ON) and Layer1 (throttle OFF) are blended in an undocumented manner by GPB, but maybe we shouldn't care.

You can easily build a small spreadsheet to help understanding and tuning.

Community content is available under CC-BY-SA unless otherwise noted.