Skip to content

Commit

Permalink
added negative sound (scream from fc) for negative outcome
Browse files Browse the repository at this point in the history
  • Loading branch information
James Touthang committed Dec 11, 2022
1 parent 8287007 commit 67892b8
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 38 deletions.
86 changes: 49 additions & 37 deletions public/js/tasks/cooperation_task/cooperation_task.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,8 @@ var resources = [
{ name: 'negative_face', path: '/js/tasks/cooperation_task/media/red_sad.png' },
{ name: 'neutral_face', path: '/js/tasks/cooperation_task/media/neutral_face.png' },
{ name: 'coop_neut_sound.mp3', path: '/js/tasks/cooperation_task/media/coop_neut_sound.mp3' },
{ name: 'coop_pos_sound.mp3', path: '/js/tasks/cooperation_task/media/coop_pos_sound.mp3'}
{ name: 'coop_pos_sound.mp3', path: '/js/tasks/cooperation_task/media/coop_pos_sound.mp3' },
{ name: 'scream.wav', path: '/js/tasks/cooperation_task/media/FearConditioning_media_Scream2sx3B.wav'}
]

// schedule the experiment:
Expand Down Expand Up @@ -1435,53 +1436,64 @@ function getOutcomePair(outcome, game_type, choice) {
g.outcome_triple = g.outcome_media.negative[g.choice_counter['negative']];
incrementCounters('negative')
}
g.outcome_image = new visual.ImageStim({
win : psychoJS.window,
name : 'outcome_image', units : 'norm',
image : g.outcome_triple[1], mask : undefined,
ori: 0,pos: [0,0], opacity : 1,size: [2,2],
flipHoriz : false, flipVert : false,
texRes : 128, interpolate : true, depth : 2
})

// Outcome Sound Stim
g.outcome_sound = new Sound({
win: psychoJS.window,
value: 'coop_neut_sound.mp3'
});

break;
case 'positive':
g.outcome_triple = g.outcome_media.positive[g.choice_counter['positive']];
incrementCounters('positive')

g.outcome_image = new visual.ImageStim({
win : psychoJS.window,
name : 'outcome_image', units : 'norm',
image : g.outcome_triple[0], mask : undefined,
ori: 0,pos: [0,0], opacity : 1,size: [2,2],
flipHoriz : false, flipVert : false,
texRes : 128, interpolate : true, depth : 2
})

// Outcome Sound Stim
g.outcome_sound = new Sound({
win: psychoJS.window,
value: 'coop_pos_sound.mp3'
});

break;
case 'negative':
g.outcome_triple = g.outcome_media.negative[g.choice_counter['negative']];
incrementCounters('negative')
break;
}

console.log('Outcome: ', outcome, game_type, g.outcome_triple)

// use neutral sound if the outcome is neutral
if (outcome == 'neutral') {
// Outcome_image Stim
g.outcome_image = new visual.ImageStim({
win : psychoJS.window,
name : 'outcome_image', units : 'norm',
image : g.outcome_triple[1], mask : undefined,
ori: 0,pos: [0,0], opacity : 1,size: [2,2],
flipHoriz : false, flipVert : false,
texRes : 128, interpolate : true, depth : 2
})

// Outcome Sound Stim
g.outcome_sound = new Sound({
win: psychoJS.window,
value: 'coop_neut_sound.mp3'
});
} else {
// Outcome_image Stim
g.outcome_image = new visual.ImageStim({
win : psychoJS.window,
name : 'outcome_image', units : 'norm',
image : g.outcome_triple[0], mask : undefined,
ori: 0,pos: [0,0], opacity : 1,size: [2,2],
flipHoriz : false, flipVert : false,
texRes : 128, interpolate : true, depth : 2
})
g.outcome_image = new visual.ImageStim({
win : psychoJS.window,
name : 'outcome_image', units : 'norm',
image : g.outcome_triple[0], mask : undefined,
ori: 0,pos: [0,0], opacity : 1,size: [2,2],
flipHoriz : false, flipVert : false,
texRes : 128, interpolate : true, depth : 2
})

// Outcome Sound Stim
g.outcome_sound = new Sound({
win: psychoJS.window,
value: 'scream.wav'
});

// Outcome Sound Stim
g.outcome_sound = new Sound({
win: psychoJS.window,
value: 'coop_pos_sound.mp3'
});
break;
}

g.outcome_sound.setVolume(1.0);
}

Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion public/js/tasks/invitation_task/invitation_task.js
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ function experimentInit() {
win : psychoJS.window,
name : 'step_1_backg', units : 'height',
image : 'step_1_backg', mask : undefined,
ori : 0, pos : [0, 0], size: 1,
ori : 0, pos : [0, 0], size: 0.8,
color : new util.Color([1, 1, 1]), opacity : 1,
flipHoriz : false, flipVert : false,
texRes : 128, interpolate : true, depth : 0
Expand Down

0 comments on commit 67892b8

Please sign in to comment.