Twine Version:2.3.12
I use the code below to include a play or stop icon in a passage. How can I add sounds, the ones I have, to those icons so a player can play or stop the sound whenever they want?
To be honest, I haven’t even tried to do audio yet, but a little googling revealed HAL (nice name, eh?)… Harlowe Audio Library
One thing I do know is that it’s one thing to play an audio file in a passage. It’s another to play one across multiple passages without the sound being interrupted. Good luck!
The previously mentioned Harlowe Audio Library addon is the recommend method for adding audio related functionality to a Harlowe based project. And it allows audio to be played across multiple Passage Transitions.
warning: Modern web-browsers will not allow audio (or video that contains audio) to auto-play until the end-user has interacted with the page.
For this reason it is generally recommended that the 1st Passage your project shows to the end-user be some sort of Welcome / Summary / Credits ‘page’, that includes a link to the ‘real’ staring Passage of your story.
eg. A very basic TWEE Notation based example of the above recommendation…
:: Start
Welcome to Adventure!!
This program was originally developed by <author's name goes here>, and future releases can be found <link to your project's website goes here>.
[[Onwards->Outside a Small Brick Building]]
:: Outside a Small Brick Building
{
(track: 'outside', 'loop', true)
(track: 'outside', 'play')
}
You are standing at the end of a road before a small brick building. Around you is a forest. A small stream flows out of the building and down a gully.
<the rest is up to you!>