Class RainSoundscape
- Namespace
- DFA.Puddlecraft
Procedural rain: ten frequency bands, from deep rumble to bright hiss, each a pair of stems that crossfade into an endless loop. How loud each band is comes from preset curves (light, medium, heavy, covered) blended by the rain intensity and by whether the listener is under cover. A band's gain is its level cubed.
[Serializable]
public sealed class RainSoundscape
- Inheritance
-
RainSoundscape
Fields
BandCount
Number of frequency bands.
public const int BandCount = 10
Field Value
Properties
bands
The ten bands, from deepest (0) to brightest (9). Always BandCount long; assign stems to its elements.
public RainStem[] bands { get; }
Property Value
- RainStem[]
covered
Band levels heard from under cover in a downpour. Across: band, deepest (0) to brightest (1). Up: level, 0 to 1.
public AnimationCurve covered { get; set; }
Property Value
heavy
Band levels in a downpour. Across: band, deepest (0) to brightest (1). Up: level, 0 to 1.
public AnimationCurve heavy { get; set; }
Property Value
light
Band levels in light rain. Across: band, deepest (0) to brightest (1). Up: level, 0 to 1.
public AnimationCurve light { get; set; }
Property Value
medium
Band levels in medium rain. Across: band, deepest (0) to brightest (1). Up: level, 0 to 1.
public AnimationCurve medium { get; set; }
Property Value
Methods
Gain(float)
Gain for a band level: the level cubed, so the curves read like a mixing desk.
public static float Gain(float level)
Parameters
levelfloat
Returns
Level(int, float, float)
The level (0 to 1) of a band for a rain intensity, and for how exposed the listener is (1 out in the rain, 0 under cover). Silent when it isn't raining.
public float Level(int band, float intensity, float exposure)
Parameters
Returns
Preset(params float[])
A preset curve through the given band levels, deepest first.
public static AnimationCurve Preset(params float[] levels)
Parameters
levelsfloat[]
Returns
PresetWeights(float, out float, out float, out float)
How much of the light, medium and heavy presets a rain intensity uses. They add up to 1.
public static void PresetWeights(float intensity, out float light, out float medium, out float heavy)