Documentation ¶
Index ¶
- Variables
- func Atan2LUT(y, x int) int
- func BlackmanWindow(output []float64)
- func BlackmanWindowF32(output []float32)
- func C64toi8(input []complex64, output []int8)
- func Conj32(x complex64) complex64
- func F32Tof32ble(input []float32, output []byte)
- func F32toi16(input []float32, output []int16, scale float32)
- func F32toi16ble(input []float32, output []byte, scale float32)
- func FastAtan2(y, x float32) float32
- func FastAtan2Fixed(y, x int) int
- func FastAtan2_2(y, x float32) float32
- func FastPhase32(x complex64) float32
- func HammingWindow(output []float64)
- func HammingWindowF32(output []float32)
- func HanningWindow(output []float64)
- func HanningWindowF32(output []float32)
- func Hermite4p3o(samples []float64, x float64) float64
- func Hermite4p3oF32(samples []float32, x float32) float32
- func I16ToBLE(input []int16, output []byte)
- func I16bleToF32(input []byte, output []float32, scale float32)
- func I16bleToF64(input []byte, output []float64, scale float64)
- func I32bleToF32(input []byte, output []float32, scale float32)
- func I8toc64(input []int8, output []complex64)
- func I8tof32(input []byte, output []float32)
- func Linear(samples []float64, x float64) float64
- func LinearF32(samples []float32, x float32) float32
- func NuttallWindow(output []float64)
- func NuttallWindowF32(output []float32)
- func Optimal2x4p4o(samples []float64, x float64) float64
- func Optimal2x4p4oF32(samples []float32, x float32) float32
- func Optimal2x6p5o(samples []float64, x float64) float64
- func Optimal2x6p5oF32(samples []float32, x float32) float32
- func Phase32(x complex64) float32
- func PolarDiscriminator(a, b complex128) float64
- func PolarDiscriminator32(a, b complex64) float32
- func TriangleWindow(output []float64)
- func TriangleWindowF32(output []float32)
- func Ui8toc64(input []byte, output []complex64)
- func Ui8tof32(input []byte, output []float32)
- func Ui8toi16(input []byte, output []int16)
- func Ui8toi16b(input, output []byte)
- func VAbsC64(input []complex64, output []float32)
- func VAddC64(input, output []complex64)
- func VAddF32(input, output []float32)
- func VMaxF32(input []float32) float32
- func VMinF32(input []float32) float32
- func VMulC64(input, output, mul []complex64)
- func VMulC64xF32(input, output []complex64, mul []float32)
- func VScaleC64(input, output []complex64, scale float32)
- func VScaleF32(input, output []float32, scale float32)
- type BiQuadFilter
- func AllPassBiQuadFilter(sampleRate, centreFrequency, q float64) *BiQuadFilter
- func HighShelfBiQuadFilter(sampleRate, cutoffFrequency, shelfSlope, dbGain float64) *BiQuadFilter
- func LowShelfBiQuadFilter(sampleRate, cutoffFrequency, shelfSlope, dbGain float64) *BiQuadFilter
- func NewBandPassConstantPeakGainBiQuadFilter(sampleRate, centreFrequency, q float64) *BiQuadFilter
- func NewBandPassConstantSkirtGainBiQuadFilter(sampleRate, centreFrequency, q float64) *BiQuadFilter
- func NewHighPassBiQuadFilter(sampleRate, cutoffFreq, q float64) *BiQuadFilter
- func NewLowPassBiQuadFilter(sampleRate, cutoffFreq, q float64) *BiQuadFilter
- func NotchBiQuadFilter(sampleRate, centreFrequency, q float64) *BiQuadFilter
- func PeakingEQBiQuadFilter(sampleRate, centreFrequency, q, dbGain float64) *BiQuadFilter
- type ComplexFilter
- type ComplexGoertzel
- type ComplexIIRFilter
- type ComplexIIRFilter32
- type ComplexSource
- type DCFilter
- type DCFilter32
- type Demodulator
- type FMDemodFilter
- type Goertzel
- type Goertzel32
- type I32Rotate90Filter
- type IIRFilter
- type LowPassDownsampleComplexFilter
- type LowPassDownsampleRationalFilter
- type RealSink
- type Rotate90Filter
- type SDFT
- type SDFT32
Constants ¶
This section is empty.
Variables ¶
var ( BlackmanFreqCoeff = []float64{0.16 / 4, -1.0 / 4, (1 - 0.16) / 2, -1.0 / 4, 0.16 / 4} HammingFreqCoeff = []float64{(0.53836 - 1) / 2, 0.53836, (0.53836 - 1) / 2} HanningFreqCoeff = []float64{-0.25, 0.5, -0.25} BlackmanFreqCoeff32 = []float32{0.16 / 4, -1.0 / 4, (1 - 0.16) / 2, -1.0 / 4, 0.16 / 4} HammingFreqCoeff32 = []float32{(0.53836 - 1) / 2, 0.53836, (0.53836 - 1) / 2} HanningFreqCoeff32 = []float32{-0.25, 0.5, -0.25} )
Functions ¶
func BlackmanWindow ¶
func BlackmanWindow(output []float64)
func BlackmanWindowF32 ¶
func BlackmanWindowF32(output []float32)
func C64toi8 ¶
C64toi8 converts 64-bit complex samples to signed 8-bit interleaved. It does not scale the samples.
func F32Tof32ble ¶
F32Tof32ble converts a float32 slice to a byte slice of little endian float32.
func F32toi16ble ¶
F32toi16ble converts float32 to int16 stored in a byte slice. The values are stored in little-endian.
func FastAtan2Fixed ¶
func FastPhase32 ¶
func HammingWindow ¶
func HammingWindow(output []float64)
func HammingWindowF32 ¶
func HammingWindowF32(output []float32)
func HanningWindow ¶
func HanningWindow(output []float64)
func HanningWindowF32 ¶
func HanningWindowF32(output []float32)
func Hermite4p3o ¶
Hermite4p3o interpolates using 4-point, 3rd-order Hermite (x-form)
func Hermite4p3oF32 ¶
Hermite4p3oF32 interpolates using 4-point, 3rd-order Hermite (x-form)
func I16bleToF32 ¶
I16bleToF32 converts int16 stored in a byte slice as little endian to float32.
func I16bleToF64 ¶
I16bleToF64 converts int16 stored in a byte slice as little endian to float64.
func I32bleToF32 ¶
I32bleToF32 converts int32 stored in a byte slice as little endian to float32.
func I8toc64 ¶
I8toc64 converts signed 8-bit interleaved complex samples to 64-bit complex (32-bit real and imaginary parts). It does not scale the samples.
func I8tof32 ¶
I8tof32 converts signed 8-bit samples to 32-bit float. It does not scale the samples.
func NuttallWindow ¶
func NuttallWindow(output []float64)
func NuttallWindowF32 ¶
func NuttallWindowF32(output []float32)
func Optimal2x4p4o ¶
Optimal2x4p4o interpolates using optimal 2x (4-point, 4th-order) (z-form)
func Optimal2x4p4oF32 ¶
Optimal2x4p4oF32 interpolates using optimal 2x (4-point, 4th-order) (z-form)
func Optimal2x6p5o ¶
Optimal2x6p5o interpolates using optimal 2x (6-point, 5th-order) (z-form)
func Optimal2x6p5oF32 ¶
Optimal2x6p5oF32 interpolates using optimal 2x (6-point, 5th-order) (z-form)
func PolarDiscriminator ¶
func PolarDiscriminator(a, b complex128) float64
PolarDiscriminator returns the phase angle between two complex vectors equivalent to arg(a * conj(b)). The returned angle is in the range [-Pi, Pi].
func PolarDiscriminator32 ¶
PolarDiscriminator32 returns the phase angle between two complex vectors equivalent to arg(a * conj(b)). The returned angle is in the range [-Pi, Pi].
func TriangleWindow ¶
func TriangleWindow(output []float64)
func TriangleWindowF32 ¶
func TriangleWindowF32(output []float32)
func Ui8toc64 ¶
Ui8toc64 converts unsigned 8-bit interleaved complex samples to 64-bit complex (32-bit real and imaginary parts). It does not scale the samples.
func Ui8tof32 ¶
Ui8tof32 converts unsigned 8-bit samples to 32-bit float. It does not scale the samples.
func Ui8toi16b ¶
func Ui8toi16b(input, output []byte)
Ui8toi16b converts and scales unsigned 8-bit samples to 16-bit signed samples.
func VMulC64 ¶
func VMulC64(input, output, mul []complex64)
VMulC64 multiplies eache value of the input by the matching value in the multiplier.
output[i] = input[i] * mul[i]
func VMulC64xF32 ¶
VMulC64xF32 multiplies a vector of complex values with a vector with real values. This is useful for applying a window to complex samples.
output[i] = complex(real(input[i])*mul[i], imag(input[i])*mul[i])
Types ¶
type BiQuadFilter ¶
type BiQuadFilter struct {
B0, B1, B2 float64
A0, A1, A2 float64
// contains filtered or unexported fields
}
func AllPassBiQuadFilter ¶
func AllPassBiQuadFilter(sampleRate, centreFrequency, q float64) *BiQuadFilter
H(s) = (s^2 - s/Q + 1) / (s^2 + s/Q + 1)
func HighShelfBiQuadFilter ¶
func HighShelfBiQuadFilter(sampleRate, cutoffFrequency, shelfSlope, dbGain float64) *BiQuadFilter
H(s) = A * (A*s^2 + (sqrt(A)/Q)*s + 1)/(s^2 + (sqrt(A)/Q)*s + A)
func LowShelfBiQuadFilter ¶
func LowShelfBiQuadFilter(sampleRate, cutoffFrequency, shelfSlope, dbGain float64) *BiQuadFilter
H(s) = A * (s^2 + (sqrt(A)/Q)*s + A)/(A*s^2 + (sqrt(A)/Q)*s + 1) shelfSlope: a "shelf slope" parameter (for shelving EQ only). When S = 1, the shelf slope is as steep as it can be and remain monotonically increasing or decreasing gain with frequency. The shelf slope, in dB/octave, remains proportional to S for all other values for a fixed f0/Fs and dBgain.</param> dbGain: Gain in decibels
func NewBandPassConstantPeakGainBiQuadFilter ¶
func NewBandPassConstantPeakGainBiQuadFilter(sampleRate, centreFrequency, q float64) *BiQuadFilter
H(s) = (s/Q) / (s^2 + s/Q + 1) (constant 0 dB peak gain)
func NewBandPassConstantSkirtGainBiQuadFilter ¶
func NewBandPassConstantSkirtGainBiQuadFilter(sampleRate, centreFrequency, q float64) *BiQuadFilter
H(s) = s / (s^2 + s/Q + 1) (constant skirt gain, peak gain = Q)
func NewHighPassBiQuadFilter ¶
func NewHighPassBiQuadFilter(sampleRate, cutoffFreq, q float64) *BiQuadFilter
H(s) = s^2 / (s^2 + s/Q + 1)
func NewLowPassBiQuadFilter ¶
func NewLowPassBiQuadFilter(sampleRate, cutoffFreq, q float64) *BiQuadFilter
H(s) = 1 / (s^2 + s/Q + 1)
func NotchBiQuadFilter ¶
func NotchBiQuadFilter(sampleRate, centreFrequency, q float64) *BiQuadFilter
H(s) = (s^2 + 1) / (s^2 + s/Q + 1)
func PeakingEQBiQuadFilter ¶
func PeakingEQBiQuadFilter(sampleRate, centreFrequency, q, dbGain float64) *BiQuadFilter
H(s) = (s^2 + s*(A/Q) + 1) / (s^2 + s/(A*Q) + 1)
func (*BiQuadFilter) Filter ¶
func (f *BiQuadFilter) Filter(input, output []float64)
func (*BiQuadFilter) FilterF32 ¶
func (f *BiQuadFilter) FilterF32(input, output []float32)
type ComplexFilter ¶
type ComplexGoertzel ¶
type ComplexGoertzel struct {
// contains filtered or unexported fields
}
func NewComplexGoertzel ¶
func NewComplexGoertzel(targetFreqs []uint64, sampleRate, blockSize int) *ComplexGoertzel
func (*ComplexGoertzel) Complex ¶
func (g *ComplexGoertzel) Complex() []complex128
func (*ComplexGoertzel) Feed ¶
func (g *ComplexGoertzel) Feed(samples []complex128)
func (*ComplexGoertzel) Magnitude ¶
func (g *ComplexGoertzel) Magnitude() []float64
func (*ComplexGoertzel) Reset ¶
func (g *ComplexGoertzel) Reset()
type ComplexIIRFilter ¶
type ComplexIIRFilter struct {
// contains filtered or unexported fields
}
func NewComplexIIRFilter ¶
func NewComplexIIRFilter(bCoef, aCoef []float64) *ComplexIIRFilter
func (*ComplexIIRFilter) Filter ¶
func (f *ComplexIIRFilter) Filter(input, output []complex128)
type ComplexIIRFilter32 ¶
type ComplexIIRFilter32 struct {
// contains filtered or unexported fields
}
func NewComplexIIRFilter32 ¶
func NewComplexIIRFilter32(bCoef, aCoef []float32) *ComplexIIRFilter32
func (*ComplexIIRFilter32) Filter ¶
func (f *ComplexIIRFilter32) Filter(input, output []complex64)
type ComplexSource ¶
type DCFilter ¶
type DCFilter struct {
// contains filtered or unexported fields
}
func NewDCFilter ¶
type DCFilter32 ¶
type DCFilter32 struct {
// contains filtered or unexported fields
}
func NewDCFilter32 ¶
func NewDCFilter32(a float32) *DCFilter32
func (*DCFilter32) Filter ¶
func (f *DCFilter32) Filter(input, output []float32)
func (*DCFilter32) FilterOne ¶
func (f *DCFilter32) FilterOne(x float32) float32
type Demodulator ¶
type FMDemodFilter ¶
type FMDemodFilter struct {
// contains filtered or unexported fields
}
FMDemodFilter is an FM demodulator filter using a polar disciminator.
x(n)─────▶○───────────────────▶(X)──────────────────▶arctan──▶ │ ▲ y(n)=x(n)x*(n-1) │ ┌───┐ ┌───┐ │ └──▶│z⁻¹├────▶│z^*├───┘ └───┘ └───┘
func (*FMDemodFilter) Demodulate ¶
func (fi *FMDemodFilter) Demodulate(input []complex64, output []float32) int
type Goertzel ¶
type Goertzel struct {
// contains filtered or unexported fields
}
func NewGoertzel ¶
func (*Goertzel) Complex ¶
func (g *Goertzel) Complex() []complex128
type Goertzel32 ¶
type Goertzel32 struct {
// contains filtered or unexported fields
}
func NewGoertzel32 ¶
func NewGoertzel32(targetFreqs []uint64, sampleRate, blockSize int) *Goertzel32
func (*Goertzel32) Complex ¶
func (g *Goertzel32) Complex() []complex64
func (*Goertzel32) Feed ¶
func (g *Goertzel32) Feed(samples []float32)
func (*Goertzel32) Magnitude ¶
func (g *Goertzel32) Magnitude() []float32
func (*Goertzel32) Reset ¶
func (g *Goertzel32) Reset()
type I32Rotate90Filter ¶
type I32Rotate90Filter struct { }
func (*I32Rotate90Filter) Filter ¶
func (fi *I32Rotate90Filter) Filter(samples []int32) []int32
type IIRFilter ¶
type IIRFilter struct {
// contains filtered or unexported fields
}
func NewIIRFilter ¶
type LowPassDownsampleComplexFilter ¶
type LowPassDownsampleComplexFilter struct { Downsample int // contains filtered or unexported fields }
func (*LowPassDownsampleComplexFilter) Filter ¶
func (fi *LowPassDownsampleComplexFilter) Filter(samples []complex64) []complex64
type LowPassDownsampleRationalFilter ¶
type LowPassDownsampleRationalFilter struct {
Fast, Slow int
// contains filtered or unexported fields
}
func (*LowPassDownsampleRationalFilter) Filter ¶
func (fi *LowPassDownsampleRationalFilter) Filter(samples []float32) []float32
type Rotate90Filter ¶
type Rotate90Filter struct { }
func (*Rotate90Filter) Filter ¶
func (fi *Rotate90Filter) Filter(samples []complex64) []complex64
type SDFT ¶
type SDFT struct {
// contains filtered or unexported fields
}
SDFT is a sliding DFT.
func (*SDFT) Filter ¶
func (sd *SDFT) Filter(x complex128) complex128