Opened 16 years ago

Closed 15 years ago

Last modified 12 months ago

#7346 closed enhancement (fixed)

AUDIO: compress music from Broken Sword

Reported by: SF/noscript Owned by: lavosspawn
Priority: normal Component: Engine: Sword1
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, 16 years ago

Indeed, they could be.

Also, for Broken Sword 2, see <

comment:2 by fingolfin, 16 years ago

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

comment:3 by aquadran, 15 years ago

eriktorbjorn: what is current status for that support ?

comment:4 by aquadran, 15 years ago

Owner: set to eriktorbjorn

comment:5 by eriktorbjorn, 15 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

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

"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, 15 years ago

Owner: changed from eriktorbjorn to lavosspawn

comment:7 by eriktorbjorn, 15 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, 15 years ago

feature added. :)

comment:9 by lavosspawn, 15 years ago

Resolution: fixed
Status: newclosed

comment:10 by eriktorbjorn, 15 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, 12 months ago

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