function data_sound(DATA,iiwav);
%
%
% COPYRIGHT (c) 2008
% 
% Applied Research Laboratories, The University of Texas at Austin
% (ARL:UT)
% All rights reserved.
% 
% This material may be reproduced by or for the U.S. Government
% only. This notice must appear in all copies of this file and its
% derivatives. Further distribution outside the U.S. Government is
% prohibited without the explicit written authorization from the
% Director of the Environmental Sciences Laboratory, ARL:UT.
% 
% THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
% EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE
% IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
% PURPOSE, OR NONINFRINGEMENT.
% 
% IN NO EVENT WILL ARL:UT BE LIABLE FOR ANY DAMAGES WHATSOEVER ARISING
% OUT OF THE USE OR INABILITY TO USE THIS SOFTWARE, EVEN IF ARL:UT HAS
% BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
if nargin<2, iiwav=0; end
%
jdim_sec=[];
for jdim=1:DATA.ndim,
    ii=findstr(DATA.labels{jdim},'Time - s');
    if ~isempty(ii), jdim_sec=jdim; break; end
end
if isempty(jdim_sec), error('Could not find Time - s dimension in DATA structure'); end
%
jdim_hour=[];
for jdim=1:DATA.ndim,
    ii=findstr(DATA.labels{jdim},'Time - h');
    if ~isempty(ii), jdim_hour=jdim; break; end
end
if isempty(jdim_hour), error('Could not find Time - h dimension in DATA structure'); end
%
dt=mean(diff(DATA.scales{jdim_sec})); fs=1/dt,
Tw=dt*DATA.dims(jdim_sec),
dhour=mean(diff(DATA.scales{jdim_hour})),
ovl=dhour*3600/Tw,
%
jdim_sort=sort(DATA.dims); jdim_sort(jdim_sec)=0; jdim_sort(jdim_hour)=0; jdim_sort=find(jdim_sort);
jdim_permute=[jdim_sec,jdim_hour,jdim_sort];
data=squeeze(permute(DATA.data,jdim_permute)); dims=size(data);
dims_permute=[dims(1)*dims(2),dims(3:end)]; if length(dims_permute)<2, dims_permute=[dims_permute,1]; end
data2=reshape(data,dims_permute);
%
Length_of_sound = length(data2)*dt/60,
if iiwav,
    wavplay(data2,fs,'async');
else
	soundsc(data2,fs)
end
