%% Decrease Underrun
% Examine the Audio Device Writer block in a Simulink(R) model, determine
% underrun, and decrease underrun.    
%
open_system('DecreaseUnderrunModel')

%% 
% 1. Run the model. The Audio Device Writer sends an audio stream to your
% computer's default audio output device. The Audio Device Writer block
% sends the number of samples underrun to your <docid:dsp_ref#f5-1117037
% Time Scope>.
% 
open_system('DecreaseUnderrunModel/Time Scope')
sim('DecreaseUnderrunModel',5)

%%
% 2. Uncomment the Artificial Load block. This block performs computations
% that slow the simulation.
%
% 3. Run the model. If your device writer is dropping samples:
%
% a. Stop the simulation.
%
% b. Open the <docid:dsp_ref#bqs4l1e-1 From Multimedia File> block.
%
% c. Set the *Samples per frame* parameter to |1024|.
%
% d. Close the block and run the simulation.
%
% If your model continues to drop samples, increase the frame size again.
% The increased frame size increases the buffer size used by the sound
% card. A larger buffer size decreases the possibility of underruns at the
% cost of higher audio latency.
%
close_system('DecreaseUnderrunModel')

%% 
% Copyright 2012 The MathWorks, Inc.