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

sound files not playing on the tablet

Hi,

I have designed an experiment in which the participants look at some images and then listen to a voice (either male or female) and indicate whether the voice is male or female by pressing on a corresponding image. Once they pressed on the image, the sound stops. The experiment runs fine on the PC but when I try to load it on the tablet (a samsung galaxy Tab S2) the sound files don't run. The back-end is set to droid. The resolution is 1280 x 800. The sound files are .ogg (.wav for some reason doesn't run in OpenSesame on the PC). If I remove the sound files, the rest of the experiment runs fine.
This is my design:

Loop:
sound_nr gender sound
1 female hallof.wav
2 male hallof.wav

Inline script:

if var.gender == 'female':
var.correct_response = 1
elif var.gender == 'male':
var.correct_response = 2

fixation dot using sketchpad

Inline script:
import pygame # import modul
pygame.mixer.init() # initialize mixer (doing this once might be enough)
sound_file = exp.get_file(var.sound) # load the sound file of a single trial
sound = pygame.mixer.Sound(sound_file) # create an instance of the sound
sound.play() # play the sound

picture on a sketchpad
touch_response

Inline script:
sound.stop()

feedback_correct on a sketchpad
feedback_incorrect on a sketchpad
logger

I very much appreciate any help!

Kind regards,

Maria

Comments

  • It acutally runs when I use a sampler item. I followed the cats, dogs, capybaras tutorial. However, I want the sound to stop once the participant had clicked on the image (male or female). How do I do this?

    Many thanks,

    Maria

  • sebastiaansebastiaan Posts: 2,737

    Hi Maria,

    I think the fact you were initializing the mixer again (OpenSesame already does that) caused the issue. If you want to stop playback from the sampler, you can simply use:

    import pygame
    pygame.mixer.stop()
    

    Cheers!
    Sebastiaan

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • Hi Sebastian,

    Thank you for getting back to me.
    The issue is that Inline script doesn't seem to run on the tablet. The experiment just terminate. Therefore, I can't make the sound stop. Is there another way to do this? Or, why doesn't inline script run?

    Cheers,

    Maria

  • eduardeduard Posts: 875

    Hi Maria,

    Normally inline_scripts do run on tablets, so something weird is going on. Is there an error message when you try running it? Can you post it here?

    Eduard

Sign In or Register to comment.