Is VP AudioFade/Pan Messed Up?

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #80939
    Scottacus
    Participant
      @scottacus

      My brother is building a cab and plans on putting quad speakers under the playfield to reproduce quadrophonic sounds for the various table elements and ball rolling.  We were messing around with setting this up and it seemed like the sounds never really panned/faded fully so I took a look at the boiler plate script that we all use and I’m wondering if it needs to be modified?

      The guts of the functions look like this

          tmp = tableobj.y * 2 / table1.height-1
          If tmp > 0 Then
      AudioFade = Csng(tmp ^10)
          Else
              AudioFade = Csng(-((- tmp) ^10) )
          End If
      The first part “tmp = tableobj.y * 2 / table1.height-1” is perfect because it takes the x or y location of the object, multiplies it by 2, divides it by the table height/width and subtracts one.  Here are some examples of outputs for a table with a width of 1000:
      Object location = 0 (far left)   ((0*2)/1000) – 1 = -1
      Object location = 500 (middle) ((500*2)/1000) -1 = 0
      Object location = 1000 (far right) ((1000*2)/1000) -1 = 1
      This is perfect because far left or right get the full pan  :good:
      Now take a look at the rest of the code.  The -1 to +1 is raised to the 10th power and then subjected to a cosine function and then if/then’ed to make it positive or negative.  Cosines are not linear so what you get is exactly what you hear when you listed to the table output from the speakers.  The sound comes from dead center until the object is most of the way to the edge of the table and then it quickly moves toward +/- 1.   Also raising the -tmp to an even power does nothing because even powers always yield positive outputs.
      I think the way this should work is to get rid of the cosine part and just set Pan/Fade to equal tmp and leave it there.  Am I missing something here or is this feature not working as intended?
    Viewing 1 post (of 1 total)

    Forums are currently locked.

    ©2024 VPinBall.com

    Log in with your credentials

    Forgot your details?