Finish Him!

Video in TIB AV-Portal: Finish Him!

Formal Metadata

Finish Him!
Reversing Midway Arcade Audio with DeDCS
Title of Series
Part Number
Number of Parts
CC Attribution 3.0 Unported:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor.
Release Date

Content Metadata

Subject Area
For a decade from the early 90's to the early 2000's, Williams' Digital Compression System (DCS) audio hardware reigned supreme in arcades and casinos, providing amazing sounding music, voice-overs, and effects, blowing competing systems out of the water. This talk will reverse the DSP hardware, firmware, and algorithms powering the DCS audio compression system, used on Midway coin-ops and Williams/Bally pinballs, like Mortal Kombat II/3/4, Killer Instinct 1/2, Cruis'n USA, and Indiana Jones, among others. A tool called DeDCS will be presented, which can extract, decompress, and convert the proprietary compressed audio data from a DCS game's sound ROMs into regular WAV format, taking you back to '92, when you tossed that first quarter into MKII, and Shao Kahn laughed in your face...
Slide rule Computer animation Hacker (term) Mathematical analysis Information security Computer Computing platform Physical system
Greatest element Multiplication sign Source code Turtle graphics Logic synthesis Medical imaging Atomic number Analogy Square number Endliche Modelltheorie Error message Data compression Physical system Nintendo Co. Ltd. Curve Email Electric generator Block (periodic table) Digitizing Sampling (statistics) Sound effect Bit Sequence Oscillation Time domain Type theory Arithmetic mean Triangle Hard disk drive Self-organization Right angle Fundamental theorem of algebra Point (geometry) Game controller Computer file Characteristic polynomial Tape drive Virtual machine Diallyl disulfide Computer Trigonometric functions Frequency Goodness of fit Programmschleife Helmholtz decomposition Energy level Codierung <Programmierung> Computing platform Computer architecture Domain name Inheritance (object-oriented programming) Independence (probability theory) Volume (thermodynamics) Audio file format Frame problem Word Computer animation Drum memory Logic Mixed reality Game theory Musical ensemble Family Window Library (computing)
Program code Entropiecodierung Trapezoid Range (statistics) Function (mathematics) Revision control Roundness (object) Analogy Codierung <Programmierung> Series (mathematics) Endliche Modelltheorie Data compression Computer architecture Curve Digitizing Keyboard shortcut Sampling (statistics) Serial communication Bit Connected space Geometric quantization Befehlsprozessor Software Block diagram Logic Auditory masking Compact Cassette Game theory Family
Web page NP-hard Logical constant Implementation State of matter Execution unit Flash memory Barrelled space Raw image format Computer programming Usability Virtual memory Roundness (object) Semiconductor memory Different (Kate Ryan album) Bus (computing) Selectivity (electronic) Data compression Booting Address space Physical system Area Algorithm Touchscreen Mapping Weight Bit Line (geometry) Flow separation Type theory Word Befehlsprozessor Hexagon Loop (music) Computer animation Buffer solution Right angle Game theory Musical ensemble Window Reverse engineering
Covering space Area Shift register Digitizing Sampling (statistics) Paralleler Algorithmus Bit Heat transfer Function (mathematics) Time domain Frame problem Programmer (hardware) Computer animation Bit rate Core dump Encryption Diagram
Point (geometry) Slide rule Program code Morphing Sheaf (mathematics) Set (mathematics) Streaming media Data dictionary Causality Computer hardware File system Series (mathematics) Data compression Binary multiplier Booting Position operator Partition (number theory) Email Bit Frame problem Uniform resource locator Hexagon Pointer (computer programming) Computer animation Integrated development environment Hard disk drive Self-organization Game theory Table (information) Tuple
Module (mathematics) Digitizing Physical law Execution unit Bit Logic synthesis Equivalence relation Word Uniform resource locator Computer animation Semiconductor memory Bus (computing) Modul <Datentyp> Whiteboard Endliche Modelltheorie Window
Roundness (object) Multiplication sign View (database) Forcing (mathematics) Execution unit 1 (number) Right angle Maxima and minima Whiteboard Game theory Open set Power (physics)
Group action Roundness (object) View (database) Sheaf (mathematics) Hard disk drive
Point (geometry) Group action Program code Length Entropiecodierung Multiplication sign Genetic programming Parameter (computer programming) Data dictionary Number Revision control Heegaard splitting Medical imaging Roundness (object) Lattice (group) Term (mathematics) Computer hardware File system Data compression Booting Physical system MP3 Email Electric generator Mapping Physical law Bit Variable (mathematics) Frame problem Data stream Geometric quantization Computer animation Personal digital assistant Hard disk drive Whiteboard Musical ensemble Table (information) Near-ring
Slide rule Computer file Entropiecodierung INTEGRAL Equaliser (mathematics) Temporal logic Mass Thresholding (image processing) Frequency Different (Kate Ryan album) Data compression WinAmp Domain name Noise (electronics) Pairwise comparison Graph (mathematics) Information Fourier series Prisoner's dilemma Sampling (statistics) Sound effect Bit Time domain Data stream Word Geometric quantization Computer animation Visualization (computer graphics) Personal digital assistant Auditory masking Musical ensemble Table (information) Asynchronous Transfer Mode
Computer file Transformation (genetics) Connectivity (graph theory) Direction (geometry) Multiplication sign Virtual machine Real-time operating system Inverse element Thresholding (image processing) Term (mathematics) Core dump Sampling (music) Codierung <Programmierung> Endliche Modelltheorie Data compression Social class Curve Electric generator Mapping Block (periodic table) Sampling (statistics) Sound effect Bit Line (geometry) Time domain Geometric quantization Auditory masking Logic Cycle (graph theory) Table (information) Reading (process) Reverse engineering
Point (geometry) Slide rule Functional (mathematics) Serial port Multiplication sign Execution unit Computer programming Revision control Roundness (object) Causality Semiconductor memory Bus (computing) Office suite Data conversion Data compression Booting Area Email Scaling (geometry) Block (periodic table) Poisson-Klammer Projective plane Debugger Sampling (statistics) Bit Volume (thermodynamics) System call Frame problem Subject indexing Befehlsprozessor Voting Process (computing) Pointer (computer programming) Loop (music) Personal digital assistant Buffer solution Video game Game theory Family Speicheradresse Disassembler
Point (geometry) Email Multiplication sign Data storage device Content (media) Special unitary group Frame problem Number Uniform resource locator Word Befehlsprozessor Process (computing) Pointer (computer programming) Hacker (term) String (computer science) Buffer solution Right angle Game theory Data compression Address space
Point (geometry) Domain name Email Uniform resource locator Latent heat Geometric quantization Mixed reality Sampling (statistics) Musical ensemble Frame problem
Standard deviation Graph (mathematics) Scaling (geometry) Serial port Divisor Multiplication sign Sampling (statistics) Data storage device Sound effect Fast Fourier transform Computer animation Semiconductor memory Order (biology) Buffer solution Iteration Cycle (graph theory) Analytic continuation Data compression Traffic reporting
Domain name Point (geometry) Graph (mathematics) Smoothing Multiplication sign Sampling (statistics) Time domain Logic synthesis Frame problem Trigonometric functions Discounts and allowances Mechanism design Goodness of fit Befehlsprozessor Computer hardware Hard disk drive Waveform Software testing CD-ROM Game theory Data compression Window Physical system
the truth of their form but if from you look at the data the data with the Food how how how How around for it who thinks they're wonder making about after lunch so my talk is on now reversing midway arcade audio and so get right
into this because it a lot of slides so about me I monkey consulted by day harder hacker by nights our interest in designing reversing embedded systems IC security failure analysis arcade platforms which is what this talk is and Donald stuff and you can contact me excited 3 1 3 3 7 @ yahoo . com
so what is DCs DCs stands for digital compression system so it's a sound system developed by Williams Electronics and used in Williams pinballs the casino slot machines and Midway corner arcade games so the architecture provides us 6 channels of 16 bit audio independent and with independent control over the volume looping and playback of these those channels so distinct the distinction is it's not uh um I caught 6 voices at the IP six-channel platform e because it actually it's down next to to mono or stereo or whatever whatever the harbor supports on the particular implementation and so can play back anything from short sounds sound effects 2 voice-overs to some minute long music tracks which of before that was unheard of you laugh it would all have to be tracked or composed MIDI style I FM synthesis music so 1st log to use it was our Indiana Jones 93 and the 1st arcade game use it was more common to also 93 to a few variants that Williams made over the years is by the 1st PCs 1 so it's wrong based model and uses the DSP 21 0 5 with a single back then there's DCS 95 which was used for the for some of the malls this DCs to run based stereo so it's gotta be feared yes the running to to Dax left and right channel DCs to RAM-based stereo so our RAM-based meaning in I the around this this this 1 and the the 1 underneath it around this multi-channel basically they moved architecture to slow the game started using our shipping on hard drives instead of what you drums the so the multichannel variant can run up to 6 that's for us surround sound types of deployment the and interesting I think I'd supports the DSP 21 81 that that the the bottom 1 so I haven't the optical so basically a quick history of arcade audio there's been several techniques over the years but so there's analog which was we have literally discrete components and amplifiers are senior whatever to generate sound that way all oscillators things about then there was sound digital sound generated chip so like to simple Nintendo's style square triangle whatever wave and saw tooth all you that way um natural see clip playing at the is it possible to get D of audio com ing out the main speakers the all the and so this is in thing and in the sinking it's like basically blips and bleeps and Nintendo stop then next came the of FM synthesis error homes of we which was so example this was Jacqueline 1986 is used Yamaha FM synthesis so the in the dead of time so pretty basic in then it moved to sample based systems like of all run which still used Yamaha python synthesis but I use the PCM sample I see so it at the end and then off that was followed a few years later by ideas of fancier sample see in for example turtles and time in 91 the 2 and so I will highlight that 1 because decomposition is good even if the instrument sound terrible in it the compared to other games out there so then can related here's moral combat 1 which did not use CS did a same thing use the MRI with a sampling chips so it's but the so you can hear it's kind of teeny grows at them synthesis Characteristics Sound and after that game Super Street Fighter 2 terrible for example again using the EML but what the q sound um DSP and then just for reference 3 5 3 3rd strike In 99 used a 16 channel so 16 voice but 8 bit sample I Cecil to there's the the height the DA to hear the voices kind the the sound that was put the scratchy at this is a bit sampling whatever and then finally um can really back related to this talk is unwelcome at 2 Kimmo 93 and it uses the it was the 1st game using PCs are using the Analog Devices ADS-B 20 100 family no Yamaha's like no atoms have just everything on the DSP sold to a demo of theirs in which it yes the if we do this and in get there so already will do good morning show you uh no I don't know when you're listening to the music the the drums it's not some we've table or like you or 32 words pointer drum sample this is actually composed music where it was done in the studio the mix was was done right in the master was then encoded like it was done like like modern music composition basically it's not a sequencer telling you drumhead drumhead bass note typing it was actually like Cook composed as a complete track so the final the final kind of error is modern PC like most arcade harbor nowadays just x 86 based and it just has on middleware libraries to do wave organ 3 etc. so and this right so
how DCs works what what are the fundamentals what is it doing so you have an uncompressed wave file or whatever source from a DAT tape or whatever they would have been using in the nineties but encoded offline on a PC so lots of the heavy lifting the logic is all than an encoded and decoded is still complicated but it doesn't need to do nearly what the encoder needs to do got a files audio files are broken down into frames of 240 samples and then each frame 7 . 6 8 ms of audio so that's a good compromise this allows and get a really short sound you can get really tight with how where you want that the DSP engine to slice it for looping and I and yet as having tight control over stocks starting sudden sound so the sounds can range from 1 to several thousand frames of the 7 . 6 8 ms of audio each frame is transformed from time domain to frequency domain are by 256 point FFT so use is called a simple cosine window and with 8 samples of overlapAny Chen not simply to To avoid audio artifacts a glitching sounds so there's all and this resulting spectrum that you get is broken down into 16 subbands and then quantized according to masking curves and user control promise a masking curves are curves that the audio engineers would tuned to say basically I know it's in the strong note at this frequency it's gonna hide the notes underneath it so we don't need any notes underneath there can be discarded effectively and and so these quantizing levels and the resulting audio data for each frame a entropy encoded as into variable-length packets and these packets and for each audio file a combined with header header blocks uh denoting the beginning of each frame in each sound and those are stored as far and stored as files that can be burned into the wrong from images so
architectually very similar to an MPEG-1 Layer 1 and Layer 2 so M 1 and M P 2 which is like Sony STDs which is on a trapezoid that many days and there is a dip Philips digital compact cassette which was an actual cassette tape that in that had digital encodings of analog hello whereas M P 3 is more complicated so it's kind and it's in the M P 1 and P 2 range it's got roughly 10 to 1 compression ratio so that's actually pretty good for 1991 considering everyone else was just really doing those for bit sampling short short samples on the sample IC chips now my common would be after looking at all this is I think it is very difficult to make an encoder so if you want to make your own sounds four-year-old and keyboards are pinballs or whatever you want Due to the missing the missing masking curve logic the entropy coding logic and the quantizer behavior that was in the encoder in a PC software so you could do it probably but I would imagine the audio quality would be likely porkers you'd be you'd be stacking a bunch of hunches and guesses what you thought about how he thought the the encoder worked on top of each other and public
emote terrible my guess so the here is the overall and block diagram of of what the DCs architecture looks like so got the actual game CPU slash GPU and which is bi-directional the bi-directional on I O channel to the DSP there's the DSP can access the sound runs which contain program code and the actual audio data and then it's got a connection to external as from just because the DSP itself had very limited on-chip RAM then the D S T R uses a serial connection to the back and then the DAC has voltage output to an op-amp which does low pass filtering and preempt and that goes to a 20 what body went which goes to a speaker referred to earlier model revision so is a little bit of the actual details but it's not yet TI TMS 34 thousand series regular 1 mag um the promenade ESP 20 100 family DSP 3 um it came S. rounds and then an 80 51 16 bit serial on your DAQ the
so don't worry about all the words and here this is kind is not the 1st page of the data sheet for the DSP some kind interesting things to note are there's for this this is the uh 21 0 5 and there is no on-chip wrong squared flash for cash it pretty much boots from ran mutant sorry not internally for externally and or from external ROM whatever's mapped into the address space does it hang it hangs also address lines out externally and just goes from there so gonna someday the weird stuff about DSPs I've 24 bits program databus 16 bit data data bus this Harvard so Scott code and data separate busses 40 that multiply and accumulate unit which is 16 bits 16 bits and 8 32 bit barrel shifter and it's got a data address generator which can generate module like circular addressing so you can easily create circular buffers and hard work also do bit reversal so you have what's you have 1 1 old it will generate 0 1 1 the reverse of that which is used for a lot of on DSP algorithms like even in the FFT and other than that it's this particular implementation is clock with the 10 megahertz crystal and I think that's all the relevant stuff there so here's what the program memory map looks like the 1st chunk is can can of be mapped in from external boot of memory so the internal program around there's a chunk further out that's external program RAM that and that the that region is shared with the data RAM and bus and I've noticed that the DCs code just really doesn't amount to much CO um map anything beyond this 1 fff out sources unused
MND data memory map is so the DSP has a bunch different so chunks with different weights states that can be configurable based on household or faster the needs of the type of external memory you have 2 which is common and so nothing terribly crazy here it maps in the external those 3 external last rounds there is a 1 thousand packs 1 thousand word bank window so that a 1 thousand hex word into the physical sound he problems and then you use the bank Select register underneath actually map in the next 1 thousand words then there's the TMS CPU I latch that is used to receive sound commands from the game cpu saying play this grant play this screen play this nice sound play this back a music stop loop whatever and then it's got some of the DSPs got its own internal RAM nearly and followed by some system registers the now this yes pro probably go through all this but this is this is kind of a map of all the kind of interesting areas of the code itself uses for its own constants and things like that yet adapt playout buffer will cover that later from when the TMS CPU the game CPU rights to that I latch it will fire Iike you to on the DSP and the do that's how the DSP knows is a new command waiting so here's
Connor my hybrid diagram showing how the DSP actually clocks the audio data the time-domain on digital audio data out to the DAC and so pretty much serial clock our transmit frames sink which is connected to the latch I think it's the latch enable pen which actually but the the DAC is double-buffered so it takes this the shift register and transfers it over to the parallel register once on that Ellie signal the data pen and then there's just the crystal in there and kind of trivia note is the the dot clock is running a five hundred kilohertz so 5 until its killers divided by 16 bit samples gives you a 32 killer at sampling rate so this things running at 3 quarters CD-quality basically the and then the output of the DAC goes to the of from 10 9 so
this sound runs themselves the like is said the cover the date the king in the cold and the the actual compressed audio there's no encryption obfuscation in this area and you can pretty much remove them from the dump of the parallel he problem programmers like you will know CellTracker your own design where we want to nothing 2 crazy there so
the wolves series of hardware from Williams B which is k but MP3 3 runs on users for these 1 megabyte one-megabit by 8 bit so it comes out to be 1 megabytes IUB problems so for them would give you 4 makes full as you can see from here and
with a 10 to 1 compression would yield basically 40 megs of uncompressed audio which is pretty good for a FIR 91 basically the and so the organization of the runs the did the bootloader which is the stage 1 and 2 code the rest the running program code and miscellaneous data sets in the you to run 1 all current next slide at these offsets followed by compression dictionaries which are basically the the Huffman tables used to to actually decode the variable-length data from the stream look up table entries which are actually where the DSP 1st goal is when it's commanded the player sound it needs to get an act of 1st pointer and there's a look up table pointers and the note and then followed by sound headers so that 1st tuple or pointer points the sound header sound data points the frame header at cause remember a frame is 7 . 6 8 ms of audio and find the other stuff in the in these he problems are the actual compressed audio itself so later games so as I said use IDE hard drives and a copy the code and were relevant data D RAM so I don't know what the partitioning of file system of the HA goes looks like all I've been looking at is the the physical wrongs so here's the you to which is the of which is the 1st sound wrong so it's like it's it's got it's got all those are all those data diesel at these various locations but is pretty much all that stuff in the first one and right near the end is we get the frame headers and compressed audio but and all the following wrongs will just be compressed audio with those with morph frame frame frame frame frame of audio all the all the codons stuff's stays in the first one and all the rest of all the audio itself goes in the other 3 runs for example or a flat for 5 how many begin has so the important thing here to note is that V DSP looks up a pointer at at hex 40 40 which contains the value 40 48 then it takes the sound command from the CPU multiplies it by 3 and then adds it to this 40 48 and then that gets you the position in the from of the lookup table entry which itself is a 3 byte value pointing you somewhat down to the sound header section so as I said the other 3 wrongs are just audio pretty much and the bank switching like
I said there's a thousand were perhaps 1 thousand word bank window and writing to the data memory bus in location 3 thousand will map in a different bank so the the upper 8 bits of that 16 bit word are module for values so 0 1 2 3 and if you like 4 5 6 7 that it's equivalent of 0 1 2 3 ad nauseam and those select 0 1 2 3 select u 2 u 3 u 4 new 5 wrong respectively then the law 8 bits of the of that word selects the up where at what offset to go to in the in the actual wrong so here's here's a few examples here I'm just showing you that 1 in the upper 8 bits goes you 3 to goes to you for 3 goes you 5 in the last 2 digits basically map in the offset in that physical Ron so quickly speed to
some of these is just a quick history this is the very 1st mk the T unit is the board on the left and it typically came for the everything except more MK 2 came with a Yamaha FM synthesis chip words MK 2 since they had a modular ribbon cable design it is designed a new board with there's the DSP sitting right in the middle and now they bolted on basically streaming compressed audio to to the exam existing our model and this is a
close up of that board on that the DSP board on the right so there's the 21 of
5 3 s rounds the actual sound runs there's more than 1 and 2 than M P 3 but that's like we discuss the smaller the problems than the ones used in in the later games midgy keeps saying for the 20 watts of power and going to the speaker
so here's the wolf unit which was in the 3 open eyes of max MDA maximum hang time or other BWF WrestleMania few the game so there's the the force sound runs up in the upper left corner the DSPs come to the right of it there's 3 more 3 s rounds over there and the upper right corner is the back the uh preempt and then the giant heat sink in the upper right is the audio so this a closer view
closer view the DSP in the 10 megahertz crystal and just a closer
view of the DAC and the audio out section his killer instinct which
ship of ship with a hard drive for the for the graphics and animations and transitions but curiously the sound of his name was still on the 8 yellow sticker the problems in the bottom corner so but not only yet DSPs right in the middle here and same thing 3 3 s rounds this is a later
Seattle board for NFL Blitz 2004 example where a chip on the hard drive so there's no sound runs anymore it's completely whatever the file system is and this system these lattices were back with the rounds of s from and I guess would transfer from the drive to G RAM and then the DSP would run everything out of of brown and here is a World Cup soccer pinball on Williams made a different spin of the border looks similar to the M K 2 board that's not quite the same the same deal DSP while some runs up at the top I don't know what the 2nd he chip is there so
basically With this BCS system designed for the parameters of the action and this could this could hold true with almost any audio compression system what will work what you want to attain which are designed so With the CS the early versions are modeled and stereo than multi-channel in terms of like surround sound style the pull the Plath near voices was was 6 all with and I think always from the beginning at least in the MP3 suffers look and 6 so I can play 6 you can keep track of 6 sounds at the same time some music track of voice over a couple hits at the same time whatever else and then it down mixes all that to model for example and then puts about the one-speaker sample-rate 32 killer at 16 bits of the FFT is done in hardware 16 subbands from 16 buckets basically the quantization is variable number of bits based on the sub-band so it can change how many bits it wants to put into each frequency bucket based on if it's frequency anatomy here it is it may allocated 0 bits so the entropy encoding in this case I think it's Huffman coding or if you want to extract that to be a more general case prefix coding and so that's basically where you'll have values in round the upper the upper byte is the is a length and the law by is the actual value so the length basically tells the the decoding code to move to advance the bitstream not much length and start looking for the next codeword in the data stream the next symbol bitstream generation this is where so basically those there was a look up table entries of 3 by lookup table entries pointed a sound headers those sound headers point to frame headers in the frame header includes how many of the 1st frame header includes how many frames the fall and it contains the so these on subband quantization values which is based on effectively like how many bits each bucket should get in and how many how many subbands are actually in this frame because if it doesn't need all 16 it will use of then followed by the actual compressed audio data and finally the wrong image creation so the this contains a DSP bootloader in code program code it's got this compression codeword codeword to symbol mapping dictionaries as well as the compressed audio itself and in these this data split into images and burnt into the actual the problems so quick
compression background based on those subbands and quantization of soccer mode so again the FFT is used to convert the time-domain samples let's amplitude on your on your Winamp but of visualization to frequency domain which is the kind of the equalizer style bar depicting each each frequency bucket of the subband coding like this is used to distribute bits based on the frequency bands high frequencies less foreseeable stimulus bits and then finally the last step is a lossless entropy coding Huffman words doing those Huffman table lookups is used to pack those samples into a variable-length data stream and this this graph is kind of shows you the different kinds of the different kinds of compression technologies in this case it's using Tufte's it's using Huffman some of for some aspects is using subband because the frequency domain and it's also using the Fourier transform so
basically by identifying what can and can't be heard audio compression discards basically it's it's chucking information that can be perceived perceived by the human ear so if you know the signals are below a particular amplitude at a particular frequency at that they're not audible you can hide that quantization noise from your brain a tone at a certain frequency lichens loudness will raise the threshold in critical frequency band around that the critical band around that frequency and ostreatus next slides and then the this masking effect temporal masking is a mass prisoner sound raises the audibility threshold for a brief interval preceding and following the sound so it kind of fools your brain that you are you won't hear the stuff nearby at that's quieter and this is all in comparison to traditional lossless methods like gzip Arora which don't discard data at any stage again because you don't want unzip a file it's completely mangled from what you zip in the 1st place so there have good integrity but they will compress obviously is small so here's gonna the
masking effect were really like uh a distinct intense sound will will basically raise raise the that the threshold and then you anything under this dashed line you won't hear see conveys start passing these mask tones a or frequency components without affecting the brain
more Nauset too much basically so this is this is my take on on the DCS encoder you base that the uncompressed audio samples coming in 32 kill 16 bit does the frequency mapping transform FFT transformation and that goes into the quantization subband block and this is fed by the perceptual model so this is what's missing in terms of you try to make an encaustic and make your own sounds you don't know what the masking curve logic is and how they generate the Huffman tables and stuff like that so that was all done not in real time on a 46 class machine back at these would take hours to generate the the the encoded in the compressed files were the DSP had to do in real time so there's way more work involving in core obviously and cycles the bitstream generation which which gives you a variable like bitstream as basically the reverse the other direction you read in the read in the bitstream compression dictionary to to start pulling pulling the quantization values and the and the actual audio itself so samples 0 and then you transfer them from frequency-domain back into time-domain with inverse FFT so this is the quick
screenshot problem odyssey of my of my life off the last several weeks which is the amazing a built-in debugger indeed debug build of named so because once you have that once you have a sound on the date office on the physical sound runs I yeah I I don't think this project would have happened if I had to write my own a DSP 20 100 disassembler and at TI TMS disassembled whatever it it's like it was too too many layers of overwhelming so I just use this as pre call you got your program program memory bus but 24 bit over here you got your at the you got your 16 bit data round of values appear in and you can see the 40 bit multiply and accumulate of our unit over here and the 32 bit shifted so yet and I I think I already mentioned but I do believe either has support for the later versions of the DSP family but and play with that so the quick summary
of this slide is the DSP Bhutan initialization process effectively this thing goes through a couple stages before actually starts running and it's doing things like I I'm installing IRQ handlers and enabling IRQ that responds when the when the the handle that responds when the the CP begin CPU talks a DSP clears internal RAM Reese replaces the reset button that issues itself a soft reboot and then at that point it comes up again stage to move some more areas in memory around wipes the buffer is there that get played out to the to the back with the which with the actual uncompressed audio yeah whites more memory configures the serial port hard were going to the DAC so this is effectively the main cold loofah for the DSP code this is it's what spending 99 % life doing it will sit there are processing pending TMS some commands lessons from the game CPU you'll do some quick sanity checking in animal calculate that based pointer that 40 48 plus 3 times the sound command which allow it to index the prime and find where the rest of the sound data is located basically then it passes that sound had a more fully and the frame header then it decompresses the frame into a a block of data memory so that's that's simply on doing the entropy it's entropy decoding the the data and this is these 2 blasted processes a per per-channel cause remember per voice uh Seurat confusing terminology but per vote like it can play 6 things that it can keep track of 6 sounds at the same time so it's doing these processes an inner loop before it moves on for each channel each boys and then finally does the I FFT so converts at frequency data back to time data scales it down because when you do an I. 50 the samples get louder basically that's the nature of of running proceed a scale them back down you applied that windowing and overlap-add data functions to smooth the data out between frames you don't get audible glitches you actually fill the gap buffers which eventually get clocked out to the docks and the doctrines them into 2 voltages which we can hear through speaker and finally it does 1 last loop to calculate the per channel gains at the volume gains and respond back to the TMS it is bi-directional although and moved over long and drawn the time it's not sending any data back to the uh to the game CPU in this case all these memory locations in the brackets beside them these are referencing ultimate moral commentary code I Paul doesn't include the actual revision of the of of the game which version it is but it's whatever the most popular
1 was so doing kind of a deeper dive into those into those commands the the 1st step processing commands whites the condence around checks they new commands a command stores into the circular buffer i 2 fires when that as I said when the the the games if talks to the DSP handle handler validates the command make sure it's not it's not so anomalous stores in the buffer and just for trivia the TMS is address at this location is mapped to the DSP so if you're ever looking at the game code on the CPU on a GPU CPU this is its address of what a word sense and then that pops so and the other end in the DSP so yeah and basically finds and stores the pointer to the valid sound headed by by walking those those pointers in wrong and it checks for more pending some commands consisting can handle several sound commands at the same time if they all come
in 1 after another so then the next stage is finding in passing the sound and frame headers so like I said does that 3 times 3 times the sound command from the the CPU goes in Rama dislocation finds this value this 1 8 1 8 3 then walks the 1 8 1 8 3 which is the sound header you get this string of bytes here the the interesting stuff is in red is the pointer to the frame header um which has the walk and then this all 147 which is hacks 1 4 7 frames in this sound to fall or that the sun comprise about many frames that and so the the sun had a itself once it walks to 1 0 4 7 5 4 which is the right you 3 Rahman at this offset it all the strings of orange are basically the important point is the number of these on bytes not necessarily what contents there are that tells you how many subband values are in this frame out of a possible 16 frequency sub-bands and if it's 7 f a f f bytes it means stop passing this frame were done with the subbands so after this in this
out in the frame header once you've looked at the frame header you lab the subband the quantization values pre subband compressed and then also the then finally the compressed audio data itself comes after those subbands so remaining frames after that frame header consist of the quantization dies in compressed audio there there's no more headers and yet then you decompress a frame at that point you're interbreed entropy decoding it from yellow these are the specific locations for reference but said Danny finally jump to this location which is white encounters and and proceeds to is ready to handle another sound if it needs to so effectively what's
happening is it's actually accumulating all the frequency-domain samples for all 6 channels at the same In this is the same as this so we'll get as you have like music screamin and scorpions harpoon those values will all be mall accumulated on top of each other and eventually have to be scaled down because it does all this mixing in the frequency domain basically Benin per subband below so per frequency bucket so it's kind of an
interesting way of doing it then finally do the almost done you do the inverse FFT and the 1st couple of iterations run rolled in the code and it that's for that bit-reversed addressing is usedfor accessing the FFT is twiddle factors are called scrambled order this is all standard FFT nothing fancy nothing it's nothing secret they're doing and it's got a scale those samples down because that that effect of doing I 50 makes them to of so and yet adjusted graph that can move and this is just what it looks like in memory once you do the the 50 and then then
you you then at the code with the serial port to finish clocking out the existing sample buffer and copies the new samples in keeps to the standby buffer which will switch to eventually in store clerk nosode keep 16 samples for overlap overlap and in which time this report treats that standby buffer as the active and starts clocking out such as the continual fill empty fill empty cycle and if there if there's no sound requested by the CPU basically DSP will calculate a bunch of i 50 and it'll run the i 50 on zeros copies of zeros the buffer and clocks is also so just continually running even if a sound isn't requested so here's what
the frequency domain data looks like if it's if it's a graph which is a garbage looking here's what the time-domain so this is an actual decent-looking waveform
here's your left over 16 samples that it keeps for the next frames overlap and then here's the smoothing cosine window so and then the last step is a just did a um the discount with the gains and then responded back to the CPU like a set if it needed to so yeah that can
trigger pinball lighting mechanical flippers things like that so conclusion basically using a low-cost DSP allowed high-efficiency good quality audio compression 9 out of it to be accelerated in hardware it provided roughly 10 to 1 compression ratio so the game on you could still be squeezed into e prawns instead of having to think about CD-ROMs aha guys but they eventually to go too hard drives computing systems were using FM synthesis in low-quality short playback and sound that good and then no the DCs system basically allowed the musician the freedom to compose like the in a traditional studio they could use whatever instruments anything 1 because it was just compressed audio at that point so I think a time but I just had a some sample clips from from the from the fighter and and more MP3 gravity-time wrote on get the a day so that is everything and thank you everyone fervours account of how testes