Hi folks,
I'm using Sugarcube in Twine2. I've got a series of passages where different sounds should play.
<<cacheaudio "childsnightmare" "https://ia700706.us.archive.org/4/items/ChildsNightmare/ChildsNightmare.mp3">>
<<cacheaudio "akeley" "https://ia801408.us.archive.org/16/items/Akeleys_Wax_Cylinder_Recording/Akeley_MiGo_Ritual_64kb.mp3">>
God bless the internet archive.
Anyway, when the player gets to the appropriate passage, the audio plays:
<<audio "childsnightmare" fadein >>
The problem is, sometimes, the initial caching doesn't work, and the player gets an error message when they get to that passage. I'm thinking the issue is probably the size of the audio files in the first place. I came across
Twine Audio via this
profhacker post which, if the demo game is any indication, handles audio extremely well and probably solves my issue. The thing is, it's all Twine 1.4. So I expect if I hunt through the forum I'll find guidance about migrating macros etc from 1.4 to 2, but I guess what I'm asking is,
- is it simply better to just use very small snippets of audio - maybe break a big file into a number of smaller ones?
- is there a more elegant way of handling audio in Sugarcube, especially if the sound files are hosted at different sites?
- or would it be faster to just have the sound files in the same folder as the twine html? (which would then preclude hosting at philome.la).
Comments
I.e If the content is slow to load, then it will fail to play when you get to the passage anyway.
It's always better to host the sound files yourself since then you know they'll always be available.
Beyond that, why are you using URLs to specific servers? You are defeating whatever load-balancing and caching system they're using by doing so. Not to mention if that particular server is ever unresponsive or down, rather than allowing their system to route to you a better server, you'll get errors and/or no audio at all.
If you have to use audio directly from the Internet Archive, then you'd be better off using the normal URLs they expose. They also provide the audio sources in multiple formats (sometimes, at least), so it would be better to give players' browsers a choice (MP3 & OGG are likely sufficient).
For example, the following sets up a cache for both pieces of audio with two sources (so browsers can pick which is best for them): [n.b. the semi-colons should not be there]
Thank you for the tips. The error message was essentially a file not found.