| Reference | Downloads | Github

AttributeError: 'SoundPTB' object has no attribute 'tStopRefresh'

Hi! I am running an experiment in coder and I get the following error:

trials_inner_loop.addData(‘Sound stopped’, trial_sound.tStopRefresh)
AttributeError: ‘SoundPTB’ object has no attribute ‘tStopRefresh’

I have virtually the same code running on an earlier part of the experiment so I am very confused as to why this has arisen.

The entire code (if relevant is below):

if syl_list == None:
    x = 48
    array_shape = stimuli_array.shape[0]
    S_index = np.random.choice(array_shape, x, replace=False)
    S_index = np.random.choice(syl_list)
R_index = int(S_index)
Syllable = stimuli_array[R_index,:]
Syllable = Syllable.ravel()
delay_length = random.randint(22049, 33074)
delay = np.zeros((delay_length, 1))
delay = delay.ravel()
Syllable = np.concatenate([delay, Syllable])
length = len(Syllable)
stim = np.concatenate([delay, stim])
filename = (str(2) + '.mat')
noise ='SNR_list/' + filename, appendmat=False)
noise = noise['newSNR']
noise = noise.ravel()
noise = np.concatenate([noise, noise, noise])
noise = noise[:length]

Stimulus = noise + Syllable

trial_sound.setSound(Stimulus, hamming=True)
trial_sound.setVolume(1, log=False)

I wish I could attach the syllable & noise files but they are .mat files & it won’t let me but this could be reproduced by just using arrays filled with random numbers.

Does anyone know why this might be occurring? Thank you! :slight_smile:

If the problem is with SoundPTB, you could try changing your audio library in the Preferences menu, so that it uses a different provider before PTB.

Are there any differences at all between this and the earlier code, even seemingly insignificant differences? Or are there systematic differences between the sound files?