diff multithreshold 1.46/nextStimulus.m @ 38:c2204b18f4a2 tip

End nov big change
author Ray Meddis <rmeddis@essex.ac.uk>
date Mon, 28 Nov 2011 13:34:28 +0000
parents 3ea506487b3b
children
line wrap: on
line diff
--- a/multithreshold 1.46/nextStimulus.m	Thu Oct 06 15:43:20 2011 +0100
+++ b/multithreshold 1.46/nextStimulus.m	Mon Nov 28 13:34:28 2011 +0000
@@ -2,7 +2,7 @@
 % Handles everything concerned with the stimulus presentation
 %  called from startNewRun in subjGUI
 
-global experiment stimulusParameters withinRuns  
+global experiment stimulusParameters withinRuns  betweenRuns
 experiment.status='presentingStimulus';
 errormsg='';
 
@@ -234,16 +234,133 @@
             case {'training','absThreshold', 'absThreshold_8',  ...
                     'TENtest', 'threshold_duration','discomfort',...
                     'overShoot','overShootB','overShootMB1', ...
-                    'overShootMB2', 'OHIO','OHIOabs','OHIOspect'}
+                    'overShootMB2', 'OHIO','OHIOabs','OHIOspect'...
+                    'OHIOrand', 'OHIOtemp', 'OHIOspectemp'}
                 cueTargetLevel=targetLevel+cueTestDifference;
                 
             case {'forwardMasking','forwardMaskingD','trainingIFMC', ...
-                    'TMC','TMC_16ms', 'TMC - ELP', 'IFMC','IFMC_8ms', 'FMreProbe'}
+                    'TMC','TMC_16ms', 'TMC - ELP', 'IFMC','IFMC_8ms', ...
+                    'FMreProbe'}
                 % cue masker is weaker to make target more audible
                 cueMaskerLevel=maskerLevel-cueTestDifference;
         end
 end
 
+% thresholds (in dB SPL) of the single tone with 12 frequencies:
+%    1   2    3     4    5     6     7     8     9     10     11    12
+% 494, 663, 870, 1125, 1442, 1838, 2338, 2957, 3725, 4689, 5866, 7334
+
+% 2. ‘OHIOtemp’ is for measuring thresholds for temporally integrated
+% combinations of 2, 4, 8, and 12 tones presented simultaneously.
+% In our experiment, we used 4680Hz frequency.
+
+% 3. ‘OHIOspec’ is for measuring thresholds for spectrally integrated
+% combinations of 2(7335 and 5866Hz), 4(7334, 5866, 4680, and 3725Hz),
+% 8(7334, 5866, 4680, 3725, 2957, 2338, 1838, and
+% 1442Hz), and
+% 12(all 12 frequencies) tones presented simultaneously.
+
+% 4. ‘OHIOspectemp’ is for measuring thresholds for patterned signals
+% differing in both the spectral and temporal domains.
+% The frequency conditions are the same as that of ‘OHIOspec’.
+
+% 5. ‘OHIOrand’ is for measuring thresholds for spectrotemporally varying
+% signals with random frequency presentation.
+
+switch experiment.paradigm(1:3)
+    case 'OHI'
+        targetType='OHIO';
+        OHIOtype=experiment.paradigm;
+        % 1. ‘OHIOabs’ paradigm is a baseline procedure for measuring absolute
+
+        nTones=betweenRuns.var1Sequence(betweenRuns.runNumber);
+        allFreqs=[494, 663, 870, 1125, 1442, 1838, 2338, 2957, 3725, 4689, 5866, 7334];
+        toneLevelBoost= ...
+            [1	0	0	1	1	4	8	12	12	14	17	19 ];
+
+
+        % for nTones=nTonesList
+        switch experiment.paradigm
+            %         case ' OHIOabs'
+            %             % one tone frequency at a time
+            %             stim.frequencies=allFreqs(1);
+            %             stim.amplitudesdB=0;
+
+            case 'OHIOrand'
+                % chose nTones frequencies at random
+                x=rand(1,12);
+                [sorted idx]=sort(x);
+                cueTargetFrequency=allFreqs(idx(1:nTones));
+                cueTargetLevel=toneLevelBoost(idx)+...
+                    targetLevel + cueTestDifference;
+                targetFrequency=allFreqs(idx(1:nTones));
+                targetLevel=targetLevel + toneLevelBoost(idx);
+
+            case 'OHIOtemp'
+                % 4680 Hz repeated nTones times
+                cueTargetFrequency=4680*ones(1,nTones);
+                cueTargetLevel=repmat(toneLevelBoost(10),1,nTones)+...
+                    targetLevel + cueTestDifference;
+                targetFrequency=4680*ones(1,nTones);
+                targetLevel= targetLevel+repmat(toneLevelBoost(10),1,nTones);
+
+            case {'OHIOspect',  'OHIOspectemp'}
+                % nTones frequencies either simulataneously or sequentially
+                switch nTones
+                    case 2
+                        cueTargetFrequency=[7335 5866];
+                        targetFrequency=[7335 5866];
+                        idx=[12 11];
+                        cueTargetLevel=targetLevel + toneLevelBoost(idx)+cueTestDifference;
+                        targetLevel=targetLevel + toneLevelBoost(idx);
+                    case 4
+                        cueTargetFrequency=[7334, 5866, 4680, 3725];
+                        targetFrequency=[7334, 5866, 4680, 3725];
+                        idx=[12:-1:9 ];
+                        cueTargetLevel=targetLevel + toneLevelBoost(idx)+cueTestDifference;
+                        targetLevel=targetLevel + toneLevelBoost(idx);
+                    case 8
+                        cueTargetFrequency=...
+                            [7334, 5866, 4680, 3725, 2957, 2338, 1838, 1442];
+                        targetFrequency=...
+                            [7334, 5866, 4680, 3725, 2957, 2338, 1838, 1442];
+                        idx=[12:-1:5 ];
+                        cueTargetLevel=targetLevel + toneLevelBoost(idx)+cueTestDifference;
+                        targetLevel=targetLevel + toneLevelBoost(idx);
+                    case 12
+                        cueTargetFrequency=allFreqs;
+                        targetFrequency=allFreqs;
+                        cueTargetLevel=targetLevel + toneLevelBoost(1:12)+cueTestDifference;
+                        targetLevel=targetLevel + toneLevelBoost(1:12);
+                end
+        end
+
+    otherwise
+        OHIOtype='none';
+end
+
+switch experiment.paradigm(1:3)
+    case 'OHI'
+
+        switch experiment.threshEstMethod
+            case {'2I2AFC++', '2I2AFC+++'}
+                % the cue stimulus (masker + probe) is the 'no' window
+                % the target stimulus (masker+probe) is the 'yes' window
+                % the order of presentation is decided at the last minute.
+                cueTargetLevel=-100; 
+        end
+
+
+        switch experiment.paradigm
+            case {'OHIOabs', 'OHIOspect'}
+                OHIOtoneDuration=.02+stimulusParameters.stimulusDelay;
+                globalStimParams.overallDuration=OHIOtoneDuration;
+            otherwise
+                OHIOtoneDuration=nTones*0.02+stimulusParameters.stimulusDelay;
+                globalStimParams.overallDuration=OHIOtoneDuration;
+        end
+end
+
 % ----------------------------- catch trial
 if withinRuns.catchTrial
     targetLevel=-100;	% no target
