Documentation
¶
Index ¶
- Variables
- func BitCrush(buf *audio.FloatBuffer, factor float64)
- func FullWaveRectifier(buf *audio.FloatBuffer) error
- func Gain(buf *audio.FloatBuffer, multiplier float64) error
- func MonoDownmix(buf *audio.FloatBuffer) error
- func MonoRMS(b *audio.FloatBuffer, windowSize int) error
- func MonoToStereoF32(buf *audio.Float32Buffer) error
- func NormalizeMax(buf *audio.FloatBuffer)
- func PCMScale(buf *audio.FloatBuffer, bitDepth int) error
- func PCMScaleF32(buf *audio.Float32Buffer, bitDepth int) error
- func Quantize(buf *audio.FloatBuffer, bitDepth int)
- func StereoPan(buf *audio.FloatBuffer, pan float64) error
Constants ¶
This section is empty.
Variables ¶
var ( CrusherMinFactor = 1.0 CrusherMaxFactor = 2097152.0 )
Functions ¶
func BitCrush ¶
func BitCrush(buf *audio.FloatBuffer, factor float64)
BitCrush reduces the resolution of the sample to the target bit depth Note that bit crusher effects are usually made of this feature + a decimator
func FullWaveRectifier ¶
func FullWaveRectifier(buf *audio.FloatBuffer) error
FullWaveRectifier to make all signal positive See https://en.wikipedia.org/wiki/Rectifier#Full-wave_rectification
func Gain ¶
func Gain(buf *audio.FloatBuffer, multiplier float64) error
Gain applies the multiplier to the passed buffer. A multipler of 1 would increase the amplitude of the signal by 100% while a multiplier of 0 would not do anything. Note that this is a very very naive implementation and we will more than add a more useful DB gain transform.
func MonoDownmix ¶
func MonoDownmix(buf *audio.FloatBuffer) error
MonoDownmix converts the buffer to a mono buffer by downmixing the channels together.
func MonoRMS ¶
func MonoRMS(b *audio.FloatBuffer, windowSize int) error
MonoRMS converts the buffer to mono and apply an RMS treatment. rms = sqrt ( (1/n) * (x12 + x22 + … + xn2) ) multiplying by 1/n effectively assigns equal weights to all the terms, making it a rectangular window. Other window equations can be used instead which would favor terms in the middle of the window. This results in even greater accuracy of the RMS value since brand new samples (or old ones at the end of the window) have less influence over the signal’s power.) TODO: use a sine wave at amplitude of 1: rectication + average = 1.4 (1/square root of 2)
func MonoToStereoF32 ¶
func MonoToStereoF32(buf *audio.Float32Buffer) error
MonoToStereoF32 converts a mono stream into a stereo one by copying the mono signal to both channels in an interleaved signal.
func NormalizeMax ¶
func NormalizeMax(buf *audio.FloatBuffer)
NormalizeMax sets the max value to 1 and normalize the rest of the data.
func PCMScale ¶
func PCMScale(buf *audio.FloatBuffer, bitDepth int) error
PCMScale converts a buffer with audio content from -1 to 1 into the PCM scale based on the passed bitdepth. Note that while the PCM data is scaled, the PCM format is not changed.
func PCMScaleF32 ¶
func PCMScaleF32(buf *audio.Float32Buffer, bitDepth int) error
PCMScaleF32 converts a buffer with audio content from -1 to 1 (float32) into the PCM scale based on the passed bitdepth. Note that while the PCM data is scaled, the PCM format is not changed.
func Quantize ¶
func Quantize(buf *audio.FloatBuffer, bitDepth int)
Quantize quantizes the audio signal to match the target bitDepth
func StereoPan ¶
func StereoPan(buf *audio.FloatBuffer, pan float64) error
StereoPan changes the balance of the input buffer by "panning" more to the left or the right. The pan value must be between 0 and 1 where 0 is full first channel, 0.5 center and 1 full second channel. Note that the signal from 1 channel is not sent to the other, this transform only reduces the balance of one of the 2 channels.
Types ¶
This section is empty.
Source Files
¶
- bit_crush.go
- gain.go
- mono.go
- normalize.go
- pcm_scale.go
- quantize.go
- stereo.go
- stereo_pan.go
- transforms.go