News:

Herr Otto Partz says you're all nothing but pipsqueaks!

Main Menu

Sound Files Editing (VCE)

Started by Zapper, July 27, 2010, 06:18:39 PM

Previous topic - Next topic

Cas

Yes, I gave a look at a few of these VCE files and it's true that the first dword does not seem to have a logical value. All other RES files in Stunts follow the simple rule that I tried to describe (that is, by suggesting it probably isn't truly the "file length", but the position where the next chunk should be attached if there were another, so that you know the length of the last chunk; in practice, pretty much the same thing). But even if you understand this field my way, it still doesn't match for VCE files. However, I am feeling that, if you change this to whatever you please, that doesn't affect Stunts. Then the question is why it was generated with that value, but still, we can give it the "right" one. Kind of like why car RES files have their chunks misordered for original cars, but still, the "right" order works.
Earth is my country. Science is my religion.

llm

Quote from: Daniel3D on July 10, 2022, 11:18:30 PM
The 100 bits are sound samples, and I am searching for a way to analyze it or visualize it. I came upon the article below.

100 bytes or 800 bits

llm

#77
Quote from: Cas on July 11, 2022, 06:08:23 AM
Yes, I gave a look at a few of these VCE files and it's true that the first dword does not seem to have a logical value.

its called "reportedSize" in stressed source code (https://github.com/dstien/gameformats/blob/9827f7c1a88db5bf92f1ac9e752bb3f14bd378b3/stunts/stressed/src/app/resource.cpp#L69)

if (reportedSize != fileSize) {
      quint8 compType = reportedSize & STPK_PASSES_MASK;
      ...


but that does also not give a clear logical results ... maybe its just ignored - its time to analyse the VCE reader code in restunts :)



llm

Quote from: Daniel3D on July 10, 2022, 07:37:50 PM
If you remove the corrupted chunk in stressed and replace it with a good one, stressed will update the offsets automatically.

i can't find the coed place in stressed were the VCE file gets rewritten - do you use the raw edit? that just seems to write the bytes that gets loaded to the file - no re-ordering or setting of the offset-table - but im not a stressed pro :)

llm

#79
the VCE handling in restunts is in seg027.asm

function:
  init_audio_resources
    parameter:
       var_titlptr - for the title string
       arg_vcefileptr - for the VCE file content (i think)
  audioresource_find
  audio_map_song_instruments
  audio_map_song_tracks
  load_voice_file <--

  this one seg008.asm loads the file + title - best candidate for a detailed analysis :)
     file_load_audiores

Daniel3D

#80
Quote from: llm on July 11, 2022, 10:26:43 AM
Quote from: Daniel3D on July 10, 2022, 07:37:50 PM
If you remove the corrupted chunk in stressed and replace it with a good one, stressed will update the offsets automatically.

i can't find the coed place in stressed were the VCE file gets rewritten - do you use the raw edit? that just seems to write the bytes that gets loaded to the file - no re-ordering or setting of the offset-table - but im not a stressed pro :)
Stressed has to update the header and offset table. otherwise, every edit would break the file.
(most stunts resources are Chunk based and have the same buildup regardless of the extension)
Stressed can manage all chunk based resource files now it has an escape in raw data.
Stressed loads only the contents of the chunks as raw data the rest of the file it understands.
So you can add, remove and hex-edit chunks without problem.
Edison once said,
"I have not failed 10,000 times,
I've successfully found 10,000 ways that will not work."
---------
Currently running over 20 separate instances of Stunts or 4D Sports Driving.

Daniel3D

I started rereading the tread. The current discussion may shed new light on old information.
Quote from: dstien on December 13, 2011, 02:11:37 PM
VCEs are Stunts resource archives. Working on the MIDI file conversion I identified some values in the MT-32 voices file that holds MIDI controller data:

char *vce = findResource(vceBuf, seq->voices[i].id);

if (vce == NULL) {
  seq->voices[i].enabled = false;
}
else {
  seq->voices[i].enabled   = true;
  seq->voices[i].channel   = vce[0x43];
  seq->voices[i].program   = vce[0x44];
  seq->voices[i].volume    = vce[0x45];
  seq->voices[i].pan       = vce[0x46];
  seq->voices[i].transpose = vce[0x10];
  seq->voices[i].hasHits   = vce[0x25];
}

Edison once said,
"I have not failed 10,000 times,
I've successfully found 10,000 ways that will not work."
---------
Currently running over 20 separate instances of Stunts or 4D Sports Driving.

llm

i think that the "samples" are device orientated - that means the instrument-data for pc, adlib or MT32 sound is completely differenly encoded
in a more direct form for the sound driver - only a guess


Daniel3D

Quote from: llm on July 11, 2022, 02:58:04 PM
i think that the "samples" are device orientated - that means the instrument-data for pc, adlib or MT32 sound is completely differenly encoded
in a more direct form for the sound driver - only a guess
I remember zapper mentioning that the first part of the chunk is different and at a certain point they become the same.
From that and the above info (off which I am not sure if it is related to the chunk itself, but I think so) I gathered that the sound wave itself is the same for all. But that was a big assumption.
I have not checked that. But now that you bring it up. I will check it tonight.
Edison once said,
"I have not failed 10,000 times,
I've successfully found 10,000 ways that will not work."
---------
Currently running over 20 separate instances of Stunts or 4D Sports Driving.

llm

#84
the first uint16 is 0x5D or 0x64 = size of the data block, then comes a uint16 with 1 - some differences


ADENG1.VCE title. 'ENGI'

         xxxxx yyyy
  0000:  64 00 01 00 00 00 00 00 00 00 00 00 FE 00 0B 00 00 00 02 00 00 00 00 00 00 00 00 00 00 0F 00 0F d...............................
  0020:  00 0F 00 06 40 0B 2A 00 90 00 00 00 FF 7F 0F 00 0B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ....@.*.........................
  0040:  00 00 00 00 00 07 0F 07 00 0F 16 00 03 00 01 00 00 00 0F 00 00 0F 00 00 00 00 01 00 00 03 00 00 ................................
  0060:  00 00 00 00                                                                                     ....

PCENG1.VCE title: 'ENGI'

         xxxxx yyyyy
  0000:  5D 00 01 00 00 00 00 00 00 00 00 00 14 00 06 00 00 00 00 00 00 00 00 00 00 00 1D 01 22 01 2C 01 ]...........................".,.
  0020:  2C 01 2C 01 2C 01 2C 01 02 00 00 00 FE 7F 5E 01 77 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 ,.,.,.,.......^.w...............
  0040:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00          .............................

MTENG1.VCE 'ENGI'

  0000:  5D 00 01 00 00 00 00 00 00 00 00 00 00 04 3C 00 0C 00 18 00 00 00 00 00 00 00 00 00 2C 01 2C 01 ].............<.............,.,.
  0020:  2C 01 2C 01 2C 01 2C 01 00 00 00 00 FE 7F B9 00 5A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ,.,.,.,.........Z...............
  0040:  00 00 00 11 00 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00          ......@......................

TDENG1.VCE 'ENGI'

  0000:  5D 00 01 00 00 00 00 00 00 00 00 00 06 00 05 6D E8 00 00 00 00 00 00 00 00 03 00 00 FF 0F FF 0F ]..............m................
  0020:  00 00 00 00 00 00 33 03 02 00 00 00 FE 7F 17 00 3B 00 00 00 03 00 00 00 00 00 00 00 00 00 00 00 ......3.........;...............
  0040:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00          .............................
 
   

Zapper

#85
I'm seeing that you all have harvesting some useful information! :D But let me bring some information that I noted when changing "engine" sound on ADENG1.VCE bytes:

"Instrument data:

