Home > . > DIVA_SoundMap.m

DIVA_SoundMap

PURPOSE ^

DIVA_SoundMAP Speech initiation module

SYNOPSIS ^

function out=DIVA_SoundMap(varargin);

DESCRIPTION ^

 DIVA_SoundMAP Speech initiation module

 This model initiates the production of phonemic segments,
 sending an index to the desired phonemic target to MotorCortex,
 AuditoryCortex and SomatosensoryCortex.

 DIVA_SoundMap('init' [,SessionName]);          Initializes the module
 DIVA_SoundMap('save' [,SessionName] );         Saves state
 DIVA_SoundMap('exit');                         Exits the module (without saving)
 DIVA_SoundMap(PropertyName [,PropertyValue] )  Reads and writes internal model properties

 DIVA_SoundMap('target',targetindex);
 Projects auditory, somatosensory, and motor associations of
 a given phonemic target.

 Current DIVA_SoundMap properties are: (* requires re-initialization)
  *  delayToMotorCortex          : delay (in seconds) for signals to MotorCortex

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function out=DIVA_SoundMap(varargin);
0002 % DIVA_SoundMAP Speech initiation module
0003 %
0004 % This model initiates the production of phonemic segments,
0005 % sending an index to the desired phonemic target to MotorCortex,
0006 % AuditoryCortex and SomatosensoryCortex.
0007 %
0008 % DIVA_SoundMap('init' [,SessionName]);          Initializes the module
0009 % DIVA_SoundMap('save' [,SessionName] );         Saves state
0010 % DIVA_SoundMap('exit');                         Exits the module (without saving)
0011 % DIVA_SoundMap(PropertyName [,PropertyValue] )  Reads and writes internal model properties
0012 %
0013 % DIVA_SoundMap('target',targetindex);
0014 % Projects auditory, somatosensory, and motor associations of
0015 % a given phonemic target.
0016 %
0017 % Current DIVA_SoundMap properties are: (* requires re-initialization)
0018 %  *  delayToMotorCortex          : delay (in seconds) for signals to MotorCortex
0019 %
0020 
0021 % Dependencies:
0022 %
0023 
0024 out=[];
0025 global DIVA_SoundMap_data
0026 
0027 for indexargin=1:2:nargin,
0028   switch(varargin{indexargin}),
0029    case 'init',
0030     SessionFolder=strcat(DIVA('SessionFolder'),filesep);
0031     if nargin<indexargin+1 | isempty(varargin{indexargin+1}),
0032       initfile='';
0033     else,
0034       initfile=[SessionFolder,'Session_',varargin{indexargin+1},filesep,mfilename,'.mat'];
0035     end
0036     if isempty(initfile) | isempty(dir(initfile)),
0037       disp([mfilename, ' : Defining new session...']);
0038       % INITIALIZES INTERNAL MODULE PARAMETERS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0039       DIVA_SoundMap_data.params=struct(...
0040           'delayToMotorCortex',.005);
0041       % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0042 
0043     else,
0044       data=load(initfile,'-mat');
0045       DIVA_SoundMap_data.params=data.params;
0046     end
0047     % INITIALIZES OTHER (TEMPORAL) PARAMETERS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0048     DIVA_SoundMap_data.params.delayToSomatosensoryCortex=...
0049         DIVA_SoundMap_data.params.delayToMotorCortex+...
0050         DIVA('MotorCortex','delayToVocalTract')+...
0051         DIVA('VocalTract','delayToSensoryChannel')+0*...
0052         DIVA('SensoryChannel','delayToSensory')+...
0053         DIVA('Sensory','delayToSomatosensoryCortex');
0054 
0055     DIVA_SoundMap_data.params.delayToAuditoryCortex=...
0056         DIVA_SoundMap_data.params.delayToMotorCortex+...
0057         DIVA('MotorCortex','delayToVocalTract')+...
0058         DIVA('VocalTract','delayToSoundChannel')+0*...
0059         DIVA('SoundChannel','delayToCochlea')+...
0060         DIVA('Cochlea','delayToAuditoryCortex');
0061 
0062     % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0063 
0064     % LIST OF MODULE CHANNELS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0065     out={'target'};
0066     % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0067 
0068    case 'save',
0069     SessionFolder=strcat(DIVA('SessionFolder'),filesep);
0070     if nargin<indexargin+1,
0071       initfile=[SessionFolder,'Session_','default',filesep,mfilename,'.mat'];
0072     else,
0073       initfile=[SessionFolder,'Session_',varargin{indexargin+1},filesep,mfilename,'.mat'];
0074     end
0075     params=DIVA_SoundMap_data.params;
0076     save(initfile,'params');
0077 
0078    case 'exit',
0079     clear DIVA_SoundMap_data;
0080     % CODE FOR CLEARING MEMORY OR THE LIKE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0081     % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0082 
0083    case 'disp',
0084     disp(DIVA_SoundMap_data.params);
0085     out=fieldnames(DIVA_SoundMap_data.params);
0086 
0087     % CODE IMPLEMENTING THIS MODULE PROCESS(ES) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0088 
0089    case 'target',
0090     % Sends target commands to MotorCortex, AuditoryCortex, and SomatosensoryCortex
0091     targetindex=varargin{indexargin+1};
0092     DIVA('MotorCortex','target',targetindex,...
0093          DIVA_SoundMap_data.params.delayToMotorCortex);
0094     DIVA('SomatosensoryCortex','target',targetindex,...
0095          DIVA_SoundMap_data.params.delayToSomatosensoryCortex);
0096     DIVA('AuditoryCortex','target',targetindex,...
0097          DIVA_SoundMap_data.params.delayToAuditoryCortex);
0098     if ~nargout,
0099       DIVA('ModelStatePlot','SoundMap','target');
0100     end
0101 
0102     % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0103 
0104    otherwise,
0105     if isfield(DIVA_SoundMap_data.params,varargin{indexargin}),
0106       if indexargin==nargin,
0107         out=DIVA_SoundMap_data.params.(varargin{indexargin});
0108       else,
0109         DIVA_SoundMap_data.params.(varargin{indexargin})=varargin{indexargin+1};
0110       end
0111     else,
0112       warning('DIVA_SoundMap: wrong argument');
0113     end
0114   end
0115 end
0116

Generated on Tue 27-Mar-2007 12:06:24 by m2html © 2003