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)
else:
    S_index = np.random.choice(syl_list)
                
R_index = int(S_index)
Syllable = stimuli_array[R_index,:]
Syllable = Syllable.ravel()
        
# SELECTING RANDOM DELAY.
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])
            
# LOADING NOISE
filename = (str(2) + '.mat')
noise = scipy.io.loadmat('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?

Hi. I have similar problem. I try to create a set with pure note sound. The set is calling randomly A or B sound. There is no problem without waiting between notes but, if I try to add any latency with builder interface(Start section) same problem occurs. No pyo and sounddevice libraries installed. I tried it with pygame and my own sound sample, and also using different waiting time but I can’t solve the problem.
Set is only working at initial condition/default mode of sound. All of these gave me same result.
Before I used the 2022 2.5 version and I tried this version in preferences. Also I also tried it by reinstall the program.
Probably, I am missing a basic thing but I couldn’t find. Could you help me?