boxcar44
boxcar44

Reputation: 1

Audio corrective feedback on psychopy (older version that supports sound)

As some of you may know, psychopy has errors playing sound files on the newer versions, so I have the oldest version installed currently and am trying to make audio corrective feedback for a behavioral test meant to be in an fMRI scanner. The feedback is needed to keep the participants awake. I'm having a lot of trouble finding how to code it correctly, as nothing I've tried works (I've gotten plenty of errors, the main one being invalid Syntax), as I am not using the builder. I am very new at coding. This is what I have so far:

cue = visual.TextStim(myWin, pos = [0.0,0.0],color = -1)
fix = visual.TextStim(myWin,text = '+',height = 1.0,color = -1)
begin_text = ('Press the space bar to begin')
hit_sound = sound.Sound(value='G', secs=0.5, octave=4, sampleRate=44100, bits=16)
miss_sound = sound.Sound(value='G', secs=0.5, octave=3, sampleRate=44100, bits=16)
cue_type = ['either_color', 'either_shape', 'either_nochange',    'either_nochange', 'color', 'color_nochange', 'shape', 'shape_nochange']#trial types
cue_type*=num_trials #number of trials
random.shuffle(cue_type) #randomizing trials
if key_resp.corr
feedback= hit_sound.play
else:
feedback= miss_sound.play

Thank you in advance.

Upvotes: 0

Views: 166

Answers (1)

pyne
pyne

Reputation: 507

Are you coding this from scratch or transferred from builder to coder view and making edits? If you are making edits in the coder view, make sure the indents and punctuations remain the same.

From what you've shared, I can see that

    if key_resp.corr
    feedback= hit_sound.play
    else:
    feedback= miss_sound.play

should be:

    if key_resp.corr:
        hit_sound.play()
    else:
        miss_sound.play()

Upvotes: 1

Related Questions