Soundtrack [I7 audio implementation, publishing, browser/interpreter capability]

Hello.

I was just wondering if there have been any major developments in support for sound? All the posts I could find were from a good few years ago.

I’m just trying to put a soundtrack in the game that will play in the background throughout.

I have access to it on Mac and PC but can’t seem to get it to work on either.

It seems to recognise and compile the game but I can’t get it to play. I’ve tried triggering it in the game and the source code. Play doesn’t seem to be a verb Inform recognises.

Sound of soundtrack is the file "sky track mix 11.aiff".

Any help or advice would be appreciated.

Thanks

Just tried

After entering Example Location, play the sound of soundtrack.

This compiled but I got no sound.

Hi!
What platform/system are you using? Twine, Inform, something else?

Oh…Inform, sorry. I didn’t realise there were other platforms being discussed here. It’s version 10.

And it’s a Guluxe file…not that I’m entirely sure what that means.

Thanks for your help.

1 Like

Sound is being worked on as we speak for Parchment and normal inform.

In the mean time though I’ve made an extension and custom interpreter that makes it work just fine. You can see it here (documentation in second post):

You’ll need to download an old version of Glulx Entry Points, which is available here:

There are some annoyances (you need to put .ogg files in one folder for it to compile and .mp3 files in another to get it to play online) but there are at least two games out there using it now with working sound. Here is a working example by Wade Clarke:
https://wadeclarke.com/if/six/

Edit: By the way, sound should be working offline, such as in the inform interpreter. That’s kind of weird if it’s not already doing that.

5 Likes

You probably got this as it seems you read the docs, but make sure your sound source files are in the correct location per 23.8. Declaring and playing back sounds

§23.8. Declaring and playing back sounds

Sound effects are accommodated on the same basis as illustrations. The relevant media files need to be placed in a subfolder of the project’s “.materials” folder, but this time called Sounds rather than Figures, so for instance:

Example.inform 
Example.materials 
    Figures 
        Woodlands.png 
        Blackberry.jpg 
        Red Admiral Butterfly.png 
    Sounds 
        Rustling leaves.ogg

Again, these must be declared in the source text:

Sound of rustling leaves is the file "Rustling leaves.ogg".
And they can be played using a special phrase:

play (sound name)
This phrase causes the sound effect to be played. If the option “one time only” is used, it will have no effect if the sound effect has been played before. Example:

play the sound of rustling leaves;

I don’t remember if the IDE plays sounds by default on Mac. That may have been updated since I last made a sound project. I may be misremembering that I had to publish and play the gblorb to test sounds.

5 Likes

Thank you for your reply. Yes I read the docs and created the Sounds folder etc…I did see something in what you just sent me I may have overlooked/misunderstood:

play (sound name)
This phrase causes the sound effect to be played. If the option “one time only” is used, it will have no effect if the sound effect has been played before.

When I try and write this in the game or in the source code I get a version of

‘that’s not a verb i recognise/know what to do with’

Is there something I’m missing in my code…playing is an action etc that i need to include?

Thanks again

This is a phrase you need to put into your source code as part of a rule somewhere, for example:

After jumping:
    say "You jump on the spot, kicking up some leaves.";
    play the sound of rustling leaves.
2 Likes

I think you still have to spell it out Play the sound of rustling leaves and not just Play rustling leaves.

As @ArdiMaster said, a sound must also fire within a rule so Inform knows when it happens; if it’s continuous background ambience you’d write

Sound of ThemeSong is the file "EntireGameSoundtrack.ogg"

When play begins:
    play the sound of ThemeSong;

All sounds names I believe have to start with sound of [something] which becomes the definition of the sound connected to the file name to play.

Similar to how all image names are figure of [something].

Figure of Woodlands is the file "Woodlands.png". 

display the Figure of Woodlands;
1 Like