Audios Files not playing all the way through, then experiment quits

OS (e.g. Win10): macOS 10.15.3
PsychoPy version (e.g. 1.84.x): v2020.2.5
Standard Standalone? (y/n) If not then what?: y
What are you trying to achieve?:

Hello! I’m a beginner to PsychoPy working on an experiment in which the participant should hear one of 8 audio files and then answer a series of questions specific to that audio file. Currently, when I run the experiment, around 10-15 seconds of the audio file will play and then it will quit the experiment with no error message.

My current routine and conditions file is included below -
each prompt file contains 12 questions with the participant given the option of clicking the left arrow for true and right arrow for false. Let me know if I need to elaborate on anything. Thank you!

Hi There,

Your flow and conditions file all look simple and correct to me there. Some things to try:

  1. Does it do the same for other audiofiles.
  2. is there a specific time it cuts out? (add a timer to your experiment by adding a text component to your ‘Audio’ routine and in the ‘text’ field use $AudioClock.getTime() and ‘set every frame’

Are you able to please sync the project with pavlovia and then share the URL to the project with us (this will allow us to look at your files).

After syncing/creating a project on pavlovia, you would need to navigate as follows to give us access:

Dashboard>Experiment>Select Experiment you want> View Code <> Settings (left hand tool bar, image of cog) > Permissions > Public

Thanks,
becca

Hi Becca,

Thank you! The url to the piloting experiment is here: https://run.pavlovia.org/Eperel/memory-bias-experiment/html/?__pilotToken=c4ca4238a0b923820dcc509a6f75849b&__oauthToken=eca4be1360f5f3a086191499edeabd9fb212bfb291874f963c83f70561494904 and the url to view the files is here: https://gitlab.pavlovia.org/Eperel/memory-bias-experiment

I apologize for all the files present! I populated them all by mistake but the relevant ones for the memory bias experiment are in the “memory bias” folder. Let me know if this helps at all!

Best,
Emily

Hi Emily,
Thanks for sharing this, to help me navigate the problem please could you let me know which .psyexp file you are primarily working from at the moment? :slight_smile:
Becca

Hi Becca,

Yes! The file is titled “MemoryBiasBuilder_v2.psyexp” and it is in the folder titled “Memory Bias”. Let me know if that helps!

Best,
Emily

Hi Emily,

Currently it sounds as though the audio plays fully through here, but I did get the error ’ * ReferenceError: Questions is not defined’ Is this the point at which you were at as well?

Becca

Hi Becca,

Thank you for taking a look! When I run it on my computer, it has now started quitting before the audio even plays. But, when I run it on pavlovia, the audio plays but the questions fail to appear after.

I haven’t gotten that error message, presumably because my experiment doesn’t get to that point. My goal for the experiment is to have the participant receive one audio and one set of questions (named prompt + “the corresponding audio number” in the folder). I have tried to do this by leading Psychopy to the file paths of the questions and the corresponding audio file in the “promptorder.xlsx” file. The questions variables are then defined in the seperated prompt files. Is there any different way of organizing the files to get the desired effect that you would recommend? Let me know if you need me to describe anything further and thank you so much again!

Best,
Emily

Hi Emily!

I think Ive been working from the right file here, but at the moment it is a bit tricky to debug because it seems you might need to adjust the sampling rates of your audio files.

The project I have been working from is here https://gitlab.pavlovia.org/lpxrh6/memorybias_debug
The error I ran into above is because there is actually a psyexp file outside of the MemoryBias folder with an identical name - and it seems that is the file your pavlovia project is actually using.

I can’t currently run this locally as I get the error outlined here Audio file loop is not working so you may need to edit your sound files (it is possible that may resolve your original issue)

Could I also suggest checking out the online crib sheet for recommended sound formats for online https://docs.google.com/document/d/13jp0QAqQeFlYSjeZS0fDInvgaDzBXjGQNe4VNKbbNHQ/edit

Let us know how you get on,
Becca

Hi Becca,

Thank you so much! I cleaned up the files and updated the project here, so hopefully pavlovia is now using the correct file: https://gitlab.pavlovia.org/Eperel/memory-bias-experiment

After reviewing the doc I changed the audio file formats to .mp3 and took out the sound duration in the property window. I also checked to make sure the audio files are all cut to the proper length. Although, when I run the experiment in Pavlovia I still have the same issue of the experiment not continuing after the audio loops once. If it’s not pulling the proper questions because it can’t locate the $questions variable in my folders do you have any suggestions on how to lead it to that path? Thank you so much!

Best,
Emily

Hi Emily,

Apologies if I have the wrong link here - but the sound files in this folder still appear to be in .wav format.

Please can I clarify this repository is the most recent version with edited sound files?

Thanks,
Becca

Hi Becca,

When I look at the audio files in the memory bias experiment folder via my previous link I’m seeing them as .mp3. Here’s a more direct link: https://gitlab.pavlovia.org/Eperel/memory-bias-experiment/tree/master/MemoryBias/audiofiles

Do they look okay there?

Best,
Emily

Thanks emily, my mistake - I must have used the old repo - let me take a look

Hi Emily,

This was an interesting one, but this should now work: https://pavlovia.org/lpxrh6/memory_bias_debug

First I had a difficulty running the task locally, I think it was that python on windows couldn’t play these sound files because they were compressed for some reason (so I converted them all to wav, again, sorry, using audacity) - this got the task running locally for me.

Following this I was at the same point you describe, the sounds cut short. This seems to be a bug and I will log it on the github. For now, a work around is instead to use a code component to present the sound (see ‘code’ in your ‘Audio’ routine). This is currently set to be codetype ‘both’ because I needed to change some JS code to get this working online. In short, the python code is:

Audio_File = sound.Sound(AudioFile, secs=-1, stereo=True, hamming=True,
    name='Audio_File')
Audio_File.play()

and the JS code is


Audio_File = new sound.Sound({win: psychoJS.window, value: AudioFile, secs: (- 1),});
Audio_File.setVolume(1);
Audio_File.play();

This should play the whole sound file for you now. let me know if this solves your problem :slight_smile:
Becca

Hi Becca,

Thank you! When I run the experiment through Pavlovia I’m able to hear the whole Audio but my issue is that it won’t go onto the next questions section because it says $questions is not defined. If it’s not pulling the proper questions because it can’t locate the $questions variable in my documents do you have any suggestions on how to lead it to that path? Thank you so much!

Best,
Emily

Hi Emily,

Aha I should have mentioned, the debugged version should have that corrected too (I think the initial ‘Prompt’ column was looking for xlxs rather than xlsx files - so I corrected that typo and now it should get the questions no problem)

Let us know if the URL above works close to what you expect :slight_smile:

Becca

Hi Becca,

Thank you so much for catching that! Unfortunately I still get the “Question not defined” message when I run the experiment even with the corrected file endings.

To try to get it to work I tried replacing conditions section on then Trials Loop with the a couple different things:

$Prompt (the one included in your link)

$Prompt + “.xlsx”

$PromptOrder.xlsx

unfortunately all of these led to the same error message. Let me know if you have any ideas and thank you again for all your help!

Best,
Emily