June 12, 2020 at 3:15 am #5628
I have a csv file with (among other things) a list of names of audio files I want to use in my experiment. The audio files themselves are stored on Backblaze B2, and I think I have successfully preloaded the zip file from there.
The problem is when I run newAudio(“Sentence”,row.AudioFile) within the Template controller, the mp3 files won’t play. The error I get in the JS console is: “Failed to load resource: the server responded with a status of 404 ()”, and it has this for every audio file in the csv, as well as one “GET https://expt.pcibex.net/favicon.ico 404” error.
Interestingly, when I replace “row.AudioFile” (without quotations) with an audio file name like “3-16-3.mp3” (with quotations), it will play the audio and use the csv to randomly grab task questions, but will still produce the same error in the JS console for whatever file I typed in and (of course) only play that one audio file for every trial.
The fact that the single trial can play any of the mp3s from the zipped file seems to indicate to me that this is not a CORS issue or an issue accessing the zip in anyway, but is rather an issue with how I am referencing the audio file or csv or something? What do you think? The relevant section of code is below.
Sequence(randomize(“auditoryexperiment”)) Template("PCIbexStimuli.csv", row => newTrial("auditoryexperiment", newText("crosses","+++").settings.css("font-size","32px").print(),newTimer(300).start().wait(), newAudio("Sentence",row.AudioFile).play().wait(), getText("crosses").remove() , newText("AudTask",row.AudTask).center().settings.css("font-size","32px").print(),newText("<br>").print(), newCanvas(600,200).center() .add("center at 20%", 0, newText("ResA",row.ResA).settings.css("font-size","24px")) .add("center at 80%", 0, newText("ResB",row.ResB).settings.css("font-size","24px")) .print(), newSelector().add(getText("ResA"),getText("ResB")).keys("F","J").log().wait() ) .log("ID",getVar("ID")).log("Mod","Auditory").log("Group",row.Group).log("SenList",row.SenList).log("SenNum",row.SenNum).log("SenCon",row.SenCon).log("CorRes",row.CorRes) )June 12, 2020 at 4:22 am #5632irenecgParticipant
Hi! Not sure I can help, but, do you have quotations in your list? I had the same problem until I realized that I didn’t need quotations in my .csv list…June 12, 2020 at 9:52 am #5633
Thanks so much for the suggestion! Actually, thanks to your comment, I was able to figure out what the issue was! It didn’t actually have anything to do with the quotation marks (I didn’t have any and I had also tried adding them in just in case, which of course didn’t help). However, your comment got me thinking that if you had the same problem, but the origin of it was in your csv file, then the origin of my problem might be in my csv file too. Prior to that, I had been working under the assumption that I’d made a coding errors within PCIbex (because I do make a lot of coding errors in PCIbex). As it turns out I made a coding errors in Python when automating the process of creating the csv file for PCIbex use. Ultimately, I slightly misnamed all of the filler sentences.
I’m still getting some of the same kind of error, but there are far fewer of them and I think it’s all just different variations of the same misnaming issue.
Anyway, I feel silly for posting on this forum when it was such a careless mistake, but at the same time, your comment helped me spot my error, so thank you so much!! XDJune 12, 2020 at 12:48 pm #5634
Glad you were able to solve the issue
Just a comment to say that the 404 messages are expected: PennController tries to locate the resources at different locations, starting with the experiment’s host, and from within the zip file in parallel. The 404 responses just inform you that the resources are not located on the experiment’s host
JeremyJune 13, 2020 at 9:09 am #5637
What a relief; thanks so much for letting me know! (Who knows how much time I would have spent trying to get the error to go away…) Well, I guess everything is working smoothly now! Thanks everyone!
DanielApril 11, 2021 at 7:43 am #6852gzlkjParticipant
In my experiment I have over 800 audio files (in total for 8 groups) and the preloading messages would get in the way of the trials frequently, so I ruled out the option of loading the files from the pcibex resources completely, and I decided to use the PreloadZip as it was recommended. I know the zip files are downloaded without a problem because the message comes up in the log section of the debugger. Also, if I try to load them individually with a filename in quotation everything is fine. So far I think I’ve been having the same exact problem, except I really tried to find a misspelling or typo in any of the rows of the csv, but it seems like I can’t find any mismatches in the filenames.
I cloned the experiment yesterday, and it seemed to be working fine in the new slug at first for a couple of times. I made it to the end and all trials loaded successfully, but now I get this error in the console of the developer mode (after the preloading message stays on the screen for a while): “Uncaught (in promise) TypeError: this.resource.object is null”. Furthermore, I even tried different devices with different IPs and the problem persists.
I was assuming it has to be the server I’m using to host the zip files, that maybe it gives connection timeouts after trying to access it repeatedly in a short time… but if they’re downloaded completely, it surely can’t be it? I was really having a hard time detecting the cause of the problem, so I can fix it before distributing the link to participants. Any ideas where the root of the problem might be?
Thank you so much for your time!
This is a link to the test experiment, just in case.
-ZaraApril 11, 2021 at 3:48 pm #6853
I am sorry you are experiencing issues with PennController’s resource-preloading system. We received a note about this issue once before, and were unfortunately unable to identify the cause of the problem. I was able to replicate the issue with your project once after reloading it a few times, and was never able to reproduce it after that despite reloading it tens of times. The elusiveness of this bug just makes it harder to troubleshoot
I am not sure the issue is related to manually-typed vs table-fed filenames, it could be that the problem never occurred for manually-typed filenames by chance. It certainly has something to do with zip files though. I have an idea of what is happening, although I am not quite sure how/why it’s happening. In the meantime, would you mind downloading this PennController.js file and replacing the one from your project’s Modules folder with this one? I tried it with a copy of your project and it seemed to work OK, but if you give it a try, please do a few test runs and let me know if you notice any issues
JeremyApril 12, 2021 at 11:50 am #6858gzlkjParticipant
Thank you for taking the time to try to look at this issue I was facing. I really appreciate it.
I am still a bit lost as to what’s causing this, firstly I just replaced the pencontroller.js file with your suggestion, but It apparently it didn’t change anything.
Next I tried compressing the audio files in .zip with another software since you mentioned that it could have something to do with the error. I think that wasn’t effective either, and I could still get the same error.
I also thought of changing the server address for the last resort and that seemed to be working much better although when I asked some friends to pilot it, some still reported the long preloading message and no trial after that again.
Although my audio files are very light, but there are too many of them and I don’t think it’s plausible to use the same-site resource option.
I presume this issue is not very common? I just wished It was easier to tell what’s making the resource preloading in my experiment behave this way before I publish the link for recruiting, so I at least know what I should be fixing.
ZaraApril 12, 2021 at 12:01 pm #6859
Did you go back to the previous version of PennController.js on the project that you shared in your previous message? Because when I open it I still see the old version.
I am still unable to reproduce the issue, but at least one thing that I hoped would have changed with the new PennControlelr.js file is that, even when you see a preloading message, the error message “Uncaught (in promise) TypeError: this.resource.object is null” should have disappeared. Do you still see this message even after replacing the file PennController.js from your project’s Modules folder?
I don’t think this problem has something to do with the software you use for audio compression. I think it might have something to do with the browser’s caching of the zip/audio files. I don’t think it’s related to the server on which the zip file is hosted in any direct way, but it could be that using a different server forces your browser to not use its cache and reload the files instead, which (if my guess is right) would make the problem disappear at least the first time you take the experiment after switching to a different server
- You must be logged in to reply to this topic.