psychopy.org | Reference | Downloads | Github

Triggering follow-up audio in a drag-and-drop set-up

Hi all,

I’m very new to PsychoPy, so please bear with me (especially if this is a dumb question)!

I’ve set up a drag-and-drop experiment where, after listening to some instructional audio, the user drags a stimulus into another area on the grid. All good until this point.

Once they’ve dropped the stimulus into that area, there should be another audio file triggered to instruct them to do something else with that object. I’m having trouble figuring out how to trigger this audio - the area is quite large, so there is space and I can’t trigger it based on a specific location within the screen. Is there another segmentation method available here?

Thank you!

Yes, many. e.g. you could calculate the Euclidean distance between some central point and trigger the sound if it lies within some threshold value of that, or any of a number of other ways. But that effectively sets up circular regions on the screen, which can’t overlap, and which will then necessarily have dead-zones in between them. If a grid based system is in place, then you could just be checking if the mouse location is greater than some left hand boundary while also less than some right hand boundary, and similarly for its upper and lower boundaries.

We can’t really give much useful advice without knowing more about the specifics of your task.

Thanks for your answer, Michael. I’m working with a grid system (i.e., moving an object in one box to another), so setting boundaries sounds like a great solution. Whether it’s the correct object or not is irrelevant - as long as one of the objects is set within those limits, that second audio should start.

Does that make sense?

The ideal thing to do would be to insert this in the code you use for dragging your stimuli. i.e. when the stimulus is released, run the check then to play the audio.

If there are target stimuli on the screen (e.g. representing the boxes in your grid), then the check can be done without any maths at all, just by checking whether each stimulus contains the current mouse position.

So perhaps post your dragging code and a screenshot of what stimulus components you have, and we can work with that.