As of 0.5.0, event and state sounds are stored within directories of the sound repository. An event or state entry tells Peep to associate the sound files found within the specified directory accordingly, as well as provides some other information that allows Peep to indentify the sound, and in the case of state sounds, how when to play the sound.
An event entry is the simplest of the two and follows a straight-forward format:
event
name <EVENT NAME> # Name to use when referring to the event
path <RELATIVE PATH> # The directory within the repository, relative
# to sound-path in the general section
end event
Such an entry tells peepd to load a new event and indentify it with name. All sounds within the directory specified with path are loaded and associated with the given name. When an event arrives at the server with the event's identifier, one of the sounds is chosen at random and played. This allows for greater variation; multiple samples from the same bird, for instance, can be associated with a single name and the variation allows for a more natural sounding environment.
Thus an example event
event
name login
path wetlands/events/sigh
end event
loads all the sounds within the directory
/wetlands/events/sigh and associates them with the given
name. One of these sounds is then played at random when a login event
arrives at the server.
State sound entries are a little more complicated. As of 0.5.0, state sounds use thresholds to indicate which sounds should be played at what percentage of the measurement. While scaling the volume of state sounds was a good indiciator of increasing activity, it didn't achieve the full effect desired. Now with thresholds, peepd can switch between playing a loud running stream to a pounding rain storm at the desired volume. This makes the effect both more dramatic and more effective.
A state sound entry contains a name identifier, following by as many thresholds as desired. The sum of the thresholds must end at 1.00 (100%). Threshold levels are also cumulative, meaning each entry uses the previous entry as its lower bound, with 0 implied for the first threshold entry.
state
name <STATE NAME> # Name to use when referring to the state
threshold
level <PERCENTAGE B/T 0-1.00> # Upper bound of threshold
path <RELATIVE PATH> # Directory within repository
fade <FLOATING SECONDS> # No secs to perform linear fading
end threshold
threshold
.
.
end state
Each directory containing the state sound can contain multiple sounds segments. peepd mixes those segments into a random, continuous output stream. Linear fading between the sounds eases the transitions between sound segments. This scheme provides a good means of sound compression; several smaller segments can easily be used to produce a random-sounding continuous output stream without eating up too much disk space.
An example state entry is as follows:
state
name general-feel
threshold
level 0.5 # Play for measurments between 0 - 0.5
# of the maximum
path wetlands/states/water-02
fade 0.25
end threshold
threshold
level 1.00 # Play between 0.5-1.00 of maximum
path wetlands/states/water-01 # This sound is more dramatic than the
# first one
fade 0.1
end threshold
end state
The event and state identifier names can then be used in other areas of configuration, such as the individual client configurations. The server resolves these names and plays the appropriate sound dynamically.
The number of state sounds that the server can load are fixed though. These are dependent upon the number of voices that are used. Currently, with 16 voices (the server default), peepd allocates 4 voices for state sounds. This number increases as the number of sounds are increased accordingly.