1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
| %% ETAPE 0: INITIALISATION
clear all
close all
InitializePsychSound
%% ETAPE 1: CARACTERISTIQUES SUJETS
SsID = input ('Numero de participants: ');
age = input ('Age: ');
genre = input ('Genre: ', 's');
%% ETAPE 2: OUVERTURE PTB
[w,wrect]=Screen('OpenWindow',0);
%% ETAPE 3: EXPERIENCE
img = imread('imageconsigne.jpg');
Screen('PutImage', w, img);
Screen(w,'Flip');
KbWait;
WaitSecs(1);
items = {'Cloche.wav','gain piece.wav','Applaudissement2.wav'};
touche = {};
HideCursor;
for j = 1:2
for i = 1:SsID
alea = randperm(3)
end
items = items (alea);
for i = 1:3
img = imread('echelle likert.jpg');
Screen('PutImage', w, img);
reply=Ask(w,'Quelle valence emotionnelle ressentez-vous?',[255,0,0],[],'GetChar',RectLeft,RectTop);
Screen(w,'Flip');
WaitSecs(1);
[y, freq, nbits] = wavread(items{i});
wavedata = y';
nrchannels = size(wavedata,1);
pahandle = PsychPortAudio('Open', [], [], 0, freq, nrchannels);
PsychPortAudio('FillBuffer', pahandle, wavedata);
PsychPortAudio('Start', pahandle, [], 0, 1);
WaitSecs(1);
touche{i} = KbName(keyCode);
data(1:i,:) = [items(:,1:i)', touche];
dataEnr = data';
fid = fopen('resultats.txt', 'wt');
fprintf(fid, '%s\t%s\n','item','touche');
fprintf(fid, '%s\t%f\n', dataEnr{:});
end
end
ShowCursor;
%% ETAPE 4: FERMETURE PTB
Screen('CloseAll'); |
Partager