Skip to content

Commit b1703f8

Browse files
committed
debug the experiment to work
1 parent 0a15ec5 commit b1703f8

File tree

3 files changed

+22
-17
lines changed

3 files changed

+22
-17
lines changed

audioLocTranslational.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@
4949
'direction', 'speed', 'target', 'event', 'block');
5050

5151
% % % REFACTOR THIS FUNCTION
52-
[soundData, freq] = loadAudioFiles(SubjName);
53-
phandle = PsychPortAudio('Open',[],[],1,freq,2);
52+
[expParameters] = loadAudioFiles(cfg, expParameters);
53+
phandle = PsychPortAudio('Open',[],[],1,expParameters.freq,2);
5454
% % %
5555

5656
% Prepare for fixation Cross
@@ -128,7 +128,7 @@
128128
thisEvent.target = expParameters.designFixationTargets(iBlock,iEvent);
129129

130130
% play the sounds and collect onset and duration of the event
131-
[onset, duration] = doAudMot(cfg, expParameters, thisEvent)
131+
[onset, duration] = doAudMot(cfg, expParameters, thisEvent, phandle);
132132

133133
thisEvent.event = iEvent;
134134
thisEvent.block = iBlock;

subfun/doAudMot.m

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function [onset, duration] = doAudMot(cfg, expParameters, thisEvent)
1+
function [onset, duration] = doAudMot(cfg, expParameters, thisEvent, phandle)
22

33
% Play the auditopry stimulation of moving in 4 directions or static noise bursts
44
%
@@ -20,6 +20,9 @@
2020

2121
direction = thisEvent.direction(1);
2222
isTarget = thisEvent.target(1);
23+
targetDuration = expParameters.targetDuration;
24+
25+
soundData = expParameters.soundData;
2326

2427

2528

@@ -47,7 +50,7 @@
4750
sound = soundData.D_T;
4851
elseif direction == 0
4952
sound = soundData.R_T;
50-
elseif sdirection == 180
53+
elseif direction == 180
5154
sound = soundData.L_T;
5255
end
5356

@@ -56,17 +59,19 @@
5659
% Start the sound presentation
5760
PsychPortAudio('FillBuffer',phandle,sound);
5861
playTime = PsychPortAudio('Start',phandle);
59-
onset = playtime;
62+
onset = playTime;
6063

6164
% Draw the fixation cross
6265
color = expParameters.fixationCrossColor;
66+
6367
% If this frame shows a target we change the color
6468
if GetSecs < (onset+targetDuration) && isTarget==1
6569
color = expParameters.fixationCrossColorTarget;
6670
end
6771
drawFixationCross(cfg, expParameters, color)
6872

6973
% Get the end time
70-
[~, ~, ~, stopTime} = PsychPortAudio('Stop',phandle);
74+
% [~, ~, ~, stopTime] = PsychPortAudio('Stop',phandle);
7175

72-
duration = stopTime - onset;
76+
% duration = stopTime - onset;
77+
duration = onset + 1.2;

subfun/loadAudioFiles.m

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function [expParameters] = loadAudioFiles(expParameters)
1+
function [expParameters] = loadAudioFiles(cfg, expParameters)
22

33
%% Get parameters
44

@@ -19,20 +19,20 @@
1919
soundData.S = soundData.S';
2020

2121
%motion input
22-
fileName=fullfile('input','Motion',SubjName,['rms_',SubjName,'_U.wav']);
22+
fileName=fullfile('input','Motion',subjName,['rms_',subjName,'_U.wav']);
2323
[soundData.U , freq2] = audioread(fileName);
2424
soundData.U = soundData.U';
2525

26-
fileName=fullfile('input','Motion',SubjName,['rms_',SubjName,'_D.wav']);
26+
fileName=fullfile('input','Motion',subjName,['rms_',subjName,'_D.wav']);
2727
[soundData.D , freq3] = audioread(fileName);
2828
soundData.D = soundData.D';
2929

30-
fileName=fullfile('input','Motion',SubjName,['rms_',SubjName,'_R.wav']);
30+
fileName=fullfile('input','Motion',subjName,['rms_',subjName,'_R.wav']);
3131
[soundData.R , freq4] = audioread(fileName);
3232
soundData.R = soundData.R';
3333

3434

35-
fileName=fullfile('input','Motion',SubjName,['rms_',SubjName,'_L.wav']);
35+
fileName=fullfile('input','Motion',subjName,['rms_',subjName,'_L.wav']);
3636
[soundData.L , freq5] = audioread(fileName);
3737
soundData.L = soundData.L';
3838

@@ -45,20 +45,20 @@
4545
soundData.S_T = soundData.S_T';
4646

4747
%motion Stimuli
48-
fileName=fullfile('input','Motion',SubjName,['rms_',SubjName,'_U_T.wav']);
48+
fileName=fullfile('input','Motion',subjName,['rms_',subjName,'_U_T.wav']);
4949
[soundData.U_T , freq7] = audioread(fileName);
5050
soundData.U_T = soundData.U_T';
5151

52-
fileName=fullfile('input','Motion',SubjName,['rms_',SubjName,'_D_T.wav']);
52+
fileName=fullfile('input','Motion',subjName,['rms_',subjName,'_D_T.wav']);
5353
[soundData.D_T , freq8] = audioread(fileName);
5454
soundData.D_T = soundData.D_T';
5555

56-
fileName=fullfile('input','Motion',SubjName,['rms_',SubjName,'_R_T.wav']);
56+
fileName=fullfile('input','Motion',subjName,['rms_',subjName,'_R_T.wav']);
5757
[soundData.R_T , freq9] = audioread(fileName);
5858
soundData.R_T = soundData.R_T';
5959

6060

61-
fileName=fullfile('input','Motion',SubjName,['rms_',SubjName,'_L_T.wav']);
61+
fileName=fullfile('input','Motion',subjName,['rms_',subjName,'_L_T.wav']);
6262
[soundData.L_T , freq10] = audioread(fileName);
6363
soundData.L_T = soundData.L_T';
6464

0 commit comments

Comments
 (0)