Lines (100 byte split)
1: STOP
2: STAR
3: ENGI ->
   Columns (decimal offset)
      300..339: not tested
      343: change pattern (decimal values: 15-31-47)
      344: change pattern (decimal values: 15-22-28-82)
      346: change pitch (decimal values: 3-5-7)
      352:   fadein
      356: fadeout
      358: change pattern (decimal values: 0-6)

4: BLOW
5: SKID
6: SCRA
7: BUMP
8: CRAS
"




These notes can be gathered into a wiki to describe VCE content files.

Zapper

#86
Quote from: Daniel3D on July 08, 2022, 12:08:46 PM
@zapper. You know, I think, more than most of us about how the game processes the sound files. Can you lower the tone of SKI2 so that it is more of a rumble?

@Daniel3D, here you have the file (based on ADENG1.VCE you post before) with a lower tone grass skid sound.

Changes signaled below:


llm


3: ENGI ->
   Columns (decimal offset)
      300..339: not tested
      343: change pattern (decimal values: 15-31-47)
      344: change pattern (decimal values: 15-22-28-82)
      346: change pitch (decimal values: 3-5-7)
      352:   fadein
      356: fadeout
      358: change pattern (decimal values: 0-6)


count that for every instrument-data-block (a' 100 bytes)?
so the 300 offsets is seen from block a 0 offset

the absolute offsets in the file can be easily splitted into logical instrument-data-blocks
(im currently writing a short tool that extracts the instrument blocks and combines these blocks again in VCE a file)

"extract" creates a info-file with the names and order of the instruments-blocks and a single instrument-data-block for each title
"combine" reads such order file and creates a VCE using the datablock files - but without the gaps that sometimes occure


instrument-data block
      0: uint16 block-size - that is known
      2: uint16 unknown - that seems to be always 1
      4..39: not tested
      43: change pattern (decimal values: 15-31-47)
      44: change pattern (decimal values: 15-22-28-82)
      46: change pitch (decimal values: 3-5-7)
      52: fadein
      56: fadeout
      58: change pattern (decimal values: 0-6)



Daniel3D

Quote from: Zapper on July 11, 2022, 06:38:46 PM
Quote from: Daniel3D on July 08, 2022, 12:08:46 PM
@zapper. You know, I think, more than most of us about how the game processes the sound files. Can you lower the tone of SKI2 so that it is more of a rumble?

@Daniel3D, here you have the file (based on ADENG1.VCE you post before) with a lower tone grass skid sound.

Changes signaled below:


Very neat. It sounds better, I only cleaned the end of the file up a bit. But I love it. Nice work.
Edison once said,
"I have not failed 10,000 times,
I've successfully found 10,000 ways that will not work."
---------
Currently running over 20 separate instances of Stunts or 4D Sports Driving.

llm

#89
added export/import feature to my vce_dump tool

how to use:

vce_dump c:\temp\stunts\PCENG1.VCE

shows VCE content

vce_dump c:\temp\stunts\PCENG1.VCE e c:\temp\stunts\pceng1_vce

exports VCE content into the pceng1_vce folder - only the instrument data is exported in to title-named bin files
the rest information (header,offsets etc) is not needed for importing


pceng1_vce\
  BLOW.bin <- *.bin files containing the instrument-data block for each title
  BUMP.bin
  CRA2.bin
  CRAS.bin
  ENGI.bin
  order.txt <-- contains the ordering of the titles (the names are case insensitive if relevant) - gets read on import
  SCRA.bin
  SKI2.bin
  SKID.bin
  STAR.bin
  STOP.bin


vce_dump c:\temp\stunts\pceng1_vce\new_PCENG1.VCE i c:\temp\stunts\pceng1_vce

create a new_PCENG1.VCE in the pceng1_vce folder based on the order.txt and .bin files

without gaps/dirt but sorted offset table

a very small pocket knife for combining instrument data

just copy the wanted bin files with the correct titles in a folder + a order.txt with the ordering and then import :)