Buffering a long signal at a high sample rate causes a memory allocation error

Tech Note: TN0230
Product: RX, ActiveX
Version: All
Date Added: 2006-12-04


The memory allocation for the buffer on an RX device is 14450300 samples. When the buffer required exceeds this limit a memory allocation error is reported.


Either use two buffers each holding half of the data then use ScaleAdd to sum them together, or compress the data into 16-bit integers and expand back into 32-bit floats on the hardware.

If the signal can be expressed in 16-bit format, use the ActiveX command WriteTagVEX and ExpandFrom16 as shown in the figure below. Scale the input data so the maximum values scale to ±32767. Write the 16-bit data to the Data port of the source component. Expand from 16 to 32 bits using the ExpFrom16 component with the inverse of the scale factor used in the first step. Note: not recommended for 32-bit signals such as wav files or signals acquired on a TDT device.

This MATLAB example assumes an input to the SerSource component bounded by unity:

s = 1:2000;
s = sin(s); % input bounded by unity
s = s*32760; % scale the data to best fit the range +/-32767

2000 16-bit input data points fit into the SerSource buffer of size 1000.