Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // BroadcastDeviation is the max deviation for FM Broadcast // which is 75 KHz (150 KHz bandwidth). BroadcastDeviation rf.Hz = rf.KHz * 75 // NarrowbandDeviation is the max deviation for FM narrowband radio, like // Ham radios, 2.5 KHz (5 KHz bandwidth) NarrowbandDeviation rf.Hz = rf.KHz * 2.5 )
Functions ¶
Types ¶
type Demodulator ¶
type Demodulator struct {
// contains filtered or unexported fields
}
Demodulator contains info about
func Demodulate ¶
func Demodulate(reader sdr.Reader, cfg DemodulatorConfig) (*Demodulator, error)
Demodulate will create a new Demodulator, to read FM audio from an IQ stream.
func (Demodulator) Read ¶
func (d Demodulator) Read(audio []float32) (int, error)
Read will (partially?) fill the buffer with audio samples.
func (Demodulator) Reader ¶
func (d Demodulator) Reader() sdr.Reader
Reader will return the underlying reader (TODO: Remove this)
func (Demodulator) SampleRate ¶
func (d Demodulator) SampleRate() uint
SampleRate will return the *audio* sample rate.
type DemodulatorConfig ¶
type DemodulatorConfig struct { // Center frequency of the signal in the IQ data. CenterFrequency rf.Hz // Deviation is the maximum difference between modulated and carrier // frequencies. This is half of the total bandwidth. Deviation rf.Hz // Downsample will define rate to downsample the samples to bring it to // a sensible audio sample rate. Downsample uint // Planner will be used to preform the FFTs used to filter the FM signal. Planner fft.Planner }
DemodulatorConfig will define how the demodulator should decode audio from the iq data.
type Modulator ¶
type Modulator struct { // Config Config ModulatorConfig // contains filtered or unexported fields }
Modulator is
func NewModulator ¶
func NewModulator(cfg ModulatorConfig) (*Modulator, error)
NewModulator allocates
func (*Modulator) SampleRate ¶
SampleRate implements the sdr.Writer interface.
type ModulatorConfig ¶
type ModulatorConfig struct { // AudioSampleRate is the number of audio samples per second. AudioSampleRate uint // IqBufferLength is the amount of data to allocate to process incoming // Audio data. IqBufferLength uint // IqSamplesPerAudioSample controls how many Iq samples need to be generated // for each Audio sample that comes in. // // If the input AudioSampleRate is 44,100, and the IqSamplesPerAudioSample is // 10, the output SampleRate of the sdr.Reader will be 441,000. IqSamplesPerAudioSample uint // CarrierFrequency controls the frequency of the carrier that will be // modulated by incoming data. CarrierFrequency rf.Hz // Beta controls the deviation from the carrier based on the modulating // frequency. // // This value can get weird. If you want to estimate one, pick some values, // plug it into EstimateBeta, and go with it. Beta float64 // Dest is where to send IQ samples to as audio data is written to the // Modulator. Dest sdr.Writer }
ModulatorConfig is