I have been wondering what is the best way to handle Gun Fight's final audio power amplification, and by extension that for other games. I'm asking about this because my initial belief (and a standard MAME assumption) that this amplification doesn't really affect the sound quality, only adding power to it, seems to be wrong—Gun Fight's power amps may significantly distort its sound output.
I'm not sure I'll actually change the sound to reflect this, because modeling power amp distortion seems very problematic, and I'm also not happy with the sound quality that seems to result. But this issue has been occupying my mind for a while, enough to hold me back from some tweaks I'd wanted to make in the Gun Fight emulation, let alone returning to 280-ZZZAP and other games. So I wanted to see what experienced MAME devs might think, particularly those who are experienced at dealing with sound.
My original netlist emulation of Gun Fight stopped at the inputs to the audio power amplifiers. I never checked those; I just assumed that the power amps wouldn't have any audible effect on the form of the sound signal and only boosted its power by increasing current and voltage to appropriate levels for driving the speakers. My impression is that this is the usual practice for MAME sound emulation: treat the output of the sound generation circuitry as the audio signal to be played, and ignore any effects of the machine's power amps and speakers, assuming that you can just send the signal to the emulating system's corresponding sound hardware without much of an audible difference.
Gun Fight has two power amp ICs, one for each side's speaker. Each is an SGS-ATES TAA-621-A11. (The amp is also labeled "LM354" on the schematic, and I guess at least some Gun Fights have chips marked as such. This "LM354" is not, however, a National Semiconductor part, as you might think from its name. A Google Books search of results from the early 1970s reveals that it was an audio amp IC introduced in 1972 by European Electronic Products, which seems to have been a mere U.S. importer and distributor of European-make electronic devices. The description of the LM354 looks identical to the TAA-621-A11, which SGS had introduced in 1970, so I'm convinced it was just a rebadging.)
Here are a couple of links to datasheets for the TAA-621-A11:
- archive.org, pp. 281-292 of the 1973-74 SGS-ATES Consumer Semiconductor Databook
- An older SGS datasheet from 1970, with less info overall but a more complete internal schematic.
The TAA-621-A11 amp is rated at 4 watts (RMS, I think) at a total harmonic distortion of 10%, when running on 24-volt power and driving a 16-ohm load. In Gun Fight, it's driving an 8 ohm load, and its power supply is only about 22 volts or so. (This is unregulated and comes from running 16.5-volt RMS AC power through a rectifier and a big smoothing capacitor.) The lower load impedance and reduced supply voltage would reduce the power rating somewhat. And a rating at 10% total harmonic distortion means that clipping is already pretty bad at that rating.
Originally, I had assumed that Gun Fight's power amplifiers had no voltage gain at all, only current gain. In fact, they were configured for a voltage gain of 15. The voltage gain of the TAA-621-A11 is determined by the external resistor tied to pin 10 (see the following Gun Fight schematic) and the inverse ratio of that resistor to the chip's's internal 15 Kohm resistor. In this case the external resistor is 1 Kohm, giving an inverse ratio and a voltage gain of 15.
I think a voltage gain of 15 is high enough that, when it is applied to the already strong input signals that Gun Fight sends to the power amps, it should make the amps badly clip the output signals, especially at the start of a sound effect.
To determine the strength of the power amp input signals (and the sound levels in general), I do have to make an assumption about the strength of the original noise signal made by the zener diode in the noise generator. Knowing that the current through the zener is around 2 microamps, I assume it produces around 2 millivolts RMS of unamplified zener noise. Although this is only a guess, remarks I've seen about similar zeners operated at similar current levels indicate that it's in the same ballpark.
At this noise level, with all the adjustment potentiometers kept at the midpoints of their ranges, the noise should remain unclipped all the way to the power amp inputs. Those inputs will see the first "loud" burst of noise from each sound effect as about +/- 1 volt, maybe a little more. That's not counting the initial spikes at the very beginning of each sound effect, which are even louder: around +/- 3 volts. (Those spikes are independent of the noise level from the noise generator, since they are produced by the initial current surge created as the sound effect's amplifier is triggered. Subsequent circuits effectively differentiate this surge and amplify its edges, producing very strong starting oscillations.)
So we have initial input surge pulses of +/- 3 volts, followed by an input noise burst that starts around +/- 1 volt and decays from there. A further voltage gain of 15 from the power amps would give +/- 45 volts output for the initial surges and +/- 15 volts output for the start of the noise burst! That should definitely be beyond the ability of these power amps.
I've made an LTspice simulation of Gun Fight's audio with these power amps included, using a schematic from an old TAA-621-A11 data sheet as the basis for the simulation, with a few parameters for some of the amps' transistors (gains, scale currents) adjusted from the SPICE defaults based on the data sheet's values for the amp's open-loop gain and quiescent current. The simulation shows that, with the other assumptions given above (zener noise voltage of 2 millivolts, all adjustment potentiometers set to their midpoints), when viewed at the power amp outputs, each sound effect is heavily clipped at the strong leading spikes and also at the start of the noise burst.
By the way, there's something strange about the worst of this clipping, which might be either real behavior or an undetected flaw in my simulation; I can't confirm that this phenomenon is a real thing. The waveforms which are most heavily clipped at their troughs are no longer merely flattened at the bottom, like normal clipping. Rather, it looks like the amplifier somehow *reflects* the clipped trough upward, back into the normal output voltage range. So you see these weird "mirrored" troughs, which effectively generate strong higher-frequency harmonics. (This only affects troughs, not peaks, which are flattened as always. Maybe it's related to the fact that the input is DC-connected and that its negative voltage is about one base-emitter junction below zero? Perhaps the amp's "self-centering" feature may also be involved.)
Here's a couple of LTspice waveform screenshots demonstrating this clipping behavior. The first one shows the minor clipping you see when an only moderately strong input waveform is amplified, such as what you'd see in the middle of a sound effect, a few tenths of seconds after its start. The upper waveform ("v(sp_l)", in red) is the power amp output at the speaker; the lower waveform ("v(out_l)", in green) is the amp's input, or what would be the current MAME emulation's output. (The voltage scales are different, of course.) Note that some of the highest peaks on the amp input waveform, especially those above 400 millivolts, have been clipped in the speaker output, with rounded tops.
The second LTspice screenshot shows the severe clipping that happens to a very strong input waveform, such as what happens at the start of a sound effect. Again, the upper red waveform is the power amp output, and the lower green waveform is the amp input. In this case the red waveform doesn't just have the rounded tops from clipping high input peaks. Deep troughs in the input, down around -600 millivolts, show the upward "mirrored reflections" in the output which I mentioned above, causing them to be flanked by narrow downward spikes. These are especially noticeable in the sound effect's very strong initial oscillations.
I tried listening to input and amplified waveforms from the LTspice simulation to compare, and the distortion of the amplified waveform is obvious. As I said at the beginning, I don't like the resulting sound: it has less of an initial "punch" and sounds rougher and noisier. Nor does it sound closer to real machines, from what I can hear in the few YouTube videos of Gun Fight I can find.
As for why Midway might design the game's sound this way, clearly overdriving an amp too weak for the task from an audio purist's point of view, my thought is they would want the game to be good and loud, so it could be heard in crowded arcades or the other sorts of noisy public sites where you might put an arcade machine, without having to use more expensive audio hardware. Instead, they would have simply "turned it up to 11", pushing the amps and speakers as hard as they could get away with.