Skip to main content
Skip table of contents

Delay16

Overview

Time delay with 16-bit samples

Discussion

Delay module in which samples values are stored as 16-bit data. This module is similar to delay_module.m except that it uses less precision - and less - memory. The delay time is specified in samples and the same delay time is used across channels.

This module differs from the standard Delay module in that sample values are stored as 16-bit values. The module takes the high 16-bits for fract32 and int32 samples. For floating-point, values are first converted to fract32 and then the high 16-bits are taken. Floating-point data outside of the range [-1 +1) is clipped. For the case of floating-point, the fract16 samples are converted back to floating-point. ... At construction time, specify the maximum delay (maxDelay) of the module. The variable, maxDelay determines the size of the internal state buffer. The size of the internal state buffer equals ((maxDelay+1)*numChannels + 1)/2 words. In addition, the instantaneous delay is specified through the interface variable, currentDelay. currentDelay is in the range of [0 maxDelay] and can be changed at run-time. Note that the module is not smoothly updating and you may get audible clicks when adjusting the currentDelay at run-time.

Type Definition

CODE
typedef struct _ModuleDelay16
{
    ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
    INT32 maxDelay;                               // Maximum delay, in samples.
    INT32 currentDelay;                           // Current delay.
    INT32 stateIndex;                             // Index of the oldest state variable in the array of state variables.
    INT32 stateHeap;                              // Heap in which to allocate memory.
    INT32 isFloat;                                // Boolean that indicates whether the data is floating-point and needs to be converted.
    INT32* state;                                 // State variable array.
} ModuleDelay16Class;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

maxDelay

int

const

0

100

Unrestricted

samples

currentDelay

int

parameter

0

0

0:1:100

samples

stateIndex

int

state

1

0

Unrestricted

stateHeap

int

const

1

3

Unrestricted

isFloat

int

parameter

1

1

Unrestricted

state

int*

state

1

[51 x 1]

Unrestricted

Pins

Input Pins

Name: in

Description: audio input

Data type: {float, int, fract32}

Channel range: Unrestricted

Block size range: Unrestricted

Sample rate range: Unrestricted

Complex support: Real

Output Pins

Name: out

Description: audio output

Data type: {float, int, fract32}

MATLAB Usage

File Name: delay16_module.m

CODE
 M=delay16_module(NAME, MAXDELAY, MEMHEAP)
 Sample-based time delay in which internal data is stored as 16-bit
 values.  This saves memory as compared to the delay_module.m.
 Arguments:
    NAME - name of the module.
    MAXDELAY - maximum delay, in samples.
    MEMHEAP - specifies the memory heap to use to allocate the main
         state buffer. This is a string and follows the memory allocation
         enumeration in Framework.h. Allowable values are:
            'AWE_HEAP_FAST' - always use internal DM memory.
            'AWE_HEAP_FASTB' - always use internal PM memory.
            'AWE_HEAP_FAST2FASTB' - Internal DM -> Internal PM
            'AWE_HEAP_FASTB2FAST' - Internal PM -> Internal DM

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.