A project for all you math whizzes

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Corey
    Indigo Rose Staff Alumni
    • Aug 2002
    • 9745

    A project for all you math whizzes

    Here I've attached a project. I would like to set it up so that the drag and drop object controls the volume of the 4 audio channels simultaneously but I don't have the math skills to do it elegantly. Please help if you can.

    1. I have four clips loaded into the four channels, and by controlling them in a symbiotic way this project will simulate "3D" sound.

    2. Clip 1 is left channel only, reverb only
    Clip 2 is right channel only, reverb only
    Clip 3 is right channel only, dry signal only
    Clip 4 is left channel only, dry signal only

    3. The idea here is that as you drag and drop that round blue button, it adjusts the volume of these 4 channels such that you get panning and reverb control.

    4. On the Y axis, the sound of the two reverb channels should be at maximum and the sound of the two dry channels should be at zero when the button is dragged to the top of the screen.

    5. On the Y axis, the sound of the two reverb channels should be at zero and the sound of the two dry channels should be at maximum when the button is dragged to the bottom of the screen.

    6. On the X axis, the sound of the two left channels should be at maximum and the sound of the two right channels should be at zero when the button is dragged to the left side of the screen.

    7. On the X axis, the sound of the two left channels should be at zero and the sound of the two right channels should be at maximum when the button is dragged to the right side of the screen.

    8. When the button is in the center of the screen, the volume of all 4 channels should be at 64.

    9. The sum of all volume values at any given time should equal 256. (255 counting from zero)

    10. As the button is dragged from point to point the volumes of the 4 audio channels should adjust relatively. So for example if the button is in the top-leftmost corner, channel 1 would be at 255 with all other 3 channels at 0, etc.

    Good luck, thanks for the help! :yes
    Attached Files
  • Corey
    Indigo Rose Staff Alumni
    • Aug 2002
    • 9745

    #2
    Bump. :yes

    Comment

    • Worm
      Indigo Rose Customer
      • Jul 2002
      • 3971

      #3
      Not sure whether I understood exactly, but here's something to play with.
      Attached Files

      Comment

      • Corey
        Indigo Rose Staff Alumni
        • Aug 2002
        • 9745

        #4
        That's very close to what I meant. In this case it seems to have the reverb reversed on one side, and also when the ball is 100% to the right, you can still hear volume from the left channel. The reverb idea was sort of an analogy for the drag-button being a person, the application window being a room that person is in, with a drummer at the bottom. So the higher you drag the thing, the more reverb there is...

        Anyhow very cool, thanks Worm!

        Comment

        • Worm
          Indigo Rose Customer
          • Jul 2002
          • 3971

          #5
          Hee!

          It was late, what can I say? Change the last bit of code in Global function to this. Plus, I think I understand what you wanted now and made a couple changes to the code. Although my drummer is at the top of the room, you could change that easily enough.



          It was a cut and paste moment

          Code:
          	YPercent = Math.Round(nYPos/(425 - 89),2)
          	XPercent = Math.Round(nXPos/(630 - 94),2)
          	User1 = 255 * (XPercent) * (1 - YPercent)
          	User2 = 255 * (1 - XPercent) * (1 - YPercent)
          	User3 = 255 * XPercent * YPercent
          	User4 = 255 * (1 - XPercent) * (YPercent)
          	
          	Window.SetText(Application.GetWndHandle(), "User1: "..User1.."  User2: "..User2.."  User3: "..User3.."  User4: "..User4)
          	Audio.SetVolume(CHANNEL_USER1, User1)
          	Audio.SetVolume(CHANNEL_USER2, User2)
          	Audio.SetVolume(CHANNEL_USER3, User3)
          	Audio.SetVolume(CHANNEL_USER4, User4)
          Last edited by Worm; 02-10-2005, 06:52 AM.

          Comment

          • Worm
            Indigo Rose Customer
            • Jul 2002
            • 3971

            #6
            In my defense, I was playing with this on my Notebook, and it only has one speaker that works

            It all sounded much different on my PC.

            Comment

            • Derek
              Indigo Rose Customer
              • May 2001
              • 1254

              #7
              lol - an excellent defense Brad. Well recovered!
              -
              = Derek
              ["All glory comes from daring to begin" - fortune cookie]

              Comment

              • TJ_Tigger
                Indigo Rose Customer
                • Sep 2002
                • 3159

                #8
                Ok we will let you use that excuse just this once. but not again.

                Cool stuff guys.
                TJ-Tigger
                "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
                "Draco dormiens nunquam titillandus."
                Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

                Comment

                • Worm
                  Indigo Rose Customer
                  • Jul 2002
                  • 3971

                  #9
                  Yeah, Yeah, and my mouth was open too!

                  Comment

                  • Worm
                    Indigo Rose Customer
                    • Jul 2002
                    • 3971

                    #10
                    Corey,
                    Did the changes I posted make the volumes work like you wanted?

                    Comment

                    • Corey
                      Indigo Rose Staff Alumni
                      • Aug 2002
                      • 9745

                      #11
                      I'm not sure, I didn't get a chance to edit the original code yet. I'll make sure to do it after work today. :yes

                      Comment

                      • Corey
                        Indigo Rose Staff Alumni
                        • Aug 2002
                        • 9745

                        #12
                        Yep now the reverb is right but the channels are reversed.

                        Flipped the channels, works great. Thanks Worm!
                        Attached Files

                        Comment

                        • Worm
                          Indigo Rose Customer
                          • Jul 2002
                          • 3971

                          #13
                          I guess I need to look at my speaker set up. I swapped the channels because when I moved the ball to the left, my audio was coming out my right speaker.

                          Anyhow, it was fun to play with.

                          Comment

                          • Corey
                            Indigo Rose Staff Alumni
                            • Aug 2002
                            • 9745

                            #14
                            Yoink!



                            Yeah, very cool Worm. yeah yeaH yeAH yEAH YEAH YA-YA-YA!!!

                            Comment

                            Working...
                            X