Sounds after each other

I’ve been putting sound effects in my game and have so far got about 21 short effects working of a few seconds each. They are triggered in a variety of ways such as “every time when the player is in the room for the second time” and “after four turns” and “if the player is on the supporter” and “a random chance of 1 in 2 succeeds”. They all work succesfully if they are the only sound activated for a turn, though only one sound plays when two are activated such as the player is in the room for the second time and after 4 turns. The typed words do appear
though so the text of the second sound is reacting.

Do I need to use the music extension. I’m probably pushing the boundries of Inform7 but can it play one sound and then a second sound after? on the same turn? I’ve looked at some music queries with crossfade but don’t know how to do it. I seem to be going well with inform7 programming in word form but I can’t programme in I6.


This seems to work:

[code]“Sounds after each other” by Phosphate

Include version 10/160919 of Glulx Entry Points by Emily Short.

Use direct event handling.

The Sound Stage is a room. “You can hear two songs alternating in the background.”

Sound 1 is the file “song1.ogg”.
Sound 2 is the file “song2.ogg”.

When play begins:
unless glk sound notification is supported:
say “This interpreter does not support sound notifications! Song alternation won’t work!”;
play Sound 1 with notification.

To play (SFX - sound name) with notification:
(- glk_schannel_play_ext(gg_foregroundchan, ResourceIDsOfSounds–>{SFX},1,1); -).

Glulx input handling rule for a sound-notify-event:
let sound id be glk event value 1;
if sound id is the Glulx resource ID of Sound 1:
play Sound 2 with notification;
play Sound 1 with notification.[/code]It requires version 10/160919 of Glulx Entry Points and three other extension dependencies, and an interpreter that supports sound notifications, which I guess currently means Windows Glulxe or Windows Git if you are on Windows. And two correctly named sound files, of course.

All the required extensions are collected in the extensions folder of my Soundtest Github repository.

EDIT: This forum seems to turn all tabs into spaces, so the sample above won’t work. You can copy and paste from here instead.

Another way to recover tabs is to hit the “quote” button at the bottom of the post, copy the text out of what you get from there, and cancel your reply. (This is a reversion to the way the forum worked a few years ago–I’m not sure what happened.)

Thanks. I’ll see if I can get it working.

Happy New Year


Greetings all,

I built the soundtest repo on Win 7 with Inform 7 6M62.

It works as far as playing the sounds.

Is there supposed to be a graphical interface (i.e. like the “map” in Counterfeit Monkey ? )

If i enter “x controls”, I just get a text explanation of the controls.


Thanks for trying this out! There is no graphical interface. The controls are meant to be manipulated with text commands only, but could probably be more user friendly. If you have more questions or ideas for improvements, please let me know!

I guess a functional graphical sound mixer would be a fun challenge to make in Inform, but it is a bit out of scope for this simple interpreter capability test.

Ok thanks for confirming what I suspected.

I guess the mention of the “buttons” and “switch”, “volume control” are in the “spirit” of a regular IF game … even though it prints out “Sound Test … Not a game” :confused:

A bit confusing to a noob like me.

I should probably make this clearer on the Github repository page. The sound test is meant to test the sound capabilities of Glk interpreters, in the spirit of Andrew Plotkin’s Glk unit tests. I wrote it in order to test the sound support of Spatterlight.