# Sound loop problem

**URL:** https://forum.kirupa.com/t/sound-loop-problem/64744
**Category:** Uncategorized
**Created:** [September 19, 2004, 2:06pm UTC](https://forum.kirupa.com/t/sound-loop-problem/64744 "2004-09-19T14:06:13Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![kvack](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kvack/32/649_2.png) [@kvack](https://forum.kirupa.com/u/kvack)
#### Post date: [September 19, 2004, 2:06pm UTC](https://forum.kirupa.com/t/sound-loop-problem/64744/1 "2004-09-19T14:06:13Z")

</div>

Ive done a loop of a sound. But I havenig problems to make it sound properly. After it played it takes 1 second pause before it play it again.  
[http://w1.736.comhem.se/~u73611132/tacua/musik.fla](http://w1.736.comhem.se/~u73611132/tacua/musik.fla)  
Can somebody help me out with this?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 19, 2004, 2:13pm UTC](https://forum.kirupa.com/t/sound-loop-problem/64744/2 "2004-09-19T14:13:54Z")

</div>

I’ll take a look.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 19, 2004, 2:40pm UTC](https://forum.kirupa.com/t/sound-loop-problem/64744/3 "2004-09-19T14:40:10Z")

</div>

A couple of things. Flash, in general, has a built-in defect with looping sounds. There always is a little unwanted pause, but yours was exaggerated. Here’s one way to remove pause. Your sound was called, infectedbydevil, so I named the sound object that.

// Sound Objects  
infectedbydevils = new Sound();  
infectedbydevils.attachSound(“infectedbydevils01”);  
infectedbydevils.start(0,0);  
infectedbydevils.onSoundComplete = function() {  
infectedbydevils.start(.1, 0);  
};

Basically, that tells the sound to start a tenth of a second from the beginning of sound object.

I don’t think I can embed flash here, so here’s a link to how that sounds.

[http://www.aspirin99.com/test/musik02.swf](http://www.aspirin99.com/test/musik02.swf)

And, here’s a link to the fla

[http://www.aspirin99.com/test/musik02.fla](http://www.aspirin99.com/test/musik02.fla)

The other thing is, there is an art to creating sounds that loop in flash, much like the art of creating an image that tiles well. Some sounds loop better than others. I’m not an expert in that art, but I know that the sound you’ve chosen is not one edited to loop well.

Edit: Oh, and if you want to see more on this, there’s a good tutorial at:

[http://www.kennybellew.com/tutorials](http://www.kennybellew.com/tutorials)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 19, 2004, 2:46pm UTC](https://forum.kirupa.com/t/sound-loop-problem/64744/4 "2004-09-19T14:46:38Z")

</div>

thanx alot! Very good reading. But I want the sound to start directly without any button to press. how should I do then?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 19, 2004, 2:51pm UTC](https://forum.kirupa.com/t/sound-loop-problem/64744/5 "2004-09-19T14:51:45Z")

</div>

Just substitute the code in the fla with the code above. I change to fla to use a button because I thought I was going to embed the file here, only to learn that I can’t embed here. The code, infectedbydevils.start(), will start the sound. Without the onSoundComplete, this would only play the sound once. However, the onSoundComplete function causes it to repeat at the conclusion of the sound.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 19, 2004, 3:02pm UTC](https://forum.kirupa.com/t/sound-loop-problem/64744/6 "2004-09-19T15:02:49Z")

</div>

uh im not good at this…  
// Sound Objects  
infectedbydevils.start()  
infectedbydevils = new Sound();  
infectedbydevils.attachSound(“infectedbydevils01”);

infectedbydevils.onSoundComplete = function() {  
infectedbydevils.start(.1, 0);  
};

whats wrong with the code? it wont start… you had this code on your play button on(release) {  
\_root.infectedbydevils.start(0, 0);  
}  
is that suposed to be somewhere?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 19, 2004, 3:28pm UTC](https://forum.kirupa.com/t/sound-loop-problem/64744/7 "2004-09-19T15:28:31Z")

</div>

// Sound Objects

infectedbydevils = new Sound();  
infectedbydevils.attachSound(“infectedbydevils01”);  
infectedbydevils.start()  
infectedbydevils.onSoundComplete = function() {  
infectedbydevils.start(.1, 0);  
};

You need to define the sound object before you tell it to start.

infectedbydevils.start() is the same as infectedbydevils.start(0,0)

In the above, the first zero represents the offset position, in seconds, that you want to start the sound. The second zero is the number of times you want it to loop. Both should be 0 for your code because you are creating the loop and offset with the function.
