Documentation

dsp.Buffer System object

Package: dsp

Buffer input signal

Description

The Buffer object buffers an input signal. The number of samples per channel in the input must equal the difference between the output buffer size and buffer overlap (i.e., Length - OverlapLength). When you set FrameBasedProcessing to true, the number of samples per channel equals the number of rows in the input. If you set FrameBasedProcessing to false, the number of samples per channel equals 1.

To buffer an input signal:

  1. Define and set up your buffer System object™. See Construction.

  2. Call step to buffer the input according to the properties of dsp.Buffer. The behavior of step is specific to each object in the toolbox.

Construction

H=dsp.Buffer returns a buffer System object, HBUFF, used to buffer input signals with overlap.

H=dsp.Buffer('PropertyName',PropertyValue,...) returns a buffer object, H, with each specified property set to the specified value.

H=dsp.Buffer(LEN,OVRLAP,ICS,'PropertyName',...
PropertyValue,...)
returns a buffer object, H, with Length property set to LEN, OverlapLength property set to OVRLAP, InitialConditions property set to ICS and other specified properties set to the specified values.

Properties

Length

Number of samples to buffer

Specify the number of consecutive samples from each input channel to buffer. You can set this property to any scalar integer greater than 0 of MATLAB® built-in numeric data type. The default is 64.

OverlapLength

Amount of overlap between outputs

Specify the number of samples by which consecutive output frames overlap. You can set this property to any scalar integer greater than or equal to 0 of MATLAB built-in numeric data type. The default is 0.

InitialConditions

Initial output

Specify the value of the object's initial output for cases of nonzero latency as a scalar, vector, or matrix. The default is 0.

FrameBasedProcessing

Enable frame-based processing

If this property is set to true, each column of the input is treated as a separate channel for buffering. If the value of this property is false, each element of the input is treated as a separate channel. The default is true.

Methods

cloneCreate instance of an object with the same property values
getNumInputsNumber of expected inputs to step method
getNumOutputsNumber of outputs of step method
isLockedLocked status for input attributes and nontunable properties
releaseAllow property value and input characteristics changes
resetReset the internal states of a System object
stepBuffer input signal based on past values

Examples

Create a buffer of 256 samples with 128 sample overlap:

hreader=dsp.SignalSource(randn(1024,1),128);
hbuff=dsp.Buffer(256,128);

for i=1:8
     y=step(hbuff,step(hreader));
     % y is of length 256 with 128 samples
     %   from previous input
 end

Algorithms

This object implements the algorithm, inputs, and outputs described on the Buffer block reference page. The object properties correspond to the block properties, except as noted.

This object processes inputs as frames or as samples by setting the FrameBasedProcessing property. The corresponding block has a temporary Treat Mx1 and unoriented sample-based signals as parameter with One channel option for frame behavior and M channels option for sample behavior. See the Buffer block reference page and Set the FrameBasedProcessing Property of a System object for more information.

Was this topic helpful?