[Scummvm-devel] compressing Dragon History dubbing into MP3/OGG/whatever

Max Horn max at quendi.de
Mon Jun 7 10:09:14 CEST 2010


Hi Robert, all,

Am 07.06.2010 um 06:45 schrieb Robert Špalek:

> hi guys,
> 
> I've been thinking that now that the Dragon History code is stable and plays well the original game files, the time has come to add support for decoding compressed dubbing, so that one can decrease the length of the game archives that need to be downloaded.  the game uses 8-bit mono uncompressed audio recorded in 22 kHz, and it takes 144 MB uncompressed, 66 MB as a ZIP file, and 46 MB as a RAR file.  compressed in a lossy audio format, one could hopefully achieve 1/8 of that.

Indeed!

> 
> I already have a trivial C-program that reads that dubbing archive and produces a few thousand of raw audio files.  it won't be too hard to write a shell script that iterates through all of them and runs a codec on each of them.  I could possibly even use one of the ScummVM tools to do this recoding (which one?).
> 
> I have a few questions targeted at minimizing the time I'd have to spend experimenting with things to achieve an acceptable outcome.  I hope some of you is experienced in this area.
> 
> 1. what is the best known codec and its settings for audio with the parameters above?  I'm not sure whether MP3 or OGG is better in this range, what's the desired bit-rate, and which one format is generally preferred (considering the cpu needed to decode it).

I strongly recommend supporting all of FLAC, Ogg and Vorbis: FLAC satisfies the desire of some collectors who do not want to loose a single bit of audio data, no matter how "lossy" it was to start with. And some of our target platforms only support MP3 our of the box (since MP3 playback still takes a bit less CPU and memory resources than Ogg Vorbis playback); while other ports only can do Ogg Vorbis (various Linux distros by default do not ship with MP3 support due to legal reasons).

Luckily, due to the way ScummVM handles sound codecs, it is almost trivial to support all three codecs simultaneously; indeed, many of our engines already do just that!


> 2. is there a nice library in ScummVM implementing reading an archive of compressed sound files? 

[...]

The Common::Archive class and subclasses are meant for that. We already provide implementations for reading from regular directories, from ZIP files and from ARJ files; you could use one of these, or you could roll your own trivial format, though I guess just using ZIP would do the job for you. 

However, if you really store all audio data in a single archive file, then some care has to be taken debugging this on various platforms; indeed, if you want to play multiple audio "files" simultaneously, all coming from the same source archive file, then seeking in those files might lead to conflicts. Alas, if this turns out to be a problem, it is trivial to resolve by loading the data in question into a memory block first (though this then in turn may cause issues on low-end low-memory devices)...

Actually, the above makes it sound more difficult than it is, I guess; don't worry too much about it, we have plenty experience dealing with all this in our team ;). Just use Common::Archive and the whole Common::Stream API, and you should have little problems.


> I'd like to modify the game engine such that it would accept whichever dubbing is available.
> 
> by the way, I have been contacted by someone from Internet who sent me about 80%-corrected English scripts.

That's good. I wonder if those are the same folks who are discussing just that on our forums? Have you had a look at the draci translation thread there?

And then of course some folks were talking about other translations, e.g. to German... :)


Cheers,
Max



More information about the Scummvm-devel mailing list