Package effects provides additional audio effects for the Beep library.
- func Doppler(quality int, samplesPerMeter float64, s beep.Streamer, ...) beep.Streamer
- func Mono(s beep.Streamer) beep.Streamer
- func Swap(s beep.Streamer) beep.Streamer
- type Gain
- type Pan
- type Volume
This section is empty.
This section is empty.
Doppler simulates a "sound at a distance". If the sound starts at a far distance, it'll take some time to reach the ears of the listener.
The distance of the sound can change dynamically. Doppler adjusts the density of the sound (affecting its speed) to remain consistent with the distance. This is called the Doppler effect.
The arguments are:
quality: the quality of the underlying resampler (1 or 2 is usually okay) samplesPerMeter: sample rate / speed of sound s: the source streamer distance: a function to calculate the current distance; takes number of samples Doppler wants to stream at the moment
This function is experimental and may change any time!
Mono converts the wrapped Streamer to a mono buffer by downmixing the left and right channels together.
The returned Streamer propagates s's errors through Err.
Gain amplifies the wrapped Streamer. The output of the wrapped Streamer gets multiplied by 1+Gain.
Note that gain is not equivalent to the human perception of volume. Human perception of volume is roughly exponential, while gain only amplifies linearly.
Pan balances the wrapped Streamer between the left and the right channel. The Pan field value of -1 means that both original channels go through the left channel. The value of +1 means the same for the right channel. The value of 0 changes nothing.
Volume adjusts the volume of the wrapped Streamer in a human-natural way. Human's perception of volume is roughly logarithmic to gain and thus the natural way to adjust volume is exponential.
Natural Base for the exponentiation is somewhere around 2. In order to adjust volume along decibells, pick 10 as the Base and set Volume to dB/10. However, adjusting volume along decibells is nowhere as natural as with bases around 2.
Volume of 0 means no change. Negative Volume will decrease the perceived volume and positive will increase it.
With exponential gain it's impossible to achieve the zero volume. When Silent field is set to true, the output is muted.