User`s guide

To Wave Device
5-446
the hardware throughput rate is higher than the simulation throughput rate,
and the buffer tends to empty over the duration of the simulation.
Under normal operation, an empty buffer indicates that the simulation is
finished, and the entire length of the audio signal has been processed.
However, if the buffer size is too small in relation to the simulation throughput
rate, the buffer may also empty before the entire length of signal is processed.
This usually results in a device error or undesired device output.
When the device fails to process the entire signal length because the buffer
prematurely empties, you can choose to either increase the buffer size or the
simulation throughput rate.
Increase the buffer size. The
Queue duration parameter specifies the length
of signal, T
b
(in real-time seconds), to buffer to the audio device during the
simulation. The number of frames buffered is approximately
where F
s
is the sample rate of the signal and M
o
is the number of samples
per frame. The optimal buffer size for a given signal depends on the signal
length, the frame size, and the speed of the simulation. The maximum
number of frames that can be buffered is 1024.
Increase the simulation throughput rate. Two useful methods for improving
simulation throughput rates are increasing the signal frame size and
compiling the simulation into native code.
- Increase frame sizes (and convert sample-based signals to frame-based
signals) throughout the model to reduce the amount of block-to-block
communication overhead. This can drastically increase throughput rates
in many cases. However, larger frame sizes generally result in greater
model latency due to initial buffering operations. (Note that increasing the
audio signal frame size does not affect the number of samples buffered to
the hardware since the
Queue duration is specified in seconds.)
- Generate executable code with Real-Time Workshop. Native code runs
much faster than Simulink, and should provide rates adequate for
real-time audio processing.
Audio problems at startup can often be corrected by entering a larger value for
the
Initial output delay parameter, which allows a greater portion of the
T
b
F
s
M
o
-------------