| Reference | Downloads | Github

Start position of a sound file

OS: Win 8.1
PsychoPy version: 2020.1.3
Standard Standalone: yes
What are you trying to achieve?:
I have a 6 min sound file. I want to play different segments of the sound based on
specific start positions and end positions (e.g., 10s to 25s of the sound for a trial,
34s to 60s of the sound for the next trial etc.).

What did you try to make it work?:
I have created the sound_file variable and set at every repeat. I have also made
“Start” and “Stop” as variables. However, the “Start” option (e.g., 10s) does not mean to
play the 10th second of the sound, but means to play from the start of the sound after waiting for 10s.

What specifically went wrong when you tried that?:
I’m wondering if there is a way to indicate the start position of the sound file so that psychopy can
play the long sound file from certain position (e.g., 10s of the sound) of it?
I have tried to google the question for several hours but cannot find a answer for this.
I appreciate if you can help.

Try Googling the .seek() method.

Unfortunately I don’t think it works online.

Thank you very much for the hint! I saw that there is a attribute for the start timestamp. But not sure if there is such an attribute for the sound. It seems that it’s not possible to implement this using Builder? In E-Prime, there is an option of start position and end position that you can directly specify timing so I thought may be it’s an easy implementation in Psychopy too, but it appears that some custom code would be needed here.

Sorry if I sent you on a wild goose chase. I’ve made this mistake before.

The suggested solution is to chop the sound into segments.

1 Like

Thank you very much! This is definitely a workaround solution! I hope psychopy can add the feature of start position for sound in future release.