Howdy, Stranger!

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

Help Adding Sounds to Twine

Sorry for consecutive posts! I was wondering what the best way to add sounds/music to Twine is? I have a puzzle in my game that will require switching between several different 'songs' on a radio. I tried adding sound using Howler JS for javascript like I saw in one tutorial, but I kept getting a "Howler undefined" error. Any help's appreciated, thanks.

Comments

  • I tried using the macros before, but for some reason they weren't working. I put the macro in it's own passage tagged 'script'. Then I called the wav. file with my sound in the passage I wanted the sound to play in. Is that right? Sorry for all of the questions. I'm completely new to this program, and I've never used Javascript before, so I'm learning as I go along.
  • Which browser / version are using to view your story and what operating system.
  • I'm using Firefox, with a wav. file. I already checked for compatibility.
  • Sorry, I was in a big hurry before.

    Yes, paste Leon's sound script into a passage with "script" as the tag, no quotation marks. Doesn't matter what the passage title is.

    Have your sound file in the same directory as your HTML file.

    Set your sound file to a variable (e.g., <<set $soundFX = "soundfile.mp3">>).

    Use  the macro to play the variable (e.g., <<playsound $soundFX>>).

    Attached is an example HTML, TWS and MP3. You must have the HTML and MP3 files in the same directory.

    Hope that helps!
  • Thank you, thank you, thank you! Even I should be able to figure this out now! :)
  • I couldn't get this to work.

    FINALLY I figured out that having "Use ROT13 to obscure the HTML source code" checked off makes using sound files in this way NOT WORK.

    Is there anyway to have both options functional?  (i.e. use sound files AND have the ROT13 HTML obscure checked and active?)
  • There is no real point to using the ROT13 option to hide the details of your story because it is very easy to reverse.
  • Well I suppose I can skip it.  I wonder if it's possible for the sound script to have this option fixed/available.  I guess I'm looking for as much security as possible, with so little available it would seem.  I will start another thread on this.
Sign In or Register to comment.