GAME: RTC can't interprete compressed WAVE files
Moderator: George Gilbert
Forum rules
Please read the Forum rules and policies before posting.
Please read the Forum rules and policies before posting.
GAME: RTC can't interprete compressed WAVE files
As standard WAVEs take a lot of diskspace and RTC files are growing very quickly, I tried to add to the project some compressed ones but I got an error as below:
*** CRITICAL ERROR (line 24): Could not interpret sound file for SOUND_OTHER_GROWL3. Expecting a WAVE or RIFF encoded file.
I can play the same file under editor so I think it's some problem concerning implementation of DirectX functions in RTC engine ?
Pedro
*** CRITICAL ERROR (line 24): Could not interpret sound file for SOUND_OTHER_GROWL3. Expecting a WAVE or RIFF encoded file.
I can play the same file under editor so I think it's some problem concerning implementation of DirectX functions in RTC engine ?
Pedro
- George Gilbert
- Dungeon Master
- Posts: 3022
- Joined: Mon Sep 25, 2000 11:04 am
- Location: London, England
- Contact:
Interesting - as you say, it's down to the DirectX layer as RTC just passes the byte stream into the DX APIs and "hopes" it works. RTC itself doesn't actually *do* anything with the data.
It it works in the RTC editor though, that's interesting - i implies that the call I make to the DirectX API is slightly different, so it something that could be fixed.
Can you send me the file you're using and I'll have an experiment to see whats going on!
It it works in the RTC editor though, that's interesting - i implies that the call I make to the DirectX API is slightly different, so it something that could be fixed.
Can you send me the file you're using and I'll have an experiment to see whats going on!
- Gambit37
- Should eat more pies
- Posts: 13720
- Joined: Wed May 31, 2000 1:57 pm
- Location: Location, Location
- Contact:
If you take an uncompressed PCM WAVE file and save it in a .RTC file, it's automatically compressed by around a factor of 4 (George's RTC format is compressed, like a ZIP file).
If your compressed WAVE file is in 4-bit ADPCM formt, you'll be making around about the same savings.
To make truly noticeable gains in file-size reduction you need a more efficient lossy format such as MP3 or OGG. Would it be hard to add that George?
If your compressed WAVE file is in 4-bit ADPCM formt, you'll be making around about the same savings.
To make truly noticeable gains in file-size reduction you need a more efficient lossy format such as MP3 or OGG. Would it be hard to add that George?
WAVE files are generally difficult to compress. One of the most efficient WAVE loseless compressor is APE format. It gains about 40-60% (~about 1/2) of original size. To check my words I made a quick test:Gambit37 wrote:If you take an uncompressed PCM WAVE file and save it in a .RTC file, it's automatically compressed by around a factor of 4 (George's RTC format is compressed, like a ZIP file).
If your compressed WAVE file is in 4-bit ADPCM formt, you'll be making around about the same savings.
decompressed WAVE = 73812 bytes
decompressed WAVE compressed by ZIP = 62189
compressed WAVE (lossy) = 16710 bytes
compressed WAVE (lossy) compressed by ZIP = 16250
Results:
compressed WAVE gains ~77.4%
decompressed WAVE compressed by ZIP gains only ~15.7%
compressed WAVE ≈ compressed WAVE compressed by ZIP
The results show that compressed lossy WAVES save a lot of space.
@George: I sent an example WAVE to your account at ragingmole.com
Pedro
It just came into my mind that DX has probably nothing to do. The error occurs when the project is compiled and I suppose this is concerned with including of resource file into data. Compressed WAVE has probably a slightly diffrent header which is not recognised as WAVE file by your code. I think that problem can disappear if you include it as binary file and not as WAVE file.George Gilbert wrote:Interesting - as you say, it's down to the DirectX layer as RTC just passes the byte stream into the DX APIs and "hopes" it works. RTC itself doesn't actually *do* anything with the data.
Of course this is only my theory.
- George Gilbert
- Dungeon Master
- Posts: 3022
- Joined: Mon Sep 25, 2000 11:04 am
- Location: London, England
- Contact:
Sadly the theory is wrong. RTC saves whatever you put as the filename as a binary stream without looking at it at all. It then passes the stream directly to the DirectX APIs. When the file is compiled etc it makes no difference whatsoever; it's just a string of bytes that RTC knows nothing about; it relies on DirectX to parse the headers etc and return any errors it sees fit.
Gambit raises an interesting point; the RTC format is indeed compressed. It's not particularly optimised for sound files but it will probably do a reasonable job. I wonder what the difference is between the size of an RTC file with a compressed WAV and one with an uncompressed one would be...
As for accepting other formats (MP3 etc), again that comes to what is available across the DirectX interface. At the risk of labouring the point, there's no code in RTC to read, let alone play sound files and I don't particularly fancy adding that in as it's probably quite a large amount of work!
Gambit raises an interesting point; the RTC format is indeed compressed. It's not particularly optimised for sound files but it will probably do a reasonable job. I wonder what the difference is between the size of an RTC file with a compressed WAV and one with an uncompressed one would be...
As for accepting other formats (MP3 etc), again that comes to what is available across the DirectX interface. At the risk of labouring the point, there's no code in RTC to read, let alone play sound files and I don't particularly fancy adding that in as it's probably quite a large amount of work!
- Gambit37
- Should eat more pies
- Posts: 13720
- Joined: Wed May 31, 2000 1:57 pm
- Location: Location, Location
- Contact:
There's tons of players and freely available code on the net for playing back MP3 and OGG -- I don't understand how it could possibly be a lot of work. Make use of GPL software -- you don't have to do all this stuff yourself!
I just checked www.vorbis.com for more info but it's currently down.
I just checked www.vorbis.com for more info but it's currently down.
I cannot say much without source code but I'm wondering why the error occures while project is compiled if you don't use any DX API at this stage.George Gilbert wrote:Sadly the theory is wrong. RTC saves whatever you put as the filename as a binary stream without looking at it at all. It then passes the stream directly to the DirectX APIs. When the file is compiled etc it makes no difference whatsoever; it's just a string of bytes that RTC knows nothing about; it relies on DirectX to parse the headers etc and return any errors it sees fit.
So lets look here:George Gilbert wrote: I wonder what the difference is between the size of an RTC file with a compressed WAV and one with an uncompressed one would be...
WAVE uncompressed = 73812 bytes
WAVE compressed = 16710 bytes
RTC after compilation and compression enlarged 61760 bytes so the gain is ~16.3% - much less than for compressed lossy WAVE.
To tell the truth, I don't need this possibility (compressed WAVEs) to be a happy RTC user. But I'm not sure if other people will be happy too when they will have to download, for example, 10MB dungeon.
- George Gilbert
- Dungeon Master
- Posts: 3022
- Joined: Mon Sep 25, 2000 11:04 am
- Location: London, England
- Contact:
- George Gilbert
- Dungeon Master
- Posts: 3022
- Joined: Mon Sep 25, 2000 11:04 am
- Location: London, England
- Contact:
- Gambit37
- Should eat more pies
- Posts: 13720
- Joined: Wed May 31, 2000 1:57 pm
- Location: Location, Location
- Contact:
Which bit was fixed? The playing of compressed wavs, or the addition of MP3?
I've been messing with background music and trying full CD quality wavs -- two of my files bloat the RTC file to 68MB and cause memory problems (slow gameplay and texture droput). If these were compressed wavs, they'd be about 17MB. On the other hand, MP3 equivalents are around 6MB.
For large downloads, if you're going to add the BGM support, MP3 really is a must. It's available to most windows PCs across DirectX. Do you think you will be adding this support?
I've been messing with background music and trying full CD quality wavs -- two of my files bloat the RTC file to 68MB and cause memory problems (slow gameplay and texture droput). If these were compressed wavs, they'd be about 17MB. On the other hand, MP3 equivalents are around 6MB.
For large downloads, if you're going to add the BGM support, MP3 really is a must. It's available to most windows PCs across DirectX. Do you think you will be adding this support?
- George Gilbert
- Dungeon Master
- Posts: 3022
- Joined: Mon Sep 25, 2000 11:04 am
- Location: London, England
- Contact:
- Sophia
- Concise and Honest
- Posts: 4240
- Joined: Thu Sep 12, 2002 9:50 pm
- Location: Nowhere in particular
- Contact:
For what it's worth, Ogg/Vorbis has a nice toolkit for decompressing and playing sound files, too. I managed to get it working in a program I was writing very quickly-- of course, it was already internally suited for playing background music. It seems like the audio code for RTC is suited more for one-shot sounds.
Just another thought, though.
Just another thought, though.