Viewing Issue Advanced Details
ID Category [?] Severity [?] Reproducibility Date Submitted Last Update
02909 Original Reference Minor Always Feb 8, 2009, 18:49 Mar 5, 2009, 11:43
Tester chowell View Status Public Platform MAME (Official Binary)
Assigned To derrickr Resolution Fixed OS Windows XP/Vista 32-bit
Status [?] Resolved Driver
Version 0.129u3 Fixed in Version 0.129u6 Build Normal
Fixed in Git Commit Github Pull Request #
Summary 02909: boothill: Specification of discrete filters for shot and hit sounds doesn't agree with schematic.
Description In the discrete audio specification for Boot Hill, the filters for the left and right players' shot and hit sounds are specified as:

    DISCRETE_RCFILTER(NODE_31, 1, NODE_30, RES_K(12), CAP_U(.01))
    DISCRETE_CRFILTER(BOOTHILL_L_SHOT_SND, 1, NODE_31, RES_K(12) + RES_K(68), CAP_U(.0022))

    DISCRETE_RCFILTER(NODE_36, 1, NODE_35, RES_K(12), CAP_U(.01))
    DISCRETE_CRFILTER(BOOTHILL_R_SHOT_SND, 1, NODE_36, RES_K(12) + RES_K(68), CAP_U(.0033))

    DISCRETE_RCFILTER(NODE_41, 1, NODE_40, RES_K(12), CAP_U(.033))
    DISCRETE_CRFILTER(BOOTHILL_L_HIT_SND, 1, NODE_41, RES_K(12) + RES_K(100), CAP_U(.0033))

    DISCRETE_RCFILTER(NODE_46, 1, NODE_45, RES_K(12), CAP_U(.0033))
    DISCRETE_CRFILTER(BOOTHILL_R_HIT_SND, 1, NODE_46, RES_K(12) + RES_K(100), CAP_U(.0022))

The component values match the schematic, but the form of the filters seems to be completely wrong. As written, the filters are composed of an RC low-pass filter followed by an RC high-pass filter (a "CR filter"), which would look like:

     R1             C2	       
----ZZZZ-+---------| |--+-----
         |              |     
        ---             Z     
        --- C1          Z R1   
         |              |     
        gnd             Z     
                        Z R2
                        |
                       gnd

The circuits on the schematic (which I have uploaded) have the form:

     R1             R2        
----ZZZZ-+---------ZZZZ-+-----
         |              |     
        ---            ---    
        --- C1         --- C2 
         |              |     
        gnd            gnd    

This is a pair of cascaded RC low-pass filters, forming a second-order low-pass filter. Its frequency cutoff curve is steeper than that of an ordinary (first-order) RC low-pass filter.

