Howdy, Stranger!

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

How to insert a separate audio mp3 file into each passage?

I'm new to Twine, using version 2.0 app and SugarCube2. I want to create a story that has a different audio file in each passage. But I don't know where to store the files and also don't know what to type into the passage box in order to command the program to use the audio.

If it's easier to do this on Twine 1.4 I'm willing to do so, but saw on another board that SugarCube comes with audio functionality.

Please help!

Comments

  • SugarCube (both 1 and 2) can be used in both versions of Twine (1 and 2), so it is up to you which version of Twine you use. Although I believe that there is an issue with sound not working correctly when using the Test and Play options of the Twine 2 installable application, but it does work if you use the Publish to File option.

    You store your sound files externally, whether you host them on a website or place them in a folder relative to your generated story HTML file is up to you but the URL's you use to reference the file is slightly different based of this choice.

    If you read the Audio Macros documentation you will see that you use the <<cacheaudio>> macro to define what sound files to use and the <<audio>> macro to play the sound file.
  • Thank you.
    Ok I've inserted the macros and put all my mp3s in a file.
    But I get this message:
    "Twine 2 macros use a different syntax to Twine 1 macros"


    I see the doc says I should put the cached audio in the StoryInit file but the same thing happens.
  • Are you sure you have selected the SugarCube story format within your story?

    That error message occurs if you are using <<macro-name>> formatted macros but you Test/Play/Publish your story with Harlowe selected.
  • You're right, I hadn't selected SugarCube. It's selected, the audio files are hosted on my website and still...nothing. I think I may not be doing the StoryInit passage correctly. Currently only my <<cacheaudio>> files are in there, should there be more?
  • If you are using Twine's Test and Play options when trying to play the audio files hosted on your website, for that to work the URL's you use in the <<cacheaudio>> macro will need to include the domain.

    eg. If the audio file is named beach.mp3 and it is stored in an audio folder on a domain of www.mysite.com, then you would add something like the following to your StoryInit passage:

    If you use the Publish to File option to create a HTML file version of your story and then upload that HTML file to your website, then you could use relative URL's to reference the audio files.

    eg. You create a story HTML file named adventure.html which you upload to your website, and you want to access the same audio file used in the first example then you could of added something like the following to StoryInit:
    <<cacheaudio "beach" "/audio/beach.mp3">>

    In both of the above cases you would add something like the following to one of your passages to play the cached audio file:
    <<audio "beach" play>>
    
  • purevanity wrote: »
    You're right, I hadn't selected SugarCube. It's selected, the audio files are hosted on my website and still...nothing.
    greyelf wrote: »
    If you are using Twine's Test and Play options when trying to play the audio files hosted on your website, for that to work the URL's you use in the <<cacheaudio>> macro will need to include the domain.
    Note! The Twine 2 application itself does not support audio (or likely video), so no media will ever play when using Test or Play. To test audio (or, again, likely video), you must Publish to file and then test that compiled file in your browser of choice.

    The only exception is when you're using the browser-based version of Twine 2, which supports whatever media your browser of choice does (though its limitations make using it just to get around having to Publish unwise).
Sign In or Register to comment.