Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Saving multiple files within one Worker

edited April 2020 in JATOS

Hello! I'm attempting to save multiple (potentially a rather large number) of wav files per participant. Is there a way to do this, or will it require that I save the raw audio data once and keep appending new data to it, then convert that to wav and parcel out each trial?

Also, I'm still in the process of trying to convert blobs to wav, so if anyone has any comments on how to do that in the context of then saving them individually to JATOS, they would be much appreciated! At the moment, it simply saves them into URL's that I then can't access, presumably because the JATOS docker (I'm using DigitalOcean and a private domain) stops me from doing so?

Comments

  • Hi!

    It's not clear to me whether you want to load those wav files into your experiment or upload them from your experiment to the JATOS server? If it's the latter one, there is an example study 'Video Recording' that does this (https://github.com/JATOS/JATOS_examples/raw/master/examples/video_recording.jzip), but only with one file, no with many.

    Another thing I don't understand yet, is that it 'saves them into URL's'. Anyway, JATOS (since 3.5.1) has the possibility to upload files http://www.jatos.org/Submit-and-upload-data-to-the-server.html.

    And for the wav format: I would not recommend to use wav format. It's just to big. I'd rather use some compressed format to save bandwith and more importantly time during download or upload.

    Best,

    Kristian

  • Hi Tres and Kristian,

    Just wanted to jump in here because I'm working on the same issue - trying to save (upload) multiple audio files per participant/component.

    Kristian, I didn't know about JATOS' uploadResultFile function - looks very useful, thanks! I have the same question as Tres about this: is it possible to upload multiple files per participant/component (i.e. sending the file from experiment to server)? Or just one? We're both working on experiments that use audio recording, and we need a way to send the audio data back to the JATOS server. The task is made up of several trials, so there will be lots of (small) audio recordings to send back. And like you said, the video recording example shows how to do this with one file (works great!) but we're not sure if this can work with multiple files?

    Tres, WRT your question about converting blobs to audio files, have you seen this post?: https://medium.com/jeremy-gottfrieds-tech-blog/javascript-tutorial-record-audio-and-encode-it-to-mp3-2eedcd466e78 So I think the problem is that, even when the Blob type is specified as something like 'audio/webm' or 'audio/mpeg-3', it still needs to be converted into a .wem or .mp3 file. I agree with Kristian that it would be better to convert the Blob into a compressed format like mp3 in JavaScript, before sending back to the server, but I'm not sure how to do this yet.

    Becky

  • Hi Becky, Hi Tres!

    you can upload multiple files with jatos.uploadResultFile. This feature was added to JATOS not long ago, with version 3.5.1 (so make sure to update both your local JATOS and your server). In 3.5.3 jatos.js got another update that mostly affect submit/append result data but also uploading result files: they are done in a background worker now and you don't have to care for them finishing (with callback functions or promises) before doing something else, e.g. going to the next component - jatos.js waits automatically until all result data and files are sent before moving on. This was especially a big problem with OSWeb but makes other experiments easier too. But anyway, all versions since 3.5.1 can handle multiple file uploads in the same component.

    What you have to pay attention to is the normal stuff when it comes to file uploads/downloads in the internet: they can take some time if they are big and the connection is slow. So you experiment can run nice and swift on your local JATOS, but then when you move to your JATOS server it gets laggy and this causes other problems like annoyed participants reloading the page. I'd recommend a feature from the Chrome browser to get a hunch of how your study will behave in the wild wild world: you can simulate the network connection, e.g. a slow 3G mobile phone connection.

    Best,

    Kristian

  • Hi Kristian,

    Thanks very much - this is super helpful! I haven't had a chance to try this yet, but when I do I'll let you know if I have any problems.

    Thanks again,

    Becky

  • I'd appreciate that :)

  • Following up on this post from my first attempts at writing javascript -- the answer was in making a dynamic name for the files, so each WAV file I posted was named differently and didn't overwrite the first. Something like

    filename = "name" + dynamicvbl + ".wav"

    Thank you all again for your help!

Sign In or Register to comment.