Versions Compared

Key

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

Overview

Writes data to a WAV file when triggered

Discussion

This modules writes a few seconds of audio to a file once the trigger signal is asserted. This module only works under Windows and Linux and is not available on embedded targets. You specify the number of seconds to record as a module argument. The module records any number of channels and the first written is in WAV format with 32-bit integer samples. The module accepts any type of input audio data and converts to fract32 as it is recording.

The module has two input pins. The first is the trigger and has 1 channel of integer data. When the first sample of the trigger signal is non zero, the module will start storing data to an internal state buffer. The module stores data for the number of seconds specified as a module argument. Once the data is stored, the data will be written to the output file in the module's set function. After the WAV file is written the module can be triggered again.

Type Definition

Code Block
typedef struct _ModuleTriggeredFileSink
{
    ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
    INT32 fileIndex;                              // Index of file to record
    INT32 samplesStored;                          // Number of samples stored in the state buffer
    INT32 recordingActive;                        // Indicates whether we are actively recording a file
    INT32 errorCode;                              // Return error condition
    FLOAT32 duration;                             // Length of each recording, in seconds
    INT32 durationSamples;                        // Length of each recording, in samples
    INT32 fullFileSize;                           // Size of the array to hold the full file path of the output .wav file
    INT32 dataType;                               // Data type of the input pin
    INT32* fullFileName;                          // Complete file path of the output .wav file to be written data
    fract32* state;                               // Stores data prior to writing to disk
} ModuleTriggeredFileSinkClass;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

BlockSize

int

const

0

32

Unrestricted

NumChannels

int

const

0

1

Unrestricted

SampleRate

float

const

0

48000

Unrestricted

IsComplex

int

const

0

0

Unrestricted

enable

int

parameter

1

0

Unrestricted

value

float*

state

0

[32 x 1]

Unrestricted

yRange

float*

parameter

0

[1 x 2]

Unrestricted

Pins

Input Pins

Name: trigger

Description: triggers recording

...

Sample rate range: Unrestricted

Complex support: Real

MATLAB Usage

File Name: triggered_file_sink_module.m

...