Background Music for Inform 7 Browser Interpreter

Hello everyone!
I am currently working on a text game in Inform 7 to accompany an album that I’ve recently made. I would like to play tracks from the album during scenes in the game, but I would also like to have the game be playable from the browser. Are there any extensions that support music playback in the browser? If not I may end up switching to twine, but I really do want to make this as a parser game. Any advice would be greatly appreciated!

1 Like

You can play audio in Inform 7. See WI 23. Figures, Sounds and Files in the documentation. You have to place the file in the .materials folder of the file, and then declare it in the source text, like `Fugue is the file “bach.ogg” (“A church organ playing a Bach fugue.”)

Does this work in the HTML interpreter though? I saw both in the documentation and online that Inform’s audio systems are very limited depending on which interpreter you use

For playing sound in the browser, the two options right now are Vorple and Bisquixe.

Vorple is more mature and better documented. It does require either writing the game online or running a local server:

Bisquixe is more minimalist and recent and can work without a local server:

3 Likes

Sounds work in the iplayif.com version of Parchment. I still need to update the Parchment for Inform 7 template to support sound.

3 Likes

Thank you so much!

1 Like

Oops! Didn’t notice the “in the browser” part. Sorry!

1 Like

Dannii, with the new version of Glulx Entry Points coming out and the updates to Parchment, I was thinking about (once the new version of Inform releases) updating Bisquixe and switching over to Parchment (because I’ll have time to learn it now and won’t have to recode all the music). I’m very excited to see the progress in the tools everyone has access to!

Do you have an example of a gblorb with sound on IFDB where clicking the ‘play online’ button plays the music that I can use as a baseline? Most of the ones on there have custom interpreters or play on people’s websites due to the many years of not having online play. Do you know of any normal games that are uploaded as a gblorb with sound included?

Or, alternatively, is there a way to use iplayif with a url? I could try Angstsmurf’s soundtest game: Glulx sound test

Another question for technical purposes is, how did you handle file types? When I was working on Bisquixe I found that Inform wouldn’t play mp3s (due to outdated rules about copyright on mp3s, I suspect) and apple devices wouldn’t play .ogg, so Bisquixe currently requires both file types. What types of sound files does Parchment currently play?

1 Like

I’m pretty sure this one is just a gblorb:

Light My Way Home

Would switching over to Parchment facilitate investigations into hyperlink stability? I feel like Inform has a lot to authors of choice fiction, thanks to its robust world model, rules-based programming, and built-in handling of tables, lists, and text substitution (especially since bisquixe makes it so easy to style web releases).

(sorry for what might seem like an off-topic question, but I think the fatal errors associated with hyperlinks have a GEP connection)

1 Like

I saw on another post that the new GEP seems to have features that make things easier (like deciding whether ‘echo’ is on on an ad hoc basis), which means that a new version of Bisquixe would require much less code, which, if nothing else, would make it easier to pinpoint where problems are coming from.

1 Like

Thank you, this is one is good. Although here, the music plays as soon as you start, which isn’t allowed by most browsers (which require some interaction before starting), giving this error:

(this isn’t a parchment bug, it’s just a feature of modern browsers that authors will have to work around themselves). If I remember right, this game has some other sound effects further in; I’ll explore it more. I helped convert this to Bisquixe and sent it to the author a year ago, so I’ve seen its guts at least once!

If you need a game where the sound effects don’t start right away, or where you have more control over when the sound effects happen, there’s also this one.

1 Like

It’s true, initial sounds before a click do not play on browser. Itch manages to circumvent this, I think by tricking the play click.

1 Like

To be precise, it has been incorporated into Inform core. There will not be a GEP extension anymore.

Kerkerkruip is one!

You can also put autoplay=0 in the URL to prevent autoplaying, which handles the browser restrictions on autoplaying sounds. https://testing.iplayif.com/?story=https://unbox.ifarchive.org/04lc38jbhe/Kerkerkruip.gblorb&autoplay=0

Eventually I’ll have some system that will automatically determine when it needs to show a play button instead of autoplaying.

You can just put any URL after story=. Or indeed, when you go to iplayif.com there’s a box to put in the URL too.

Parchment supports AIFF and Ogg/Vorbix, two of the Blorb sound formats, but not MOD. Inform doesn’t support MP3 because it’s not part of the Blorb spec. You should just use Ogg/Vorbis because AIFF isn’t compressed.

It’s not an interpreter issue (except that perhaps some interpreters are lax and not catch errors that they’re meant to.) If you’re talking about what I think you are, then the issue is outputting text when waiting for input. The new Inform will make this easier to avoid, including, for example, automatically pausing input if it has to output a run time error.

Yeah, that’s probably it. At the moment, the holdup has to do with printing lists or repeat through texts where there isn’t as much opportunity for managing the gaps.

Since I never reported back after we last discussed this, the newer version of GEP resolves pretty much every resize problem I’ve run into, but doesn’t seem compatible with bisquixe links. I look forward to seeing what’s next for Inform!

Oh, you might be referring to the updated GEP I made which just incorporated the extensions I’d previously split out from it. The new Inform is much more improved than that.

Does it?

I just tested one of my itch games that has sound (a PICO-8 game). I checked the “Automatically start on page load” option, and it started when the page loaded, but without sound. The console didn’t get the AudioContext warning above though, admittedly.

I then turned the option back off, which makes itch display a big “Run game” button. Clicking that button starts the game, and presumably counts as a click, because the game once again ran with sound.

Do you have an example of an itch game that starts automatically on page load with sound? I tested my game in Chrome, in case that matters (maybe some browsers are more lax about the page “tricking” them).

1 Like

Good question. So far, it’s worked for me. Desktop plays. I just checked iPhone safari and android chrome. All good.

Try Doctor Who and the Dalek Super-Brain by strandgames

You should get the banging dr who remix. :slight_smile: