Chapbook audio error help

Twine Version: 2.8.1 - Story Format: Chapbook 1.2.3

Can anyone help with this issue. I am completely new to Twine and coding in general. I’m using the current online version of Twine and have a chromebook - don’t think that should make a difference on the web version but thought I’d mention just in case - and saw what seems to be the only YouTube tutorial on the matter (by codeVA curriculum) which said that audio could be saved to google Drive and then shared so that anyone with a link can view and then the ID could be inserted into the code to make the audio play.

I’ve been trying to add a voice-over type audio and also some background audio (using both the ambient and sound effect codes/tags) to my story but keep getting the following error message:

  • Warning: sound: Could not resume playing sound effect “intro” (Failed to load because no supported source was found. (copied and pasted exactly as it appears on Twine ‘test from here’).

Please can anyone help with this - trying to complete a project for Friday 29th April 2024 (even after this any help would be greatly appreciated for future projects)?

2 Likes

I’m not familiar with embedding Google Drive content in a web page, but this article seems to be what you’re looking for…

https://kb.blackbaud.com/knowledgebase/Article/121327

…the trick is to produce a valid URL that targets the audio file itself. If you paste a URL into the browser address bar and it opens the audio file itself with a simple controller, you’ve got the right URL. If it goes to a web page that presents the audio file, you’ve got the wrong type of URL.

Let us know if this helps.

Edit: It seems like the article I shared was possibly about embedding the Drive “page” in an <iframe> the trick is to get the src from the <audio> element in that Google Drive page, if that’s the case. In order to help you better, please share the link to your audio file.

2 Likes

Hi, I really don’t mean to interrupt the discussion but I just thought I’d try everything I can - does anyone here have experience with Twine Chapbook and getting audio to play in passages? If so would you be willing to have a look at my post on the issue I’m having as a completely first-timer with this? Any and all help would be greatly appreciated.

1 Like

Hi!

So, I see your post about it, elsewhere on the forum! Once a knowledgeable user reads it, then they will respond to you. All of us who are chatting in this thread are very unlikely to know how to help with that, as a lot of us are parser authors. Twine is a very different family of systems from what we use.

On this forum, threads with more recent activity don’t necessarily pull focus from all the other users. A lot of users will filter posts by category, so yours should be the latest Twine topic. Any Twine authors who frequent that category will see it, and might even have this current thread muted on their end, because a lot of what we’re discussing here is kinda sorta settled/solved by Twine, and is just an experimental frontier for parsers, at this point. :grin:

For example, I have the entire Inform category muted, because I don’t have a clue how to help anyone with that! :joy:

3 Likes

thanks so much, that does make sense - I just can’t help feeling quite lost at the moment

2 Likes

Understandable! Give it some time~

The forum offers users awareness of what’s going on everywhere at all times, assuming a user doesn’t mute a category for some reason. There’s not really any way to speed up the discovery process or get more attention for a post. It’s (unfortunately) just a simple waiting game from here~ :grin:

2 Likes

Like HAL said, the URL must lead to a web page that plays the sound not just offering it for download as a clickable link. Also, if you’re using your personal Google drive, this must be a public folder anyone can access freely. I did this ages ago playing music from my Dropbox public folder for Final Girl (though I was using Storynexus and doing weird JS calls to play the music.)

I misread that you were using web URLs, but here’s my process for anyone who wants to play local sound file using Chapbook:

You need to export the game into the same folder where your sounds are located, either in the same file or folder. I set up a structure like this: I’m exporting my game to index.html and putting the actual sound files in the ‘media’ folder.

Screen Shot 2024-03-27 at 12.51.29 PM

Then you declare your ambient sounds and sound effects - essentially you are giving them a short name and defining where they are in your file hierarchy. I put everything in ‘media’ so I give relative URLs based where the index files are. If you have a lot of sounds and images, you may want two folders.

Ambient generally means music or longer sounds like rain you want to play and loop continuously, sound effects are generally shorter or one-off sound clips that play over the ambient sound bed.

You want to put your sound declarations in an early passage in the Vars section above the –

sound.ambient.sunday.url: 'media/Sunday Dub.mp3'
sound.ambient.intro.url: 'media/intro.mp3'
sound.ambient.egmont.url: 'media/egmont.mp3'
sound.ambient.suburb.url: 'media/suburb.mp3'
sound.ambient.boombox.url: 'media/ZigZag.mp3'

sound.effect.creak.url: 'Media/onecreak.mp3'
sound.effect.slow.url: 'Media/squeaks.mp3'
sound.effect.fast.url: 'Media/squeakf.mp3'

--

So the form is:

sound.ambient.intro.url: 'media/intro.mp3'
(this is a sound that is ambient, called intro, the url where the sound is located relative to this game is here)

If I didn’t want to make a separate folder and intro.mp3 is in the same folder level as index.html with no media folder, it would be

sound.ambient.intro.url: 'intro.mp3'

Then in your game, you can call a sound by the name you gave it. (Here I’m calling an image from the same path, then the sound.)

{embed image: 'media/PBgood.png', alt: 'Peanut Butter'}
{ambient sound: 'intro'}
5 Likes

warning: Personal File hosting sites like Google’s Drive and Microsoft’s OneDrive are not designed to be used to host files that are made available to the general public, and often their Terms Of Service include clauses that forbid such usage or restrict access to a limit group of people (eg. like family).

3 Likes

Thank you all for your responses very helpful. I think it’s a bit different for me as I have a chromebook so as a complete beginner to this its still quite confusing since I can’t just copy exactly what you’ve done. I tried uploading the sounds to audio.com, re-downloading them and opening up my downloads on chrome, from there I open up the links in a new window and copy those urls and it seems to be working thus far - sometimes it does take a few attempts but I think i’ll have to do this until I can start a project with more time.

2 Likes

This is also true. I got away with it as a kludge for a small group of IF players, but if you’re streaming extensive narration and audio - even if allowed, you’re likely going to hit a bandwidth-transfer maximum that’s buried in the terms of service somewhere for your file-hosting service and you’ll end up having to pay for a commercial/non-free account to accommodate the traffic.

It’s best to bundle your files locally in the zip. One thing that helps this - when you get all of your files together, you can manage your audio files to lower the bitrate with little noticeable loss of audio quality.

One of the typical music files I’d use is four-minute music track at 44.1 kHz which is 10.3 MB. If I export and re-sample at 22.05 kHz using Audacity that will practically halve the file size and I cannot tell much difference and most people who are not audiophiles wouldn’t either. You can even lower it more than that for more space savings, though you will start to notice the lower you go. Sometimes for speech this is fine - as you go lower, it just starts to sound a bit crispy like a low-quality radio speaker.

Usually I make the game with audio at full quality, and then just before release I use a Mac app called Switch to bulk-change the sample rate on all the files where I want it simultaneously just for consistency.

Another thing that I’ve not tried - I imagine you might get some file-size savings if you export your speech/narration files as mono instead of stereo sound - unless you’re intending to make something of spatial audio positioning such as characters walking around a sonic space.

1 Like

From what I understand of Chromebook - essentially it’s a light and inexpensive laptop because it doesn’t have a lot of onboard storage space or a hard drive, correct? You’re connecting to a cloud storage space in lieu of a hard drive?

I kind of do that on a regular computer already. I am copying my sound files and exporting my Chapbook builds to an iCloud Drive as if it were a regular hard drive. The trick is the relative URLs you specify in the Twine Code.

Screen Shot 2024-03-28 at 3.49.44 PM

“Publish” is a folder on my iCloud Drive. It contains the “media” folder with my images and sounds. When I publish my game I always save it in the Publish folder as index.html. That’s the game that gets played in the browser. Due to your relative url declarations in twine, it knows all the supplementary files are in the “media” folder which is in the same folder as index.html. To distribute, I zip-archive the index.html file and the media folder together as the distributable zip file that contains everything to make it work. Here it’s GameName.zip. I give the player the zip file, or I can upload to itch, which will pick the index.html file out of the zip to run, or your player can open the archive and click index.html to run the file in the browser.

The trick is specifying where media files are located relative to index.html in your Twine declarations.

sound.ambient.babylon.url: 'media/Babylon.mp3'

That url - media/Babylon.mp3 is saying "relative to where the index file is running from, Babylon.mp3 is in the media folder. It doesn’t matter where the zip/folder is on the internet or the computer it’s downloaded on, it’s just saying "look in the ‘media’ folder for this file starting from this local folder.

If you have it split up, say media containing two subfolders called ‘images’ and 'music" and the file was in the music folder, it’d be this:

media
|
|-images
|-music
   |- Babylon.mp3

sound.ambient.babylon.url: 'media/music/Babylon.mp3'

Long story short: you don’t want every player playing your game to need to connect to your Google drive through the internet to fetch the sound files; you want to provide all media in the zip locally so the game plays the file from their computer, or the online hosting service such as itch.io instead of the personal web-space you pay for. Each player has their own copy of the media instead of streaming it from your cloud drive online.

In general, playing sounds from a web URL can be done, but usually those are special use-cases and requires the player to be online to do so.

1 Like