Using a (15 second) selected portion of a mp3 file

Please specify version and format if asking for help, or apply optional tags above:
Twine Version: 2
Story Format: Harlowe 3.1

Dear members,

I am a new member. I’m sure I can learn a lot from you and some day return the favor of helping others. I’m an English instructor (ESL) and I’d like to use Twine 2 to make interactive learning activities for my students.

My question is this: I have a 3 minute sound file. It works in Twine.

However, I do not want it to all play at once. I’d like to make 15 second portions for each new Twine ‘page’.

How can I set the url to play 15 second portions? I do not want to split up the mp3 file itself.

Thank you, in advance, for any help you might offer.

-Gavin

I do this in my WIP - the main theme is about seven minutes long, and I have three excerpts from it as different files that play when I want a specific section of it.

So this won’t work for you, but realize you can also include the entire track as a separate file for when you want the whole thing to play as above.

If you can play it using JS, audio objects have a currentTime property that allows you to specify where to start playing. To stop at a certain point you can use setTimeout().

Audio libraries such as Howler make this easier (search for “audio sprites” or “sound sprites”).

1 Like

Thank you very much for your advice. To say the least, Twine and programming is very overwhelming. I need to learn it within a month, however. If you don’t mind, can you suggest any introductory books or websites? I’m watching videos on youtube. Thank you. -Gavin

I’m finding Chris Klimas’s Chapbook Twine format incredibly inviting and creator-friendly with most of the stuff you want to do built in and explained thoroughly: https://klembot.github.io/chapbook/guide/

Once again, thank you.

1 Like