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
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:
Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
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
Hi Maria,
Normally
inline_script
s 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