--------------
PCEnc.exe
Pokemon Cry Encoder ALPHA
README
--------------

This Program is protected by the GPL (Gnu Public License).
You may modify it, but you have to include the Source if you distribute it for deteils read the
GPL.

How it works:

-Create a 8 bit 11khz Signed PCM Wave File With a Standart header 
(no non wave parts in the end like copyright and stuff) 
-Run:
 - PCEnc Mywav.wav

You'll get Mywav.wav.dmp. To test the encoded Sample Start VBA and load a german 
copy of Pokemon Ruby.

1. Go tools -> Memory Viewer
2. Select 8-Bit
3. Click Load and load the dmp file
4. Select the desired offset - we'll use 0x085D0948 (which is Treecko's Sample adress)

(To get more adresses use this formula:
0x4604E4+(index+6)*12+4
index = pokemon id - this will direct you to the pointers - however I am not yet 100% sure
if it works 100%, you'll get Bulbasaur with index = 1, though :))

5. In Game open Pokedex and view Treecko's entry 
6. Select "Cry" and listen to the new Sample - Enjoy

How it works
--------------------
This Section will describe the Sound Format of the Cry Samples
Lets assume your Encoded Sample Looks like this:
77 01 F0 C0

The First byte will be copied so you have:
77

The first 0 after the Copied byte has no purpose so we ignore it.
The next Values will be checked in a table:

 0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
00 01 04 09 10 19 24 31 C0 CF DC E7 F0 F7 FC FF

In our Case we have to use 01. Now we add 01 to the last byte, 77 -> 78 thats our 2nd byte
We have:
77 78

No we continue with F -> 78 + FF = 177 Since it's a byte it's 77 We get:
77 78 77

With 0 -> 77+0 = 77
77 78 77 77

Now C -> 77 + F0 = 167
77 78 77 77 67

And Finaly 0 -> 67+0 = 67
77 78 77 77 67 67

Onle last note every 21th byte is copied directly and the next byte is always 0X only using the
lower 4 bits.

That's it :)

My Encoder Is doing the opoisite (naturally) - and it's trying to stay as close to every single
byte as possible.  

(C) 2003 by loadingNOW / pika
