Community

SCI Programming => SCI Development Tools => Topic started by: cdb-boop on April 25, 2026, 06:25:00 PM

Title: Looping Audio in SCI1.1?
Post by: cdb-boop on April 25, 2026, 06:25:00 PM
I'm porting a SCI1 game to the SCI Companion's SCI1.1 template game and some of the SCI1 Sound assets have a digital track embedded. I used Sierra Resource Viewer (https://sciwiki.sierrahelp.com/index.php/Sierra_Resource_Viewer) to extract all the digital tracks as WAV files and add them as Audio resources (using unused numbers, as Sound and Audio assets share a namespace).

I have been auditing the code's 374 play: calls and making modifications to affected sounds. For example, using (DoSound sndGET_AUDIO_CAPABILITY) to dynamically swap between using Sound and Audio asset depending on audio driver. I also ended up creating a DigitalSound wrapper class to emulate cases of dynamically setting a Sound object's number property for play later.

So far I've found two cases (battle yelling and tavern chatter) where a Sound with a digital track is looped for ambiance. I looked at the SCI Companion Docs but I didn't see a way to loop DoAudio in SCI1.1. Is there a built-in way to loop Audio, like setting the Sound class's loop property to -1? I was wondering if it was possible to attach a script to a room's script to detect when it was time to loop the audio, or make a global list like gSounds or global object like gMusic and add check in the main game loop. Or should I just use gumby's sciAudio (https://sciprogramming.com/community/index.php?PHPSESSID=e0992273f7d941509d32f5df6f205f8f&topic=634.0) which supports looping but is not "authentic"?

Is there a best or intended way to loop Audio in SCI1.1?
Title: Re: Looping Audio in SCI1.1?
Post by: cdb-boop on April 25, 2026, 08:20:08 PM
Never mind. I realized you can just call an Audio resource with DoSound and loop with -1 infinitely.
Title: Re: Looping Audio in SCI1.1?
Post by: doomlazer on April 28, 2026, 06:57:22 PM
(using unused numbers, as Sound and Audio assets share a namespace).

I believe that despite seeming to share the same resource numbers you can differentiate between sound and audio by prepending a 1 before the number to use digital audio.

For example, in LB2 most songs are MIDI, but "The Archaeologist Song" has both a MIDI version and an audio version with lyrics. So you can call the MIDI version with 312 or the digital version with 1312.
Title: Re: Looping Audio in SCI1.1?
Post by: lskovlun on April 28, 2026, 07:04:07 PM
Yeah, that's what one game does. But there is code in the interpreter to make sure that it generally doesn't matter whether a sound resource is MIDI or Wave.
Title: Re: Looping Audio in SCI1.1?
Post by: Collector on April 28, 2026, 07:38:49 PM
in LB2 most songs are MIDI, but "The Archaeologist Song" has both a MIDI version and an audio version with lyrics. So you can call the MIDI version with 312 or the digital version with 1312.

As in KQ5 where The Weeping Willow song has both.