effects

package
v0.0.0-...-4ec0906 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2018 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Doppler

func Doppler(quality int, samplesPerMeter float64, s beep.Streamer, distance func(delta int) float64) beep.Streamer

Types

type Gain

type Gain struct {
	Streamer beep.Streamer
	Gain     float64
}

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.

func (*Gain) Err

func (g *Gain) Err() error

Err propagates the wrapped Streamer's errors.

func (*Gain) Stream

func (g *Gain) Stream(samples [][2]float64) (n int, ok bool)

Stream streams the wrapped Streamer amplified by Gain.

type Pan

type Pan struct {
	Streamer beep.Streamer
	Pan      float64
}

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.

func (*Pan) Err

func (p *Pan) Err() error

Err propagates the wrapped Streamer's errors.

func (*Pan) Stream

func (p *Pan) Stream(samples [][2]float64) (n int, ok bool)

Stream streams the wrapped Streamer balanced by Pan.

type Volume

type Volume struct {
	Streamer beep.Streamer
	Base     float64
	Volume   float64
	Silent   bool
}

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.

func (*Volume) Err

func (v *Volume) Err() error

Err propagates the wrapped Streamer's errors.

func (*Volume) Stream

func (v *Volume) Stream(samples [][2]float64) (n int, ok bool)

Stream streams the wrapped Streamer with volume adjusted according to Base, Volume and Silent fields.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL