7 Replies Latest reply on Jul 7, 2014 10:39 AM by jbowden

    Rapid sound effects

    Tim. Signore Level 1

      Hello,

      i am trying to create a clicking sound effect for a wheel that can be spun by the user, similar to the sound of a safe lock being turned. I have set it so that the sound fires on every 20 degrees of rotation. This works fine while the wheel is being dragged, but when it is thrown the sound cannot fire fast enough to keep up. Does anyone know of any workarounds for this?

      many thanks,

      Tim

        • 1. Re: Rapid sound effects
          jbowden Adobe Employee

          Hi there,

           

          It's possible. You could symbolize the audio element, and then create a child symbol and then play it every 20 degrees of rotation of your widget. This should produce several instances of the audio element at once, allowing overlapping sounds to play at the same time.

           

          hth,

          Joe

          1 person found this helpful
          • 2. Re: Rapid sound effects
            Tim. Signore Level 1

            Hi Joe,

            Many thanks for your reply. I was considering importing the sound several times with different names and then playing them in sequence; a little bit complicated. Your way is far simpler - as long as the sound is the child of a symbol, will it automaically create as many as it needs?

            I will give it a go.

            Tim

            • 3. Re: Rapid sound effects
              jbowden Adobe Employee

              Hi Tim,

               

              That's the idea in a nutshell - you create a new child symbol and then play the sound in it every time you want the sound to play. This should allow multiple sounds to play in an overlapping manner.

               

              Joe

              • 4. Re: Rapid sound effects
                Tim. Signore Level 1

                Hello again,

                I can't get this to work; I have created the symbol with the sound inside it, and put an instance of the symbol on the stage. I have tried both playing the sound inside the symbol, and setting the sound to autoplay and playing the symbol's timeline every time the event fires. In the first instance, the sound does not keep up with the events (same as original problem), and in the second the sound is not audible at all. I know that the event is firing correctly, as I'm logging out the angle every time it does so.

                Thanks again for your help,

                Tim

                • 5. Re: Rapid sound effects
                  jbowden Adobe Employee

                  Hi Tim,

                   

                  Sorry if I was unclear. I meant use the createChildSymbol method, not to manually create a child symbol in the tool.

                   

                  Whichever event you use to log your angle, add some Javascript to create a child symbol of your audio symbol, and then play the audio element in it. Something like this:

                   

                  var audio_child = sym.createChildSymbol("your_audio_symbol", "Stage");  // creates a child symbol on the Stage from your_audio_symbol

                  audio_child.$("your_audio_element")[0].play();  // plays the audio element in the child symbol

                   

                  hth,

                  Joe

                  1 person found this helpful
                  • 6. Re: Rapid sound effects
                    Tim. Signore Level 1

                    Thanks Joe - that's sorted it. Do I need to worry about flooding the stage with hundreds of symbol instances?

                    Many thanks for your help,

                    Tim

                    • 7. Re: Rapid sound effects
                      jbowden Adobe Employee

                      Tim. Signore wrote:

                      Do I need to worry about flooding the stage with hundreds of symbol instances?

                       

                      Perhaps - they could add up.

                       

                      You could add an event listener for the audio element ended event to the same handler and then delete the symbol once the audio playback has ended.