Opened 20 years ago

Closed 20 years ago

Last modified 5 years ago

#7346 closed feature request (fixed)

AUDIO: compress music from Broken Sword

Reported by: SF/noscript Owned by: lavosspawn
Priority: normal Component: Engine: Sword1
Version: Keywords:
Cc: Game: Broken Sword 1


The Files from the MUSIC Directory are WAVs. So it could be compressed to OGG or MP3. But it must be supportet from scummVM.

Ticket imported from: #875396. Ticket imported from: feature-requests/162.

Change History (11)

comment:1 by fingolfin, 20 years ago

Indeed, they could be.

Also, for Broken Sword 2, see < index.php? func=detail&aid=854561&group_id=37116&atid=418822>

comment:2 by fingolfin, 20 years ago

Summary: compress music from Broken SwordAUDIO: compress music from Broken Sword

comment:3 by aquadran, 20 years ago

eriktorbjorn: what is current status for that support ?

comment:4 by aquadran, 20 years ago

Owner: set to eriktorbjorn

comment:5 by eriktorbjorn, 20 years ago

Broken Sword 2 supports compressed speech and music in the development version. Broken Sword 1 currently doesn't. Still, Broken Sword 1 could probably use a similar implementation.

For Broken Sword 2, I did the following:

I already had an extract/compress program, as described in an earlier comment. I had to make a few changes to it, but nothing too major. (Well, the format of the compressed file had to be changed slightly, but I didn't consider backwards compatibility important at this stage. :-)

For playback, I first I wrote an AudioStream class to decode Broken Sword 2 compressed audio. This is used for both speech and music. There are two functions that deal with speech - one for playing it immediately, and one to decode it to a buffer to be played later - both of which were easily rewritten to use the new AudioStream class.

The next, and much tricker, step was to rewrite the music code to use this AudioStream class. I wrote a new AudioStream class that would simply use another AudioStream object for decoding the sound - a kind of "wrapper" - and then added fading and looping on top of that.

You may have noticed a pattern here: The trick is to rewrite the playback to use AudioStream objects. Once that works, you can easily replace the custom decoders with one of the stock decoders: MP3, Ogg Vorbis or FLAC. (Though for Broken Sword 2, FLAC actually produces larger files than the originals.)

"Enough about Broken Sword 2," I hear you cry. "What about Broken Sword 1?"

Well, for one thing it appears to use a different compression scheme for the speech (and the demo apparently uses a slightly different header format than the full game), so a new extract/compress program would have to be written, as well as a new AudioStream class for playback.

The "wrapper" AudioStream class for music could probably be adapted for Broken Sword 1 without too much trouble. As has been noted, Broken Sword 1 stores its music as separate WAV files. I don't think we have any AudioStream class for that, but this should be fairly trivial.

In theory, at least. I haven't actually done any work on it.

comment:6 by eriktorbjorn, 20 years ago

Owner: changed from eriktorbjorn to lavosspawn

comment:7 by eriktorbjorn, 20 years ago

Reassigned to lavosspawn, since he appears to have done most of the work on it already. (Good thing, too, since I hadn't even planned on looking at it any time soon.)

comment:8 by lavosspawn, 20 years ago

feature added. :)

comment:9 by lavosspawn, 20 years ago

Resolution: fixed
Status: newclosed

comment:10 by eriktorbjorn, 20 years ago

Not quite. You still need to write something about it in the tools README, the ScummVM README and the ScummVM LaTeX documentation. ;-)

comment:11 by digitall, 5 years ago

Component: Engine: Sword1
Game: Broken Sword 1
Note: See TracTickets for help on using tickets.