I rebuilt MAME with the CR_FILTERs changed to RC_FILTERs fed from the existing RC_FILTERs (the second-stage RC_FILTERs only use the second resistor value, i.e., they don't add the R1 value to the resistor in the second-stage filter). Boot Hill's shot and hit sounds now seem less "tinny", since the lows aren't being filtered out and the highs are cut more strongly. The "left hit" sound (which actually happens when the right player is hit) does sound rather low in volume as well as pitch now; perhaps its filters cut its overall intensity more, or maybe this is just because I'm testing with little laptop speakers. Unfortunately I can't compare with a working machine.

Any comments are welcome.
Steps To Reproduce
Additional Information
Github Commit
Flags Verified with Original
Regression Version
Affected Sets / Systems boothill
Attached Files
pdf file icon Boot_Hill_Game_Logic_(0612-00902A).pdf (545,974 bytes) Feb 8, 2009, 18:49
png file icon not_added.png (1,546 bytes) Mar 1, 2009, 23:34
png file icon added.png (1,459 bytes) Mar 1, 2009, 23:34
Relationships
There are no relationship linked to this issue.
Notes
4
User avatar
No.03744
chowell
Developer
Feb 11, 2009, 16:52
I've been continuing to study the discrete sound implementation for this game, and it puzzles me. This may be due to my lack of experience with the discrete sound system, but there seem to be several anomalies.

I already mentioned the filter specifications above. The outputs from the second-stage filters are passed to the left and right mixers. These are similar, except that the right one also includes a music channel. I'll just describe the left one here.

In the driver, this mixer is specified as:
    DISCRETE_MIXER2(NODE_91, BOOTHILL_GAME_ON_EN, BOOTHILL_L_SHOT_SND, BOOTHILL_L_HIT_SND, &boothill_l_mixer)

static const discrete_mixer_desc boothill_l_mixer =
{
    DISC_MIXER_IS_OP_AMP,
    { RES_K(12) + RES_K(68) + RES_K(33),
      RES_K(12) + RES_K(100) + RES_K(33) },
    { 0 },
    { 0 },
    0,
    RES_K(100),
    0,
    CAP_U(0.1),
    0,
    7200    /* final gain */
};
This circuit looks like:
                 12K + 68K + 33K                100K
  L shot >-------------------zzzz--.        .---ZZZZ--.
                                   |        |         |
                12K + 100K + 33K   |        |  |\     |
   L hit >-------------------zzzz--+--------+  | \    |
                                            '--|- \   |  0.1uF
                                               |   >--+---||-----> Netlist Node
     gnd >-------------------------------------|+ /
                                               | / gain = 7200
                                               |/
The resistors in the RC filters are also counted when doing the mix. Should they be double-counted like this? It seems suspicious to me.

The actual circuit looks closer to this:
                             33K                100K
  L shot >-------------------zzzz--.        .---ZZZZ--.
                                   |        |         |
                             33K   |   1uF  |  |\     |
   L hit >-------------------zzzz--+---||---+  | \    |
                                            '--|- \   |  0.1uF
                                               |   >--+---||-----> Netlist Node
     gnd >-------------------------------------|+ /
                                               | / gain = 7200
                                               |/
I say "looks closer to" because the driver models the mixer using a conventional op-amp, while the actual circuit uses a Norton op-amp. Since MAME only supports a mixer with a conventional op-amp, I am ignoring those circuit differences which are obviously related to the use of a Norton.

That aside, and in addition to the question about whether resistors should be double-counted in the mix, note that there is a 1uF capacitor between the combined inputs and the op-amp. That's not present in the driver's mixer specification. In fact, there's no place in the discrete op-amp mixer module to include such a capacitor. I suppose you could "fake it" by splitting the single cap into equal-valued parallel caps whose total parallel capacitance would add up to 1uF, but I'm not sure this would behave quite the same for this circuit as a single common 1uF capacitor.

I've also realized that the capacitors in the RCFILTERs are only affected by the upstream voltage and resistance, not by the downstream one, while in the real circuit they should be affected by both.

Derrick Renaud's discussion of discrete sound in Phoenix:

http://derrick.mameworld.info/docs/Tutorial/Phoenix/Phoenix_From_Start_to_End.html

mentions a trick he uses to find a capacitor's voltage by analyzing the circuit without the capacitor, finding the voltage at its terminal, and then adding the capacitor back in, with it charging from that voltage through the entire set of attached resistances considered in parallel.

I'm not sure whether that trick should also be used in this case, or whether it is practical. First of all, there are multiple filter capacitors here, not just one. A second problem is that this technique would require finding the voltage on the near side of the single capacitor which separates the inputs from the op-amp.

I hope these comments are actually useful; when I started thinking about examining and verifying the discrete sound emulations of existing systems, I knew this could be tough, but I didn't expect to run into problems so soon.
User avatar
No.03872
derrickr
Developer
Mar 1, 2009, 23:33
The CRFILTERs are supposed to be RCFILTERs. Ooops. Thanks.
User avatar
No.03873
derrickr
Developer
Mar 1, 2009, 23:51
edited on: Mar 1, 2009, 23:53
I'm glad you are trying to figure out the system. The more the merrier.

When 2 RCFILTERS are staged together you do need to add the resistor from the first stage onto the second stage. See the pics above. The red line is the charge curve we want. The blue is what we are simulating. Notice the bigger difference when we don't add the first stage resistor to the second stage as shown in the first picture (not_added.png).

Basically once we filter the first stage using R1/C1 it becomes a voltage source we will call V1. But the source is no longer a low impedance source like the output of an op-amp. It becomes:

V1 >>---/\/\ R1 /\/\--->>

The same thing happens with the mixer. All resistors from the low impedance voltage source (output of hit/shot effect op-amp) to the high input impedance of the mixer op-amp must be taken into account. They all affect the current input into the amplifier.

The discrete system is not a full fledged Spice program. It can not traverse up and down the circuit to calculate things. You have to manually add the resistances together. If it was automatic, then it would run as slow as a spice program and we could never get real-time sound.
User avatar
No.03874
derrickr
Developer
Mar 2, 2009, 00:11
As for the 1uF cap... I can't remember my thinking at the time, but it was probably laziness. Like you say, there is no place in the mixer structure to simulate it. It really is only a DC blocking cap. If we simulated it, MAME would not sound any different. One of those things needed in the real world, but was not worth the all the extra simulating work when you won't hear the difference. I'll add a note to the code stating how lazy I was. :)