effects

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bitcrush

type Bitcrush struct {
	Source io.ReadSeeker
	// contains filtered or unexported fields
}

Bitcrush is an effect that changes the pitch of the incoming audio byte stream.

func NewBitcrush

func NewBitcrush(source io.ReadSeeker) *Bitcrush

NewBitcrush creates a new Bitcrush effect. source is the source stream to apply this effect to. If you add this effect to a DSPChannel, there's no need to pass a source, as it will take effect for whatever streams are played through the DSPChannel.

func (*Bitcrush) Active

func (bitcrush *Bitcrush) Active() bool

Active returns if the effect is active.

func (*Bitcrush) ApplyEffect

func (bitcrush *Bitcrush) ApplyEffect(p []byte, bytesRead int)

func (*Bitcrush) Clone

func (bitcrush *Bitcrush) Clone() resound.IEffect

Clone clones the effect, returning an resound.IEffect.

func (*Bitcrush) Read

func (bitcrush *Bitcrush) Read(p []byte) (n int, err error)

func (*Bitcrush) Seek

func (bitcrush *Bitcrush) Seek(offset int64, whence int) (int64, error)

func (*Bitcrush) SetActive

func (bitcrush *Bitcrush) SetActive(active bool) *Bitcrush

SetActive sets the effect to be active.

func (*Bitcrush) SetSource

func (bitcrush *Bitcrush) SetSource(source io.ReadSeeker)

SetSource sets the active source for the effect.

func (*Bitcrush) SetStrength

func (bitcrush *Bitcrush) SetStrength(bitcrushFactor float64) *Bitcrush

SetStrength sets the strength of the Bitcrush effect to the specified percentage.

func (*Bitcrush) Strength

func (bitcrush *Bitcrush) Strength() float64

Strength returns the strength of the Bitcrush effect as a percentage.

type Delay

type Delay struct {
	Source io.ReadSeeker
	// contains filtered or unexported fields
}

Delay is an effect that adds a delay to the sound.

func NewDelay

func NewDelay(source io.ReadSeeker) *Delay

NewDelay creates a new Delay effect. If you add this effect to a DSPChannel, source can be nil, as it will take effect for whatever streams are played through the DSPChannel.

func (*Delay) Active

func (delay *Delay) Active() bool

Active returns if the effect is active.

func (*Delay) ApplyEffect

func (delay *Delay) ApplyEffect(p []byte, bytesRead int)

func (*Delay) Clone

func (delay *Delay) Clone() resound.IEffect

Clone creates a clone of the Delay effect.

func (*Delay) FeedbackLoop

func (delay *Delay) FeedbackLoop() bool

FeedbackLoop returns if the delay's results feed back into itself or not.

func (*Delay) Read

func (delay *Delay) Read(p []byte) (n int, err error)

func (*Delay) Seek

func (delay *Delay) Seek(offset int64, whence int) (int64, error)

func (*Delay) SetActive

func (delay *Delay) SetActive(active bool) *Delay

SetActive sets the effect to be active.

func (*Delay) SetFeedbackLoop

func (delay *Delay) SetFeedbackLoop(on bool) *Delay

SetFeedbackLoop sets the feedback loop of the delay. If set to on, the delay's results feed back into itself.

func (*Delay) SetSource

func (delay *Delay) SetSource(source io.ReadSeeker)

SetSource sets the active source for the effect.

func (*Delay) SetStrength

func (delay *Delay) SetStrength(strength float64) *Delay

SetStrength sets the overall volume of the Delay effect as it's added on top of the original signal. 0 is the minimum value.

func (*Delay) SetWait

func (delay *Delay) SetWait(waitTime float64) *Delay

SetWait sets the overall wait time of the Delay effect in seconds as it's added on top of the original signal. 0 is the minimum value.

func (*Delay) Strength

func (delay *Delay) Strength() float64

Strength returns the strength of the Delay effect.

func (*Delay) Wait

func (delay *Delay) Wait() float64

Wait returns the wait time of the Delay effect.

type Distort

type Distort struct {
	Source io.ReadSeeker
	// contains filtered or unexported fields
}

Distort distorts the stream that plays through it, clipping the signal.

func NewDistort

func NewDistort(source io.ReadSeeker) *Distort

NewDistort creates a new Distort effect. source is the source stream to apply the effect to. If you add this effect to a DSPChannel, you can pass nil as the source, as it will take effect for whatever streams are played through the DSPChannel.

func (*Distort) Active

func (distort *Distort) Active() bool

Active returns if the effect is active.

func (*Distort) ApplyEffect

func (distort *Distort) ApplyEffect(p []byte, bytesRead int)

func (*Distort) Clone

func (distort *Distort) Clone() resound.IEffect

Clone clones the effect, returning an resound.IEffect.

func (*Distort) CrushPercentage

func (distort *Distort) CrushPercentage() float64

CrushPercentage returns the crush percentage of the Distort effect.

func (*Distort) Read

func (distort *Distort) Read(p []byte) (n int, err error)

func (*Distort) Seek

func (distort *Distort) Seek(offset int64, whence int) (int64, error)

func (*Distort) SetActive

func (distort *Distort) SetActive(active bool) *Distort

SetActive sets the effect to be active.

func (*Distort) SetCrushPercentage

func (distort *Distort) SetCrushPercentage(strength float64) *Distort

