********* Welcome to Project 64! The goal of Project 64 is to preserve Commodore 64 related documents in electronic text format that might otherwise cease to exist with the rapid advancement of computer technology and declining interest in 8- bit computers on the part of the general population. If you would like to help by converting C64 related hardcopy documents to electronic texts please contact the manager of Project 64, Cris Berneburg, at 74171.2136@compuserve.com. Extensive efforts were made to preserve the contents of the original document. However, certain portions, such as diagrams, program listings, and indexes may have been either altered or sacrificed due to the limitations of plain vanilla text. Diagrams may have been eliminated where ASCII-art was not feasible. Program listings may be missing display codes where substitutions were not possible. Tables of contents and indexes may have been changed from page number references to section number references. Please accept our apologies for these limitations, alterations, and possible omissions. Document names are limited to the 8.3 file convention of DOS. The first characters of the file name are an abbreviation of the original document name. The version number of the etext follows next. After that a letter may appear to indicate the particular source of the document. Finally, the document is given a .TXT extension. The author(s) of the original document and members of Project 64 make no representations about the accuracy or suitability of this material for any purpose. This etext is provided "as-is". Please refer to the warantee of the original document, if any, that may included in this etext. No other warantees, express or implied, are made to you as to the etext or any medium it may be on. Neither the author(s) nor the members of Project 64 will assume liability for damages either from the direct or indirect use of this etext or from the distribution of or modification to this etext. ********* The Project 64 etext of the ".RAW" digitized files spec's. Converted to etext by John Andrews, obtained from either The Ranch (Harold Robbins), WireNuts (Jim Dillard), or Enterprise (Tom Hoot) BBS's in Austin TX. The original document was called "raw.txt", supplied by Tom Hoot . RAW10.TXT, July 1996, etext #62. ********* ".RAW" digitized files By Vlad/NEO You've all seen .LNX on LYNXed files, and .MUS on SidPlayer files, but now there's a new file extension- .RAW RAW files are good quality digitized sound files. This format is similar to the music on CDs, and has been used for many games, including NEUROMANCER. Many of these files originated on the AMIGA and were converted using a PD player/converter, but a few have been ripped out of games like ROBOCOP or the 3 STOOGES. These files are really quite simple in structure, and can be found on many BBS's. If you can't seem to dig any up, try the Temple Of Apshai at (312)736-6072. All .RAW files consist of 2 parts: HEADER: The header is 3 bytes long. the first 2 bytes are the load address(5120), so they're ALWAYS 0 and 20 (0+[20*256]=5120). The third byte is the speed at which the file is to be played. The LOWER the number, the faster the speed. Faster files tend to have better quality because more samples were taken per second, because lower sample rates mean you lose more of the higher frequencies. The AMIGA has 256 volume levels, from 0(no volume) to 255 (full volume). Since the Amiga files has 256 levels, each sample requires 1 byte. The 64, with it's outdated SID chip, has only 16 volume levels, 0 to 15. Because the C64 has half as many levels, it also has half the quality, but 2 samples can be packed into each byte of data. This 'packing' of data is achieved by dividing each byte (which consists of 8 bits, and can store values from 0-255) into 2 'nybbles' which are 4 bits long and which can each store values from 0-15 (16 values). When packing, you simply store the first nybble in the byte, then take the second nybble, multiply it by 16, and add it. in ML this would be achieved by: LDA first ;LoaD Accumulator with first byte AND #15 ;logical AND accumulaltor-clear top nybble ASL second ;do a Arithmetic Shift Left on second-multiply second by 2 ASL second ;do it again so x4 ASL second ;2x4= multiplied by 8 ASL second ;2x8= multiplied by 16 ORA second ;logical OR second w/Accumulator- now it holds both nybbles. You could now store the byte in memory, (with a STA) or output it to a file. To play the sound, just LOAD the file at 5120. LOADing the file (as opposed to READing it in byte-by-byte) will automatically omit the load address (the first 2 bytes) so the value in 5120 will be the speed. To play the sound, you just reverse the process, adding a delay to slow down the output to the correct speed: LDA data ;get a byte PHA ;PusH Accumulator-store a copy on the stack for later use AND #15 ;AND A w/ 15 to clear top nybble, so we have a value 0-15 STA 54296 ;Store A in volume-set volume PLA ;Pull Accumulator-get the byte back off of the stack LSR ;do a Logical Shift Right on accumulator- divide by 2 LSR ;divide again. 2x2=4 LSR ;again- 4x2=8 LSR ;finally- divided by 16 STA 54296 ;set volume again LDX 5120 ;LoaD X-register- get speed for use as a delay LOP NOP ;pause (NO oPeration) DEX ;Decrement X-register.(x=x-1) BNE LOP ;Branch if last operation was Not Equal- go back to LOP This will play 1 byte. A more sophisticated routine is needed to play a whole file, which can range from under 8 blocks (2,030 bytes, or 4,060 samples!) to 174 blocks (44,000 bytes, or nearly 90,000 samples!!) or even longer. The limit is 202 blocks, which would be well over 100,000 samples. There is a simple player on the next page, but you'll have to find .RAW files on your own. If you send 3 DSDD 5.25 disks in a mailer (for 1541) or 2 DS 3.5 disks (for 1581) then I'll return a disk packed with .RAW files, plus a copy of the latest version of my player. John Andrews 2701 W. Howard Chicago, IL 60645 ********* The end of the Project 64 etext of the ".RAW" digitized files spec's. *********