Can't get multiple sounds extension to work...

This is the first extension I’ve tried to use. I’ve installed it as I should on my Windows system. It shows up in my installed extensions but it’s listed as unused.

I can run sounds on the default single channel, but as soon as I try to create channels I run into problems. In fact, I can’t even loop a single sound. The only action that seems to work is “play the sound bg1.”, for example.

I just use the text from the extension’s documentation:

Include Multiple Sounds by Massimo Stella.
Sound of bg1 is the file “scifi.ogg”.
Sound of paper02 is the file “paper02.ogg”.
When play begins:
set the background volume to 2;
play the sound of bg1 in background;
set the foreground volume to 3;
create the midground channel;
set the midground volume to 3.

I’ve also tried to simply create 3 midground channels. No dice.

And I get errors such as:

“You wrote ‘set the background volume to 2’ : but this is a phrase which I don’t recognise, possibly because it is one you meant to define but never got round to, or because the wording is wrong (see the Phrasebook section of the Index to check). Alternatively, it may be that the text immediately previous to this was a definition whose ending, normally a full stop, is missing?”

" In the sentence ‘play the sound of bg1 in background’ , I was expecting to read a sound name, but instead found some text that I couldn’t understand - ‘sound of bg1 in background’.
I was trying to match this phrase:
play (sound of bg1 in background - sound name)
But I didn’t recognise ‘sound of bg1 in background’."

“You wrote ‘set the foreground volume to 3’ : again, this is a phrase which I don’t recognise.”

Anyway, it’s probably something stupid but any help is appreciated.

Hi Nick,

I helped with some code in Multiple Sounds but I should point out I am not the overall author. I don’t have a thorough answer for you now based on thorough examination because I don’t have time. But I have a few comments.

1st comment is: This extension is getting old. I don’t know if it runs OK in the latest Informs. It was written for the previous generation of Inform (6G60).

My 2nd comment is: The code for creating more than the default number of channels is probably the most fraught part of it. It was put in as a sort of starting point at a time when none of the current extensions were doing anything for extra channels, and I waned to use them.

3rd comment: It may be that it all works and the only things you’re doing wrong are making formatting mistakes. Indenting things incorrectly or missing punctuation can throw weird errors in Inform 7. But to check that, we’d have to see your exact code, and the exact error messages you get when things happen.

Note that you can paste your code into a post here by using the ‘code’ tags. When editing a post, click the ‘full editor’ option, and you’ll see options for tags. Paste your code from your project inbetween code tags and it will be formatted properly in the forum.

Hope this helps start to solve the problem.

-Wade

PS ALSO - I think user Draconis has written a more sophisticated sound extension called Music since this extension was around. It might also just solve your problems, but I don’t know its status with the current Inform. It can be got here: github.com/i7/extensions/tree/m … %20Stelzer

Thank for the reply. Honestly, all I need at this point is a second channel and a way to kick on BGM when a saved state is loaded. I just want BGM + SFX.

I cut and pasted the actual code I was using and the error messages given in the OP. The current version of Inform 7 obviously has some issues with the syntax with these extensions (music.i7x doesn’t work either). It doesn’t like “create” or “set” as verbs and it doesn’t like it when I add channels or directions after the sound name.

Simply put:

play the sound of bg1; = works but it gets replaced with any other sound I try to play.

play the sound of bg1 with loop; = error
play the sound of bg1 in (or on, I’ve tried both) background (or midground or foreground); = error
create the midground channel; = error

I’ve used both ; and . to stop the lines. Inform doesn’t know what I’m trying to do here. It tells me:
“I can’t find a verb that I know how to deal with.” or
“I was trying to match this phrase: play (sound of bg1 in background - sound name) But I didn’t recognise ‘sound of bg1 in background’.”

I suspect you do have a code formatting/punctuation problem, but if you don’t post the code within the code tags in this forum, so it comes out like this:

	play the sound of bg1;

it’s not really possible for onlookers to diagnose such a problem. So if you could do that, that would be a big help.

However, what I might try to do is get a simple demo running. Starting with just trying Multiple Sounds in the current Inform and making it play a sound.

By the way, do you need a midground channel? You start with a foreground and a background (2 channels). So if you put background music in the background and SFX in the foreground, you can leave out any troublesome midgrounds

There’s one thing I know for sure that Multiple Sounds doesn’t do properly though - that is restore the sound state when the player restores a saved game

So say they’re playing your game, and the background music is on, and they save and quit. When they reload, the game will crash because Multiple Sounds didn’t save the sound state (of the background music being on). The only safe way to go with Multiple Sounds is to stop ALL sounds playing just before writing the save file, then manually turn them back on after. Which is far from elementary. (Well, stopping them before a save is a cinch, and if you do nothing else, that eliminates the crashing. Bringing them back automatically after a save, if it’s important to you, is a big hassle.)

I don’t know if Music handles this situation properly - my guess is it probably does. But maybe it doesn’t work in the current Inform?

Anyway… I’ll try to just get a demo running in current Inform where Multiple Sounds plays a foreground and background track.

  • Wade
1 Like

Ok, here’s Multiple Sounds 6M62 Demo 1. So obviously it’s good news that it works fine in the current version of Inform. It uses both the foreground and background channels, demonstrates basic functions and automatic sound-stopping before save or restore. Copy and poste the code directly into a new project.

(Caveat - in the Gargoyle interpreter (which I have to use to get any sounds on my Mac) the auto-stop after a save doesn’t actually stop the audio, though it sets the flag correctly for the game’s purposes. I don’t know why this is and I think it might be a bug or unanticipated behaviour.)

[rant][code]“Multiple Sounds 6M62 Demo 1” by Wade Clarke.