SetCrushPercentage sets the overall crush percentage of the Distort effect. Any value below this in percentage amplitude is rounded off. 0 is the minimum value.

func (*Distort) SetSource

func (distort *Distort) SetSource(source io.ReadSeeker)

SetSource sets the active source for the effect.

type LowpassFilter

type LowpassFilter struct {
	Source io.ReadSeeker
	// contains filtered or unexported fields
}

func NewLowpassFilter

func NewLowpassFilter(source io.ReadSeeker) *LowpassFilter

NewLowpassFilter creates a new low-pass filter for the given source stream. If you add this effect to a DSPChannel, there's no need to pass a source, as it will take effect for whatever streams are played through the DSPChannel.

func (*LowpassFilter) Active

func (lpf *LowpassFilter) Active() bool

Active returns if the effect is active.

func (*LowpassFilter) ApplyEffect

func (lpf *LowpassFilter) ApplyEffect(p []byte, bytesRead int)

func (*LowpassFilter) Clone

func (lpf *LowpassFilter) Clone() resound.IEffect

Clone clones the effect, returning an resound.IEffect.

func (*LowpassFilter) Read

func (lpf *LowpassFilter) Read(p []byte) (n int, err error)

func (*LowpassFilter) Seek

func (lpf *LowpassFilter) Seek(offset int64, whence int) (int64, error)

func (*LowpassFilter) SetActive

func (lpf *LowpassFilter) SetActive(active bool) *LowpassFilter

SetActive sets the effect to be active.

func (*LowpassFilter) SetSource

func (lpf *LowpassFilter) SetSource(source io.ReadSeeker)

SetSource sets the active source for the effect.

func (*LowpassFilter) SetStrength

func (lpf *LowpassFilter) SetStrength(strength float64) *LowpassFilter

func (*LowpassFilter) Strength

func (lpf *LowpassFilter) Strength() float64

type Pan

type Pan struct {
	Source io.ReadSeeker
	// contains filtered or unexported fields
}

Pan is a panning effect, handling panning the sound between the left and right channels.

func NewPan

func NewPan(source io.ReadSeeker) *Pan

NewPan creates a new Pan effect. source is the source stream to apply the effect on. Panning defaults to 0. If you add this effect to a DSPChannel, source can be nil, as it will take effect for whatever streams are played through the DSPChannel.

func (*Pan) Active

func (pan *Pan) Active() bool

Active returns if the effect is active.

func (*Pan) ApplyEffect

func (pan *Pan) ApplyEffect(p []byte, bytesRead int)

func (*Pan) Clone

func (pan *Pan) Clone() resound.IEffect

Clone clones the effect, returning an resound.IEffect.

func (*Pan) Pan

func (pan *Pan) Pan() float64

Pan returns the panning value for the pan effect in a percentage, ranging from -1 (hard left) to 1 (hard right).

func (*Pan) Read

func (pan *Pan) Read(p []byte) (n int, err error)

func (*Pan) Seek

func (pan *Pan) Seek(offset int64, whence int) (int64, error)

func (*Pan) SetActive

func (pan *Pan) SetActive(active bool) *Pan

SetActive sets the effect to be active.

func (*Pan) SetPan

func (pan *Pan) SetPan(panPercent float64) *Pan

SetPan sets the panning percentage for the pan effect. The possible values range from -1 (hard left) to 1 (hard right).

func (*Pan) SetSource

func (pan *Pan) SetSource(source io.ReadSeeker)

SetSource sets the active source for the effect.

type Volume

type Volume struct {
	Source io.ReadSeeker
	// contains filtered or unexported fields
}

Volume is an effect that changes the overall volume of the incoming audio byte stream.

func NewVolume

func NewVolume(source io.ReadSeeker) *Volume

NewVolume creates a new Volume effect. source is the source stream to apply this effect to. If you add this effect to a DSPChannel, source can be nil, as it will take effect for whatever streams are played through the DSPChannel.

func (*Volume) Active

func (volume *Volume) Active() bool

Active returns if the effect is active.

func (*Volume) ApplyEffect

func (volume *Volume) ApplyEffect(p []byte, bytesRead int)

func (*Volume) Clone

func (volume *Volume) Clone() resound.IEffect

Clone clones the effect, returning an resound.IEffect.

func (*Volume) Read

func (volume *Volume) Read(p []byte) (n int, err error)

func (*Volume) Seek

func (volume *Volume) Seek(offset int64, whence int) (int64, error)

func (*Volume) SetActive

func (volume *Volume) SetActive(active bool)

SetActive sets the effect to be active.

func (*Volume) SetNormalizationFactor

func (volume *Volume) SetNormalizationFactor(normalization float64)

SetNormalizationFactor sets the normalization factor for the Volume effect. This should be obtained from an AudioProperties Analysis.

func (*Volume) SetSource

func (volume *Volume) SetSource(source io.ReadSeeker)

SetSource sets the active source for the effect.

func (*Volume) SetStrength

func (volume *Volume) SetStrength(strength float64) *Volume

SetStrength sets the strength of the Volume effect to the specified percentage. The lowest possible value is 0.0, with 1.0 taking a 100% effect. The volume is altered on a sine-based easing curve. At over 100% volume, the sound is clipped as necessary.

func (*Volume) Strength

func (volume *Volume) Strength() float64

Strength returns the strength of the Volume effect as a percentage.

Jump to

Keyboard shortcuts

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