function seqObject = seq_av163_modified( seqName, basedir )
  
% FUNCTION SEQOBJECT = SEQ_AV163_MODIFIED( SEQNAME, BASEDIR )
% 
% For a given sequence of the AV16.3 corpus,
% returns various constants such as waveform filenames, microphone array geometry, etc.
% Each constant is a field of the returned structure "seqObject".
%
% Note that filename strings are always absolute (from '/' downward)
% so you can use them as is.
%
% WARNING !!! this is a modified, stripped-down version of the
% original "seq_av163.m" from the MMM corpus -> modified to suit my
% needs here.
%
% By Guillaume Lathoud, 2006 - lathoud@idiap.ch

  dbstop error
  
  if nargin < 2
    error( 'seq needs two input arguments.' );
  end
  
  
  AVCORPUS_DIR = basedir;
  
  % Microphone array geometry:
  % two uniform circular arrays, 8 mic each.
  
  a = (4:11)*pi/4; 
  g = 0.1* [cos(a);sin(a);0*a];
  
  g1 = g; g1( 2,: ) = g1( 2,: ) + 0.4;
  g2 = g; g2( 2,: ) = g2( 2,: ) - 0.4;
  
  % Cartesian 3D coordinates
  AVCORPUS_MA_GEOMETRY = [ g1 g2 ];
  
  % Default: we did not find this sequence in the corpus
  o = [];
  found_it = 0;
  
  if ~found_it & strcmp( seqName(1:3), 'seq' )
    
    % First look for a directory bearing this name
    
    d_session = dir( AVCORPUS_DIR );
    for a = 1:length( d_session )
      
      if d_session( a ).isdir
	
	if exist( fullfile( AVCORPUS_DIR, d_session( a ).name, seqName ) , 'dir' )
	  found_it = 1;
	  session_name = d_session( a ).name;
	  break;
	end
	
      end
      
    end
    
    
    % Second, if we found it, look for WAV files and such
    % Mark their location in the "o" structure
    
    if found_it
      
      o.NAME = seqName;
      
      o.DIR = fullfile( AVCORPUS_DIR, session_name, seqName );
      
      o.MA_DIR = o.DIR;
      
      o.MA_GEOMETRY = AVCORPUS_MA_GEOMETRY;
      o.MA_FILE_LIST = {};
      
      % Microphone array 1
      
      for a = 1:8
	a_name = sprintf( '%s_array1_mic%d.wav', seqName, a );
	o.MA_FILE_LIST{ a } = fullfile( o.MA_DIR, a_name );
      end
          
      % Microphone array 2
      
      for a = 1:8
	a_name = sprintf( '%s_array2_mic%d.wav', seqName, a );
	o.MA_FILE_LIST{ a + 8 } = fullfile( o.MA_DIR, a_name );
      end
          
    end
    
  end
    
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  % Return the structure: [] if sequence not found
  seqObject = o;
  