File Error Handling Behavior

PennController for IBEX Forums Support File Error Handling Behavior

This topic contains 4 replies, has 2 voices, and was last updated by Avatar dgetty 2 weeks, 6 days ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #6870
    Avatar
    dgetty
    Participant

    Hi hi,

    I’m running a picture description task with auditory primes. The stimuli are pre-loading just fine for most people, but I’ve had one participant experience an issue where an audio file would not load. I’ve ruled out a filename error, so the only thing I can think of is that maybe their connection made it such that pre-loading went very slowly.

    Since most of the other files loaded and played just fine, I’m wondering if there’s a way to add error handling behavior, where PCIbex will just skip an audio trial if it doesn’t load (e.g. maybe after 5 secs or so). I would also like to be able to write this error to the results file, so I know exactly where it occurred. Is something like this possible? Or is there a better way to handle this issue?

    Thanks!

    -Doug

    • This topic was modified 3 weeks, 2 days ago by Avatar dgetty. Reason: typo
    #6872
    Jeremy
    Jeremy
    Keymaster

    Hi Doug,

    PennController should already report when a resource fails to preload in the results file: look for lines with “_PreloadFailed_” in them, they also report the name of the resource

    You could run a Function element at the beginning of your trial and end it prematurely if the resource’s status is not “ready”:

    newFunction( ()=>getAudio("file.wav")._element.resource.status )
        .test.is("ready")
        .failure( end() )

    replace "myAudio" with the name of your Audio element

    Let me know if you have questions

    Jeremy

    #6873
    Avatar
    dgetty
    Participant

    Thanks Jeremy! That’s working perfectly now.

    Two quick follow up questions:
    1) is there a way to shorten the length of the time that the pre-loading screen takes? I call CheckPreload() before the experimental trials begin, and I’m totally fine with that being a 60 second pause. But is there way for later pre-loading messages to only last for maybe 3-5 seconds before giving up and quitting on the current trial?

    2) Is there some place I can read about/figure out tricks like the function you wrote in your previous response? For example, it never would have occurred to me to check “._element.resource.status”, and I don’t see that in the documentation anywhere. Just trying to learn to be more self-sufficient with these things.

    Thanks again!

    -Doug

    #6874
    Jeremy
    Jeremy
    Keymaster

    1) You can use .setOption("preloadDelay", 5000) on the closing parenthesis of newTrial

    2) These two tricks (._element.resource.status and 1 above) are actually pretty advanced, albeit concise. This is because it didn’t occur to me to make those things customizable. If you’re interested, you can take a look at PennController’s source code and try to hack it out 😉

    Jeremy

    #6875
    Avatar
    dgetty
    Participant

    Thanks, Jeremy! I may try to do that first next time 🙂

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.