Howdy, Stranger!

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

Sound won't work in Sugarcube

Error: <<audio>>: no track by ID: tack_name

That's the error I keep getting. I have all the info punched into StoryInit like: <<cacheaudio "track_name" "url">>

To be clear, just to avoid the assumption that I'm just clueless: I am a ew to twine but I have never had an issue with this before. I actually had it working fine and then all of a sudden it just stopped working, and I didn't change anything int he StoryInit passage.

I saw on a different thread that this is actually a bug. TheMadExile suggested adding &ext=.mp3 at the end of the URLs and that worked for some files but not for others. And even when I get the error message to go away with that solution, many of the files won't play the audio regardless. The files are pretty small too so I can't imagine it's my browser struggling to load them.

I'm storing my files on dropbox (yes I did change dl=0 to dl=1).

I just can't seem to figure out the method to this madness...

Has anyone come up with a fix for this bug?

I'm using Sugarcube 1.0.34

Thanks!

Comments

  • For the audio files that aren't playing have you checked that the file-extension of the file itself is actually correct?

    eg. you can rename a MP3 file like sound.mp3 to sound.wav and it will still play in many audio players but that doesn't mean the file is actually a WAV file.
  • There are two things going on here on SugarCube's side:
    1. In the SugarCube v1 series, audio source URLs require a file extension. That is a known limitation, which is addressed in the SugarCube v2 series.
    2. In versions of SugarCube less-than v1.0.35, there is a bug in the <<cacheaudio>> macro whereby it fails to properly handle URLs containing query or hash strings. That makes your claim that some audio from Dropbox works an odd one, since none of it should work.
    To resolve your issue, I'd suggest either:
    • Upgrading to the latest version of SugarCube v1, which fixes the bug. Not recommended
    • Upgrading to SugarCube v2, which does not have the bug and removes the limitation by allowing you to manually specify the format, when it's not obvious from the URL. Recommended
    Unless you've done a lot of custom UI work, which might require effort to transfer to SugarCube v2, I'd really suggest switching to v2—not to be confused with Twine 2.
  • Addendum to add a bit of additional information.

    If you do update your SugarCube v1 installation or install SugarCube v2, the query string hack/workaround won't work anymore, so you'll want to ensure that your filenames end in the appropriate file extension—unless you go with v2, in which case you may manually specify the format, though using an appropriate file extension is still easier.
Sign In or Register to comment.