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