zipped audio files

Home Forums Support zipped audio files

This topic contains 8 replies, has 2 voices, and was last updated by Jeremy Jeremy 4 months, 1 week ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #2805

    roberto

    Hi,

    I need to use a zipped folder of audio files for my Ibex/PennController script and I have a few questions.

    1. Are wav files supported? The on-line documentation refers to ogg files (which are not supported by Safari) and mp3 files (which seem to be more widely supported), but I could find no mention of the wav format.
    2. The tutorial says that a FTP server is required to use zipped folders. That means that file sharing services (GDrive, Dropbox, etc.) won’t be of any use. I have no server I could FTP-upload my files – Is there any alternative way to do this?
    2′. From what I could understand from the tutorial, one could potentially refer to GDrive/Dropbox (unzipped) folders in the script. I have tried to do that as well, but the audio files wouldn’t play either.

    Many thanks in advance for your help!
    -roberto

    #2808
    Jeremy
    Jeremy
    Keymaster

    Hi Roberto,

    1. Thank you for this question and you feedback about the documentation, I have added a link to an external page listing audio support in HTML5. You surely can use WAV files, which actually appear to be compatible with the most browsers.

    2. There currently is no alternative to using your own servers, since download takes place automatically in the background (as opposed to manually, at the initiative of the participant) which requires the servers where the ZIP file is hosted to grant the domain where the experiment is hosted (e.g. spellout.net) such automatic distant access to your ZIP file (e.g. using a .htaccess file, as described in the documentation).

    2′. I am sorry if the documentation is unclear: one cannot refer to GDrive/Dropbox folders, but one can directly refer to GDrive/Dropbox files directly (and inidividually) as long as they have a public-access URL. With Dropbox, you can click “Copy Link” next to the file you want to use and replace the ?dl=0 bit at the end with ?raw=1 and use the URL in a newImage, newAudio or newVideo command.

    Let me know if you have further questions or requests.

    Jeremy

    • This reply was modified 6 months ago by Jeremy Jeremy.
    #2810

    roberto

    Thank you for your reply, Jeremy. This is very helpful.

    We are in the process of getting access to a server, I will let you know if we run in any problems.

    Thanks again!
    -Roberto

    #2820

    roberto

    Hi,

    my code makes use of both PennController.PreloadZip() and PennController.Template(). Basically, what I want PennController to do is, preload the zip from a folder in my server (where there is also the system file .htaccess as explained in the tutorial) and play the files in the zip by referring to the row of my csv file (uploaded in the chunks_includes directory. Here is an excerpt of my code:

    
    PennController.Sequence( "intro", "instructions", shuffle(randomize("exp"), startsWith("filler_question")), "exit", "send" );
    PennController.ResetPrefix(null);
    PennController.PreloadZip("https://sprouse.uconn.edu/downloads/syllabicity/mixed.zip");
    PennController.CheckPreloaded();
    
    // FURTHER PROPRIETIES OF THE HTML PAGES
    
    [...].
    
    // PENNCONTROLLER TEMPLATE
    
    PennController.Template(
        row => PennController("exp",
                   newText("intro", "Press PLAY to listen to the audio. You can listen to it only once.")
                              .settings.cssContainer("margin-bottom", "10px")
                              .settings.center()
                              .print()
        ,
        newAudio("sound", row.Item)
              .settings.cssContainer("margin-bottom","20px")
              .settings.center()
              .print()
              //.wait("first")
        ,
        getAudio("sound")
             .settings.disable()
         ...
        )
      )// Call .log 
          .log("sound", row.Item)
          .log("Prime", row.Prime)
          .log("PrimeCompressType", row.PrimeCompressType)
          .log("PrimeCompressValue", row.PrimeCompressValue)
          .log("PrimeOnset", row.PrimeOnset)
          .log("BwmOnset", row.BwmOnset)
          .log("condition", row.condition)
    );
    

    This does not seem to work (the audio files won’t play). Any idea of why it is so?

    thank you in advance!
    -roberto

    #2821
    Jeremy
    Jeremy
    Keymaster

    Hi Roberto,

    When I try to use your PreloadZip command with the URL that you give, my browser gives me a CORS error, suggesting that there might be a problem with your .htaccess configuration. Did you make sure that the .htaccess file is in the exact same folder as your zip file? (i.e. https://sprouse.uconn.edu/downloads/syllabicity/)
    Also, did you check that your file is indeed named .htaccess and has no extension that could be hidden when you’re browsing your files? For example, if you created it using a text editor, it could be that its actual name is .htaccess.txt. The initial . is necessary as well.

    A note on PennController.CheckPreloaded: this command creates a trial labeled unlabeled by default. You must indicate when in your sequence the CheckPreloaded trial should appear (i.e. at what point in the experiment it becomes crucial that the resources are preloaded before proceeding). If you want to use a specific label, use the label command.

    #2843

    Maxime

    Hi!

    I run into the same problem. I have all files uploaded on my website but this takes a lot of seperate pre-loading and the files are played with a stutter. So I wanted to try if loading from a .zip would improve this in any way. However, when I follow the instructions (upload zip, add .htaccess) preloading doesn’t seem to work (audio files are not played).

    Here below is a simplified version of my script, you can see that loading files separately (commented out now) works fine and plays my audio. Am I missing a step? (I also tried adding the checkpreload thing, but a) I don’t think it’s related and b) it doesn’t seem to change anything).

    PennController.ResetPrefix(null);
    //PennController.AddHost("http://maximetulling.com/wp-content/uploads/2019/05/");
    PennController.PreloadZip("http://maximetulling.com/cantonese_perception_stimuli/Stimuli.zip");
    
    //Introduction screen
    
    PennController("Trial",
        newText("context_text", "THIS IS WHERE CONTEXT TEXT SHOULD BE [講嘢嘅人知道個答案。]")
            .print()
        ,
        newAudio("context_sound", "t1_c1_isq.wav")
            .play()
            .wait()
        ,
        newTimer("ISI", 500)
            .start()
            .wait()
        ,
        getText("context_text")
            .remove()
        ,
        newText("listen", "listen")
            .print()
        ,
        newAudio("intro", "t1_c1_p0_d250.wav")
            .play()
            .wait()
        ,
        getTimer("ISI")
            .start()
            .wait()
        ,
        getText("listen")
            .remove()
        ,
        newText("Question", "[How natural does this utterance sound in this context?")
            .settings.center()
            .print()
        ,
        newScale("judgment", 100)
            .settings.slider() // Slider scale   
            .settings.log()
            .settings.center()
            .settings.size( 200 , "auto" )  // 200px wide
            .settings.before( newText("Ans1", "Very unnatural") )
            .settings.after(  newText("Ans2", "Very natural")   )
            .print()
            .wait()
        ,
        newButton("validate", "验证")
            .settings.center()
            .print()
            .wait( getScale("judgment").test.selected() )
    ); 
    #2844
    Jeremy
    Jeremy
    Keymaster

    Hi Maxime,

    The website for PennController has moved to https://www.pcibex.net/ where you can find the new forums.

    If you host your IBEX experiment on a server with a secure domain (e.g. https://expt.pcibex.net/ ) then some browsers will block automatic access to your ZIP file, which is hosted on a non-secure domain (http instead of https).
    You can either host your ZIP file on a server with a secure domain or proceed to secure your own domain (there are many solutions available for free—for example pcibex.net uses a proxy with Caddy)
    Another, dispreferred solution is to host your experiment on a server with a non-secure domain, e.g. http://spellout.net/ibexfarm/.

    When I run your script on my localhost (which imposes no secure-domain restriction) your script runs smoothly.

    Note also that the first audio in your script might not play on some browsers, since the play command gets executed before any interaction (such as a click or a key press) took place on the experiment’s page.

    • This reply was modified 4 months, 2 weeks ago by Jeremy Jeremy.
    #2846

    Maxime

    Hi Jeremy,

    Thanks for the info (and in the future I’ll use the updated website)!
    You say the zipped version worked on your unsecured browser?
    Because I had no clue there was PCIbex (and everything was thus hosted on the non-secure ibex spellout domain, so with that logic it should have worked already from the beginning). I now also secured the domain storing the zipfile, and tried moving the experiment to PCIbex, trying out all the combinations of secure-unsecured, but I keep having the same problem – it works fine loading the separate files (autoplay is enabled on my browser) but doesn’t allow for playing through the zipped file.

    Is there any other difference between what I’m doing and what you were doing on your localhost to load from the zip file? Do you need to enable something in order to be able to load from a zip file maybe? I though first maybe it was a mac/windows difference but I now checked it on both and the script I pasted above still doesn’t work on either (but the non-zip verison does on both).

    #2848
    Jeremy
    Jeremy
    Keymaster

    Hi Maxime,

    I didn’t do anything special, really. Can you open this page and paste and try your script (just make sure to update your PreloadZip command with https): https://expt.pcibex.net/ibexexps/example/example/testData.php

    If it doesn’t work, it probably means that the problem comes from your local configuration, since it works for me. I also tested it with a dedicated project on the PCIbex Farm and it works too: https://expt.pcibex.net/ibexexps/PennController/test/experiment.html

    What exactly happens when you try using the zipped file method? You archive is rather heavy (~90MB) and it takes almost the entire 1min preloading period to download it with my average/fast connection. You might want to use CheckPreloaded with a delay of, say, 3 minutes. Or you can try to reduce the size of your zip file.

    NB: I only tested with PennController 1.2, might be worth checking that too

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

You must be logged in to reply to this topic.