Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Scroll Documents: Update page title prefix

Overview

Measures the sample rate of the input signal

Discussion

Sample rate measurement module. The module is designed measure the sample rate of the signal on single channel. Seperate modules are required to measure the sample rate on different channels. The module compares the measured sample rate with the allowable sample rates and estimates the nearest value. The measured sample rate will be displayed on the inspector.

...

The module also optionally outputs the measured sample rate on an output pin. This option is selected by setting the argument SROUTPIN to true. The sample rate value is output an an integer.

Type Definition

Code Block
typedef struct _ModuleSampleRate
{
    ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
    FLOAT32 procSpeed;                            // Processor clock speed in MHz
    INT32 numBlocksToAverage;                     // Number of blocks to process before the sample rate is retured
    INT32 lastCount;                              // Holds the last call cycle count
    INT32 averageDeltaCount;                      // Holds the average delta count of numBlocksToAverage calls
    INT32 SRArrayLength;                          // Number of sample rates that can be estimated
    INT32 initialized;                            // Specifies whether the last cycle counter has been initialized
    INT32 dataValid;                              // Indicates whether the sample rate measurement is valid
    FLOAT32 measuredSR;                           // Readback variable. Displays the measured sample rate on the inspector
    FLOAT32 prevMeasuredSR;                       // Last measured sample rate
    FLOAT32 prevPrevMeasuredSR;                   // Previous to last measured sample rate
    INT32 SROutPin;                               // Boolean specifies whether module will have output pin
    INT32 blockCounter;                           // Counts up to numBlocksToAverage
    FLOAT32* allowableSR;                         // Array of possible sample rates
} ModuleSampleRateClass;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

procSpeed

float

parameter

0

10

Unrestricted

numBlocksToAverage

int

parameter

0

100

1:16384

lastCount

int

state

0

0

Unrestricted

averageDeltaCount

int

state

0

0

Unrestricted

SRArrayLength

int

const

0

3

Unrestricted

initialized

int

state

0

0

Unrestricted

dataValid

int

state

0

0

0:1

measuredSR

float

state

0

48000

Unrestricted

prevMeasuredSR

float

state

0

0

Unrestricted

prevPrevMeasuredSR

float

state

0

0

Unrestricted

SROutPin

int

const

0

1

Unrestricted

blockCounter

int

state

0

0

Unrestricted

allowableSR

float*

parameter

0

[3 x 1]

Unrestricted

Pins

Input Pins

Name: in

Description: Input data pin

...

Sample rate range: Unrestricted

Complex support: Real

Output Pins

Name: out

Description: Measured sample rate

Data type: int

MATLAB Usage

File Name: measure_sample_rate_module.m

...