pub struct SameReceiver { /* private fields */ }
Expand description

A complete SAME/EAS receiver chain

The receive chain takes f32 audio samples and performs the following operations:

  1. Automatic gain control
  2. Demodulation and down-sampling to two samples per symbol, governed by a zero-crossing detector timing recovery loop.
  3. Access code correlation and squelch. The code correlator also synchronizes to byte boundaries.
  4. (Optional) Adaptive decision feedback equalization
  5. Framing and message decoding

To create the receiver, first create its Builder:

use sameold::SameReceiverBuilder;

let mut builder = SameReceiverBuilder::default();
let receiver = builder.build();
assert_eq!(receiver.input_rate(), 22050);

Once created, use the iter_messages() method to obtain decoded messages.

See module documentation for details.

Implementations

Decode events and messages from a source of audio

Bind an iterator which will consume the input and produce SAME FrameOut events, which include:

  • notifications about acquired and dropped carrier,
  • attempts to frame messages; and
  • successful framed messages

The input must be f32 PCM mono audio at the input_rate() for this receiver. Sound cards commonly output audio samples in i16 format. You must perform the conversion to floating-point yourself, if needed. It is unnecessary to scale the converted values; our AGC algorithm will take care of that.

The iterator will consume as many samples of input that are required to produce the next event. It will return None if the input is exhausted and there are no new events.

You can use iter_messages() instead if you are only interested in successful decodes.

Receive SAME messages from a source of audio

Bind an iterator which will consume the input and produce SAME Message events. Only successfully-decoded messages are reported. Other events, such as acquisition of signal or decoding failures, are not reported. If you are interested in these events, use iter_frames() instead.

The input must be f32 PCM mono audio at the input_rate() for this receiver. Sound cards commonly output audio samples in i16 format. You must perform the conversion to floating-point yourself, if needed. It is unnecessary to scale the converted values; our AGC algorithm will take care of that.

The iterator will consume as many samples of input that are required to produce the next message. It will return None if the input is exhausted and there are no new messages.

Input sampling rate

Returns sampling rate expected by the process() method.

Lifetime total input sample counter

Reports the lifetime total of input samples which have been processed.

Clear all DSP states and reset to zero initial conditions

All buffers and states are cleared.

Flush the DSP buffers and emit any leftover messages

The DSP algorithms impose delay on the input. When processing recorded audio that has been “close cut” to the extents of a message, the SameReceiver might not emit the message. This is because not all of the data samples from the file have made their way through the entire system.

This method flushes the input with an adequate number of zeros to ensure all buffered samples have been processed. Returns the last Message generated, if any.

You probably want to reset() after calling this method.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Create the SAME Receiver from its Builder

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more

Checks if self is actually part of its subset T (and can be converted to it).

Use with care! Same as self.to_subset but without any property checks. Always succeeds.

The inclusion map: converts self to the equivalent element of its superset.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.