@@ -370,8 +487,8 @@
             return
         end
         
+    case 'gapDuration'
         % legacy programming
-    case 'gapDuration'
         if gapDuration<0
             errormsg=['gapDuration (' num2str(gapDuration) ...
                 ') is less than zero  ***'];
@@ -497,6 +614,20 @@
 globalStimParams.nSignalPoints=...
     round(globalStimParams.overallDuration*globalStimParams.FS);
 
+% special case
+switch experiment.paradigm(1:3)
+    case 'OHI'
+        switch experiment.paradigm
+            case {'OHIOabs', 'OHIOspect'}
+                OHIOtoneDuration=.02+stimulusParameters.stimulusDelay;
+                globalStimParams.overallDuration=OHIOtoneDuration;
+            otherwise
+                OHIOtoneDuration=nTones*0.02+stimulusParameters.stimulusDelay;
+                globalStimParams.overallDuration=OHIOtoneDuration;
+        end
+end
+
+
 %           ----------------------------------------------cue stimulus
 % cue masker
 componentNo=1;
@@ -527,6 +658,7 @@
 componentNo=2;
 precedingSilence=precedingSilence + maskerDuration+cueGapDuration;
 stimComponents(targetEar,componentNo).type=targetType;
+stimComponents(targetEar,componentNo).OHIOtype=OHIOtype;
 stimComponents(targetEar,componentNo).toneDuration=targetDuration;
 stimComponents(targetEar,componentNo).frequencies=cueTargetFrequency;
 stimComponents(targetEar,componentNo).amplitudesdB=cueTargetLevel;
@@ -605,6 +737,7 @@
 componentNo=2;
 targetDelay=precedingSilence+ maskerDuration+ gapDuration;
 stimComponents(targetEar,componentNo).type=targetType;
+stimComponents(targetEar,componentNo).OHIOtype=OHIOtype;
 stimComponents(targetEar,componentNo).toneDuration=targetDuration;
 stimComponents(targetEar,componentNo).frequencies=targetFrequency;
 stimComponents(targetEar,componentNo).amplitudesdB=targetLevel;
@@ -661,8 +794,14 @@
         %     case 'SRT'
         %         set(handles.editdigitInput,'visible','off')
     otherwise
-        stimulusParameters.testTargetBegins=targetDelay;
-        stimulusParameters.testTargetEnds=targetDelay+targetDuration;
+        switch experiment.paradigm(1:3)
+            case 'OHI'
+                stimulusParameters.testTargetBegins=0;
+                stimulusParameters.testTargetEnds=OHIOtoneDuration;
+            otherwise
+                stimulusParameters.testTargetBegins=targetDelay;
+                stimulusParameters.testTargetEnds=targetDelay+targetDuration;
+        end
 end
 
 % ------------------------------------------------------------- play!