Audio loop selector (so near and yet so far)

  • Impel GD
  • Professor
  • Professor
  • Impel GD
  • Posts: 834
  • Loc: Cologne, Germany

Post 3+ Months Ago

Hi

I'm useless with Flash, but I've followed a tutorial on creating an mp3 player ( which can be found at http://www.artifactinteractive.com.au/w4c/ ), and all seems fine...

Except the mp3 audio loops don't loop properly - they suffer from pausing each time they end. Upon searching the web, it seems that the mp3 format generally doesn't loop well. So my question is how do I change the Flash movie to use the wav format after converting the loops?

I've tried reimporting the loops as wavs to the library, and simply changing the *.mp3 references to *.wav, but this doesn't seem to work.

The results of the mp3 version can be seen here: http://www.impelgd.co.uk (temporary site - please excuse).

Here is the Actionscript code on frame 1 of the player movieclip:
Code: [ Select ]
songArray = new Array();
songArray[0]="loop1.mp3";
songArray[1]="loop2.mp3";
songArray[2]="loop3.mp3";
songArray[3]="loop4.mp3";

mySound = new Sound(this);

function newSong(songNumber){
    mySound.loadSound( songArray[songNumber], false);
}

function playSong() {
    mySound.start();
}

mySound.onLoad = playSong;
mySound.onSoundComplete = playSong;

this.onEnterFrame = function() {
    bar._width=(mySound.getBytesLoaded()/mySound.getBytesTotal())*100;
}

newSong(0);
  1. songArray = new Array();
  2. songArray[0]="loop1.mp3";
  3. songArray[1]="loop2.mp3";
  4. songArray[2]="loop3.mp3";
  5. songArray[3]="loop4.mp3";
  6. mySound = new Sound(this);
  7. function newSong(songNumber){
  8.     mySound.loadSound( songArray[songNumber], false);
  9. }
  10. function playSong() {
  11.     mySound.start();
  12. }
  13. mySound.onLoad = playSong;
  14. mySound.onSoundComplete = playSong;
  15. this.onEnterFrame = function() {
  16.     bar._width=(mySound.getBytesLoaded()/mySound.getBytesTotal())*100;
  17. }
  18. newSong(0);

The buttons code:
Code: [ Select ]
on (release) {
    newSong(0);
}
  1. on (release) {
  2.     newSong(0);
  3. }

Many thanks for any help you can give.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Aspirin99
  • Novice
  • Novice
  • Aspirin99
  • Posts: 23
  • Loc: Minneapolis

Post 3+ Months Ago

There are a couple of things to consider.

1. Audio looping in Flash in not perfect, and there is a slight pause.

2. Some audio clips loop better than others because they are created with the above in mind, usually with a decay just befor the ending.

3. Some clips have silence before or after the audio that's actually in the file.

4. You can combat the above by starting the loop a 10th of a second from the beginning after the audio makes one loop, as shown below:

_root.myloop.start();
_root.myLoop.onSoundComplete = function() {
_root.myLoop.start(.1,999)
}

Check out my tutorial. I cover this there too.

http://www.kennybellew.com/tutorial
  • Impel GD
  • Professor
  • Professor
  • Impel GD
  • Posts: 834
  • Loc: Cologne, Germany

Post 3+ Months Ago

Thanks for your reply.

I'm sure these loops do loop properly, and Macromedia seem to think that the problem is mp3 related ( http://www.macromedia.com/support/flash ... _pause.htm ).

I did try using different timing adjustments but it still sounded awkward.

I saw your tutorial, but got scared :oops: but I think I'll just have to force myself to go through it and try and get my head round the fundamentals. Then hopefully I'll be able to import sounds as wavs and build my own looper/selector.

Thanks again.

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 16 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.