September 10, 2020 at 5:35 pm #6070
I am trying to program a picture naming experiment. A server set up has been completed, and zipped files are successfully sent to my server. However, an error message such that “a zip file is empty” has appeared when I tried to open the sent files. Do you know what I should do with this issue?
Here is my coding. (Following is a simplified version. I am going to have three picture naming blocks with three practice items instead of one.)
Sequence( "intro", "init", "picInt1", "pracPic1", "Pic1", SendResults(), "bye" ) InitiateRecorder("https:*************") .label("init") newTrial( "picInt1" , newText("TEST: Name pictures as quickly and accurately as possible.") .settings.css("font-size", "2em") .print() , newTimer("picInt1", 1000) .start() .wait() , newKey(" ") .print() .wait() ) newTrial( "pracPic1" , newImage("feather.png") .print() , newKey(" ") .wait() ) newTrial( "pracPic1" , newImage("vacuum.png") .print() , newKey(" ") .wait() ) newTrial( "pracPic1" , newImage("bat.b.png") .print() , newKey(" ") .wait() , newMediaRecorder("recorder", "audio") .log() .record() ) Template( "PicList1.csv" , row => newTrial( "Pic1", newImage("PictureFile", row.PictureFile) .print() , newKey(" ") .wait() ) ) newTrial( "bye" , newText("<p>Thank you for your participation!</p><p>You have successfully completed all of the tasks.") .settings.css("font-size", "1.7em") .print(), newButton().wait() ) .setOption( "countsForProgressBar" , false )
In my coding, I attempt to start recording from the first experimental trial, not the practice items. It sends a zipped file to my server, but I cannot open it just because it is “empty” somehow. Could you please suggest me what to do with this issue?
Also, as I mentioned above, the experiment has two more picture naming blocks with practice items. Is there a way that I stop recording after one block and start recording when the second block starts? (meaning that it will not record their break time and practice items.)September 10, 2020 at 6:06 pm #6071
EDIT: sorry, I misunderstood what you were trying to do. You want to record during the Pic1 trials, not during the praPic1 trials. Just adapt the code below to the content of the Template command that you already have in your script (the one on "PicList1.csv"), changes should be minimal.
So you only have one practice trial that tries to record anything at the moment, the last one, and it doesn’t have time to do so because it reaches the end of the trial immediately after starting to record. Since you seem to want to use the same template for all your practice trials, let’s embed them in a Template command too:
AddTable("practice", `Image feather.png vacuum.png bat.b.png`) Template( "practice" , row => newTrial( "pracPic1" , newImage( row.Image ) .print() , newMediaRecorder("recorder", "audio") .record() .log() , newKey(" ") .wait() , getMediaRecorder("recorder") .stop() ) .log( "Image" , row.Image ) )
Of course I’m just using AddTable here because I can’t upload a CSV file to your project myself, but you should use an external CSV file rather than directly writing your table in the main script like that.
As a general rule of thumb, it’s a bad idea to try to record audio/video across trials (I’m not even sure it will work anyway) that’s why you should call stop before the trial ends, as in this example. This way, you’ll have one audio file per trial in your zip file. Take a look at UploadRecordings if you want more control over when the files are sent to the server
Let me know if you have questions
You must be logged in to reply to this topic.