Include Multiple Sounds by Massimo Stella.

Sound Studio is a room. “The song you hear playing should loop without end.[paragraph break]Type ‘boing’ to make a boinging sound.[paragraph break]Type ‘stop’ to stop both audio channels (foreground and background).[paragraph break]Type ‘start’ to restart the music if you stopped it.[paragraph break]Try to ‘save’ the game, too. The game will automatically issue a STOP before it saves – it has to so that the ‘restore’ command will function.[paragraph break]When you ‘restore’, any music playing will stop before the restore.”.

Sound of boinging is the file “sfx_boing.ogg”.
Sound of singing is the file “s09_Aylas_song.ogg”.

When play begins:
set the foreground volume to 3; [3 out of 5 - middle volume]
set the background volume to 3; [3 out of 5 - middle volume]
play the sound of singing in background with loop;

saying boing is an action applying to nothing.

Understand “boing” as saying boing.

Carry out saying boing:
play the sound of boinging in foreground;

Report saying boing:
say “Boing!”;

stopping both channels is an action out of world applying to nothing.

Understand “stop” as stopping both channels.

Carry out stopping both channels:
stop the foreground sound;
stop the background sound;
say “Stopped both channels.”;

restarting the music is an action out of world applying to nothing;

Understand “start” as restarting the music.

Carry out restarting the music:
play the sound of singing in background with loop;

Understand “save” as special-saving the game.

special-saving the game is an action out of world applying to nothing.

Carry out special-saving the game:
try stopping both channels; [when bundled here with the save routine, this line is setting the Sound Off state correctly, but currently playing sounds continue to be heard until they end. A peculiarity of Gargoyle or a bug?]
try saving the game;

Understand “restore” as special-restoring the game.

special-restoring the game is an action out of world applying to nothing.

Carry out special-restoring the game:
try stopping both channels;
try restoring the game;

[/code][/rant]

The second thing you need is the audio files I used. I’ve attached them to this post.

Try to compile the project once (it will fail) so that it creates its ‘Release’ folder.

Now in the folder -containing- the release folder, create a ‘Sounds’ folder.

Stick the 2 attached ogg files in the Sounds folder, then recompile the project. That should stitch it all together.

1 Like

Hey guys :slight_smile: I’ve looked for possibilities to play multiple sounds - for example background music and foreground sounds - at the same time. I’ve found different mentions of extensions as “DaMusix”, “Vorple Multiple Media” and “Multiple Sounds”. But I just could find the Vorple Multi Media extension as a download - and that seem not to work any more with Inform 60g6, which I use. Then, I found your discussion here. So: Can someone send me the multiple sounds extension you were talking about here?
Thanks a lot!
Best wishes, Philipp

I made great use of @Draconis’s “Music” extension which offers three channels without much futzing. I don’t know if it’s easily searchable, or a private experimental extension still.

It’s available here! Hasn’t been updated in a while, but neither has I7, so I think it still works with the current version.

2 Likes

Hi Daniel,
I’m using your Music extension for an IF with field recordings. I have two problems that maybe you can help me solving?
First, all the rooms in the game have an attached sound, I’m using a “before going into room x, introduce the sound of room x” command. It is working fine for the rooms except for the starting location room, so I had to add a “when play begins, play the sound of x” what happens now, is that the starting location is a random room, so that last command wouldn’t be useful anymore. Any idea why this is happening?
Second, I’d like the sounds to crossfade, but I haven’t had any success so far with the “introduce the sound of”. As only one sound is attached to each room, I’m not sure if the background-foreground setup would be very useful, as it happens to be a bit of a complex map, and also random starting.
Thanks in advance!
Best, Lucila

I’m not sure I totally understand what you’re trying to do, but something like this?

A room has a sound name called the associated sound.
When play begins:
    introduce the associated sound of the location.
After going:
    introduce the associated sound of the location;
    continue the action.

Hi! Thanks for answering.
I was trying your suggestion, it improved some aspects but I still have some problems, to make it more clear I’m attaching a bit of code, please let me know if you need more bits.

[code]
Starting_Locations_Collection is a region.
StartingLocation is a room that varies.

A room has a sound name called the associated sound.
Before going:
introduce the associated sound of the location;
continue the action.

When play begins:
let R be a random room in Starting_Locations_Collection;
move the player to R, without printing a room description;
introduce the associated sound of R.

Sound of Heller is the file “Heller.ogg”.

Before entering Heller_1:
introduce the sound of Heller.
[end code]

In general, the sounds work, and they are correctly attached to each room. But they are not crossfading. I also tried not using the last part of the code I pasted there (before entering…)and then I don’t get the right sounds for each room, instead the same first sound starts again (that is problem 1)
The StartingLocation sound (for random starting room) is not working, no matter what room the game starts at, the sound I’m getting is the first room in the list of rooms in the map. (that is problem 2)
I hope this explains a bit more my difficulties.

You do need to say The associated sound of <some room name> is <some sound name>. for every single room in your story, with the code above. Remove the final Before entering Heller_1 section as well, that’s just a conflict.

Once you’ve defined a property with a sound name value, if you don’t set it to anything then it will default to the first sound defined in your story. (You can see this in the Index, or if you showme each of your locations.) As such, any room where you didn’t set the associated sound explicitly to something else (which is every room, since you didn’t set it at all) will default to the first sound you define.

If you want some rooms to have no sound, then you need to make your default sound a “sound of silence” – which will still attempt to play unless you modify your before going rule to avoid trying to play the sound of silence.

1 Like

Thank you @mirality it worked for the sounds and the order, it is also much neater than my approach.
Both problems solved!