%% Open an 'EBU Mode' Loudness Meter Display
% Create an object of the |loudnessMeter| System object(TM), and then call
% |visualize| to open an 'EBU Mode' loudness meter display.
loudMtr = loudnessMeter;
visualize(loudMtr)

%%
% Create an audio file reader System object and specify the audio file to
% analyze. Create an audio device writer System object to play the audio to
% your output device.
fileReader = dsp.AudioFileReader('RockDrums-48-stereo-11secs.mp3');
deviceWriter = audioDeviceWriter('SampleRate',fileReader.SampleRate);

%%
% In an audio stream loop, read the audio from the file and play it to your
% device. The loudness meter visualization updates at each call.

while ~isDone(fileReader)
    audioIn = fileReader();
    loudMtr(audioIn);
    deviceWriter(audioIn);
end


%% 
% Copyright 2012 The MathWorks, Inc.