9 Replies Latest reply on Jun 21, 2013 7:51 PM by xwisee

    Is There A Way To Loop Audio Using Edge Commons?

    PEPPERFACE Level 1

      Hi,

       

      I've been getting on really well using Edge Commons to add audio to my animations (fantastic bit of kit, by the way - thank you simonwidjaja !).

       

      However, while playing a sound via the trigger EC.Sound.play("mySound"); works brilliantly for individual instances of sound I've wholly failed to find a way to get sound files to loop.

       

      I've been struggling with this for an age, now, and really haven't got anywhere at all. I know that Edge Commons integrates SoundJS and I know that SoundJS provides a facility to loop audio but I can't see a way to make it happen via the Edge Commons script.

       

      SoundJS' method seems to be couched as: 

       

      static SoundInstance play ( value , interrupt , delay , offset , loop , volume , pan )

       

      And in Edge Commons I can find:

       

      var instance = SoundJS.play(soundId, SoundJS.INTERRUPT_NONE, 0, 0, false, 1);

       

      which I assume (perhaps incorrectly?) relates to the aforementioned SoundJS.

       

      I'm guessing (as has been mooted by resdesign in another post) that I need to edit the following, which appears in creation complete, in order to make looping happen but I just can't seem to get anything I try to work.

       

      {src: assetsPath + "mySound.mp3|" + assetsPath + "mySound.ogg", id: 'mySound'},

       

      Of course, I may simply be on the wrong track altogether; so as ever, any thoughts and ideas will be very gratefully received x

        • 1. Re: Is There A Way To Loop Audio Using Edge Commons?
          sssaturday

          Hi, I'm having the same issue. Were you able to find a solution?

          • 2. Re: Is There A Way To Loop Audio Using Edge Commons?
            PEPPERFACE Level 1

            Yep... I ended up binning off Edge Commons Sound and, instead, now regularly employ Buzz Js. It seems much more facilitating and provides a lot more functionality.

             

            Hope this helps

            • 3. Re: Is There A Way To Loop Audio Using Edge Commons?
              sssaturday Level 1

              Ah cool, thank you! I tried it out and it's working

              1 person found this helpful
              • 4. Re: Is There A Way To Loop Audio Using Edge Commons?
                Emmy52

                I'm sorry if these are really silly questions but I can't seem to find the answers, and since you have used Buzz you might know:

                1. can I use buzz to create sound in edge compositions destined for the ipad?

                2. will users need internet access to hear the sounds each time?  In other words do the sounds have to be called from an exteral source each time they are played, or are they part of the exported file and therefore only downloaded once.  (I understand that Ihave to manually include the audio file in the exported Edge file).

                3. can I use my own mp3 sounds, and if so, how?

                Any help would be greatly appreciated.

                • 5. Re: Is There A Way To Loop Audio Using Edge Commons?
                  PEPPERFACE Level 1

                  Hi Emmy,

                   

                  1. can I use buzz to create sound in edge compositions destined for the ipad?

                   

                  Yep. Although there still exists the MASSIVELY annoying issue whereby iOS insists on a user-push to activate the play of any audio. Apple's assertion is that users shouldn't have to worry about being forced to download unsolicited audio which may end up costing them dear if they are on a chargeable 3G connection; so they've effectively disabled anything that is, or could be described as, an autoplay function. This means that instead of being able to include autoplay of audio  - to, say, have a sound track automatically start playing when an animation begins - the playback of said track needs to be initiated by the user.

                   

                  For example, the code: sym.getComposition().getStage().YourSoundName.play(); would need to be placed on a clickable button as opposed to a trigger on the main timeline or the timeline of any of your symbols.

                   

                  In essence you have to provide the user with an opportunity to confirm that 'yes I want to hear this'.

                   

                  While the sentiment behind not wishing users to incur unwarranted expense is understandable (and laudable) the whole concept is a huge pain for animators and a total joke-killer and best. Think of it in terms of Man Slips On Bananaskin... instead of users automatically/seamlessly being able to hear a comedic associated 'whoooooop' sound they have to click a button in order to do so. 'Do you want to hear an amusing noise associated with this bit of stage action? Click for yes'. Obviously one doesn't actually have to couch such a question in actuality, but you get the drift (The Death Of Fun!). As a 'semi' workaround you may want to try experimenting with mouseOver triggers on invisible buttons.

                   

                  2. will users need internet access to hear the sounds each time?  In other words do the sounds have to be called from an exteral source each time they are played, or are they part of the exported file and therefore only downloaded once.  (I understand that Ihave to manually include the audio file in the exported Edge file).

                   

                  Not quite sure about this one as I ended up working on some entirely different stuff; so didn't persue the Apple annoyances long enough to find out more.

                  3. can I use my own mp3 sounds, and if so, how?

                   

                  If you mean, can you use mp3s that are not originated by you (i.e. iTunes tracks etc.) then essentially no. Not unless they're copyright/royalty free or you've obtained a license to use them.

                   

                  If by your own mp3 sounds you mean audio that you've originated yourself, then yes, of course

                   

                  It makes sense to produce both an mp3 and an ogg version of each sound, to ensure maximum compatibility with regard to user playback. Other than that, simply name your files, place them in a folder called 'audio' (for example) and then, in Edge's 'compositionReady', include the following code for each sound (changing the names accordingly):

                   

                  sym.YourSoundName = new buzz.sound("audio/YourSoundName", {formats: [ "ogg", "mp3" ]});

                  sym.YourSoundName.bind('loadeddata', function(e){

                       var stage = Edge.getComposition(compId).getStage();

                  });

                   

                  Then whenever you want to play a certain sound just use: sym.getComposition().getStage().YourSoundName.play(); on a trigger.

                   

                  Hope this helps

                  • 6. Re: Is There A Way To Loop Audio Using Edge Commons?
                    Emmy52 Level 1

                    Hi Pepperface,

                     

                    It works!!! Thank you so much!!!

                    Having the sound play on click is exactly what I needed, but I can see what you mean about the click requirement being a problem for other uses.

                     

                    One more question, how do I get the sound to play again if I click the button again?  At the moment it only plays once and then I have to refresh before it will play again.  Any ideas?

                     

                    Again, thank you a million times!

                    • 7. Re: Is There A Way To Loop Audio Using Edge Commons?
                      Emmy52 Level 1

                      Sorry, never mind my last question.  I see now that it was because I was in preview.  Once the file was exported the sound came on every time I clicked.

                       

                      Thanks again for your help!

                      • 8. Re: Is There A Way To Loop Audio Using Edge Commons?
                        PEPPERFACE Level 1

                        Haha, yep, I was just about to say, sounds only play once in preview mode. Glad you spotted it... and I'm delighted things are working for you, now:)

                        • 9. Re: Is There A Way To Loop Audio Using Edge Commons?
                          xwisee

                          Ive noticed a weird problem, that I dont think I get when clicking the letters on the Buzz.js demo site, but I do on my own site.

                           

                          I am trying to play audio files about the length of a song, few minutes, etc... and on the desktop everything plays fine and smoothly... but when I load the site on the iPad, if you tap the button almost immediately when it appears then the audio will playing from the very beginning of the file, but if you wait until the page is fully loaded and then tap the button, the audio starts playing a few seconds in, skipping the first part.

                           

                          I have tried all sorts of things in the code, but I don't think its anything with preloading, since you can tap the button immediately and it will play correctly.

                           

                          Any ideas?