I need white noise as background music,but there is some jittered timing between different routine

I need white nosie as background music , so I set sound component in each routine.However, the white noise didn’t play continously between routines and when my feedback ton played each trial the volume of the white background noise decreased.
Except that when the background music in a trail is not long enough ,there is no sound anymore,how to make the noise or musci automaticly play again?

I’m hoping someone can help me find the way to solve these in builder.Or do I need another player to handle this?
Thanks in advance!

Thank you! I used the code you suggested and it worked well at the begining.Then it ddn’t work after few trials.
The error report said as followed:


I don’t understand for I have not set the volume yet. What should I do to solve this?
And may I ask how can I set the the volume of the backgroud sound to 70 decibels?

I’m not sure I can help with this one, but at a guess would suggest that you got to the “Audio” tab of the “Experiment Settings” dialog and change the audio library to “ptb”. Let us know if that changes anything.

You can’t set a physical sound level in software - all PsychoPy can do is to tell the computer to increase or decrease the volume level. The programme can’t tell how loud the resulting sound will be (e.g. you might be outputting to an external speaker that has its own additional volume knob on it, and the physical sound level naturally depends on where the subject is, relative to the sound source). To know what the actual sound volume level is, you’re going to need to use a dedicated sound level meter that can measure the sound that is actually produced where the participant is sitting.

@Michael I put the ‘PTB’ in the first oder on the library list, but it still didn’t work:sweat:


Shall we try something else?

You haven’t said what version of PsychoPy you are running - the PTB (Psychtoolbox) sound library was introduced relatively recently and has much better performance than the alternatives. So if possible, you download the latest release of PsychoPy and try that.

Yes,after I updating and changing the audio library, it finally worked.Thanks for sharing your solution!

Now I have new problems.I have two same procedures(different name), one is for formal expriment, and the copy one is for modification, At first, the copy one could play the background sound, but the formal one couldn’t. Here is the error report


I tried to put the formal one in different file or changed the background sond file name, it still coudn’t run.

Form the error message, it looks like you are using two sound files, one of which is recorded at 44.1kHz and the other at 48kHz. The sound backend doesn’t want to switch from one frequency to the other.

Open your files in a tool like Audacity and look at what frequency each is recorded at. Set one to be the same as the other.

I use Audacity and handle it now.Thanks for your advice again!