Document toolboxDocument toolbox

(8.D.2.3) ShiftSamples

Overview

Shifts the samples in a block of data left or right a specified number of samples

Discussion

This module shifts the data in a block of data a specified number of samples left or right. The blockSize of the output pin is the equal to the blockSize of the input pin. Zeros are shifted in and samples are dropped, as necessary. This module is typically used with frequency domain data to shift spectra up or down in frequency. The module operates on multichannel signals and the same shifting operation is applied to each channel.

The parameter, index specifies the number of values to be shifted. The index is zero based, and must lie in the range of [-blockSize+1 blockSize-1]. If index is outside of the allowable range, it is clipped to the ends of the buffers. Negative values of index cause the data to be shifted down in time, and positive values of index cause the data to be shifted up in time.

Type Definition

typedef struct _ModuleShiftSamples { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure INT32 index; // Specifies the number of values to be shifted. } ModuleShiftSamplesClass;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

index

int

parameter

0

0

-31:31

 

Pins

Input Pins

Name: in

Description: Input signal

Data type: {float, int, fract32}

Channel range: Unrestricted

Block size range: Unrestricted

Sample rate range: Unrestricted

Complex support: Real and Complex

Output Pins

Name: out

Description: Output signal

Data type: {float, int, fract32}

MATLAB Usage

File Name: shift_samples_module.m

M=shift_samples_module(NAME) Creates a shift samples module for use in the Audio Weaver environment. This module shifts the bins of one or more channels of the input by an integer number of bins up or down and places the shifted spectra into the channels of the output. Positive shift values correspond to shifting “up” (bins move to higher-frequency locations), and negative value correspond to shifting “down”. Arguments: NAME - name of the module. The input and output must have the same number of channels.