Howdy, Stranger!

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

Adding sound files?

edited November 2016 in Help! with 2.0
Sugarcube 1

Has adding sound files been made any easier since I was last here, or do we still need to find a host for them first?

Comments

  • Adding sound files is the same as before, you either host them on-line or include them with the story HTML file.
  • edited November 2016
    Include them with the story html? Does this mean I only need the sound files on my PC and that I don't need to host them anywhere?

    Last time I was trying to add sounds I had a right struggle. In the end I had to use my brothers webspace to host them.
  • This is what I've tried (in my desktop version of Twine), with no success.

    I added a fire crackling mp3 to the same folder as my game's html file.

    Then in my StoryInit passage I added:
    <<cacheaudio "fire_crackling" "firecrackling3.mp3">>

    Then in my 'Shack' passage (no jokes please) I added:
    <<if $isFireLit>><<audio "fire_crackling" play>><</if>>

    But it wouldn't play.
  • edited November 2016
    Can anyone tell me what I'm doing wrong here, please?

    I've tried adding the file URL instead of just 'firecrackling.mp3' but it still didn't play.

    I'm now using Sugarcube 2.11.0
  • You need to using the Publish to File option to play locally referenced audio and video media files, they will not work in the install-able release of the Twine 2 application if using the Test and Play options.

    Simple create a local folder on your hard-drive, save the media files as well as the story HTML file you created into it, and your locally referenced media files will work.
  • Very sorry, greyelf. I could have sworn I tried this, but it may have been while I was still using just 'firecrackling.mp3' instead of the whole file URL.

    Just one last question. Does this mean that when ready to upload the game to a host, I don't have to worry about finding a host for the audio files too? Or do I still have to upload those separately to my own webspace?
  • If you are using relative referenced media files and you are hosting the story HTML file on a web-server then the media files need to be hosted on the same web-server.

    If you are using relative referenced media files and you are uploading the story HTML file to a file sharing site (like Mega) then you need to include the media files with the HTML file, a common way to do this is to add all the related files to an archive file (like a ZIP file) and upload that file instead.
  • edited November 2016
    So if I uploaded to IFDB which would that be?
  • All you supply to IFDB is a hyper-link to where either the story HTML file is hosted online, or to where the archive can be downloaded, so either option is fine.
  • I've never actually got as far as finishing a game in order to upload it anywhere, so I'll have to address all this when and if I ever get that far.

    Thanks.
  • edited November 2016
    I've got my sound clips working locally (from my desktop) so I zipped up the folder and uploaded it to textadventures.co.uk.

    It took the zip but won't play the audio when I launch the game.

    Any ideas?

  • Finally got the audio in my zip file upload working.

    Just a note. In the docs, why does it say use:
    <<cacheaudio "boom" "media/audio/explosion.mp3">>
    When
    <<cacheaudio "boom" "explosion.mp3">>
    Will suffice?
  • Jud_Casper wrote: »
    […] In the docs, why does it say use:
    <<cacheaudio "boom" "media/audio/explosion.mp3">>
    When
    <<cacheaudio "boom" "explosion.mp3">>
    Will suffice?
    Compared to the specified example, no it will not suffice. Simply listing the filename only works if the audio is directly adjacent to the compiled HTML file. That particular example shows audio which is, relative to the compiled HTML file, within the sub-directory audio, which is further within the sub-directory media, which is adjacent to the compiled HTML file.

    In other words, simply using "explosion.mp3" as the path only works if the following structure holds true:
    compiled_html_file.html
    explosion.mp3
    

    The example, on the other hand, shows the following structure:
    compiled_html_file.html
    media/
    	audio/
    		explosion.mp3
    
  • Ah, thank you.
Sign In or Register to comment.