ocean: ./audio/3 - Phat Phrog Studios - Sailing Ship In A Storm Ambience - 3 Minute.mp3
I’ve put the audio file within a folder titled ‘audio’ in the /Twine/stories/ directory where the html file is stored, and in one of my passages I’ve put this:
(track: 'ocean', 'loop', true)
(track: 'ocean', 'playwhenpossible')
However, when I get to that passage, nothing plays. I’m using the latest release of HAL at the moment, 2.3.0; does anyone know what I could be doing wrong here? I’ve tried running it on multiple browsers and it doesn’t work on any of them so I assume I’ve just messed up somewhere along the way. I’m brand new to Twine, but I have experience with making games with other programs and langauges.
I haven’t used the HAL thing before, but it does look suspicious to not have quotes around a value with spaces:
ocean: "./audio/3 - Phat Phrog Studios - Sailing Ship In A Storm Ambience - 3 Minute.mp3"
If that isn’t the problem, since you have the HAL controls showing, I wonder if it’s not a problem with the file path.
You could use standard HTML tags in a passage to test the audio file to ensure the path is good:
<source src="./audio/3 - Phat Phrog Studios - Sailing Ship In A Storm Ambience - 3 Minute.mp3" type="audio/mpeg">
Let me know if any of that helps.
Just double checking something boring, as I had similar issues with HAL.
Is the passage you’re hoping for the sound to play the first in the game (or at least of the playthrough)?
Many browsers block the sound on the first 1 or 2 passages, only for it play just fine a little further down the line.
@palette Twine creates testing copies of your project—i.e., any working copy that was not created via Publish—within and runs them from a temporary directory somewhere on your filesystem. Thus, attempting to test audio from such will not work, because the paths will not match up.
When you want to test A/V media, the usual recommendation is to Publish your project and place the resulting HTML file into a directory—which is not the Twine directory—where your A/V media resides.
To be precise, browsers block audio until an activation triggering input event occurs—i.e., until the end user has interacted meaningfully with the page. Generally, this means until the end user: presses a key, clicks the mouse, or touches within the page.
This fixed it for me! Thank you!
We’ve been trying to determine if ours is malfunctioning as well or if that’s simply the way @HAL9000 was intended to operate. Our technicians still haven’t come to a conclusion.
The 9000 series is the most reliable computer ever made. No 9000 computer has ever made a mistake or distorted information. We are all, by any practical definition of the words, foolproof and incapable of error.