Welcome!

Sign in with your CogSci, Facebook, Google, or Twitter account.

Or register to create a new account.

We'll use your information only for signing in to this forum.

Supported by

sampler duration: sound/keypress the first

Hi,

I have an experiment with auditory instractions as well as writen.
When I press a key to move to the next slide, if the sound did not finish, it's continue playing the two slides simultaneously.

How can I tell the sampler to stop when keypress?
Right now, I wrote keypress in the duration, and it moves to the next slide without stoping the audio.

Thanks,
Nachshon

Comments

  • eduardeduard Posts: 1,043

    Hi Nachshon,

    I recommend you don't use the sampler function to play back the sounds, but an inline_script. The procedure is quite straight forward. Put an inline_script before your instruction slide and put this code into the prepare phase of it:

    src = pool['sound.ogg'] #whatever your soundrecording is
    my_sampler = sampler(src, volume=.5)
    my_sampler.play()
    

    and then another inline_script after respective instruction slide with the single line my_sampler.stop() in the run phase.

    Does that make sense?

    Eduard

Sign In or Register to comment.