# To debug the issue of repeatition of sound

**URL:** <https://forum.code.org/t/to-debug-the-issue-of-repeatition-of-sound/32773>\
**Category:** Coding and Debugging Help\
**Created:** [June 13, 2020, 9:23am UTC](https://forum.code.org/t/to-debug-the-issue-of-repeatition-of-sound/32773 "2020-06-13T09:23:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![learnfromsushmita](https://avatars.discourse-cdn.com/v4/letter/l/d78d45/32.png) [@learnfromsushmita](https://forum.code.org/u/learnfromsushmita)\
**Post date:** [June 13, 2020, 9:23am UTC](https://forum.code.org/t/to-debug-the-issue-of-repeatition-of-sound/32773/1 "2020-06-13T09:23:07Z")

</div>

> **[Code.org](https://studio.code.org/users/sign_in)**
>
> Anyone can learn computer science. Make games, apps and art with code.

I want to sea animals to appear one after another and want to play respective sound as well.  
But there is an issue in sound.Not able to stop the sound …it’s playing repeatedly.  
Please help me to debug this

---

<div class="post-metadata">

**Author:** ![melynn](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/melynn/32/4925_2.png) [@melynn](https://forum.code.org/u/melynn)\
**Post date:** [June 13, 2020, 1:37pm UTC](https://forum.code.org/t/to-debug-the-issue-of-repeatition-of-sound/32773/2 "2020-06-13T13:37:20Z")

</div>

Hi @learnfromsushmita,

The link you posted takes me to my [Code.org](http://Code.org) dashboard. Can you click the SHARE link of the project and post that here? We’d love to take a look and give you some tips.

Michelle

---

<div class="post-metadata">

**Author:** ![learnfromsushmita](https://avatars.discourse-cdn.com/v4/letter/l/d78d45/32.png) [@learnfromsushmita](https://forum.code.org/u/learnfromsushmita)\
**Post date:** [June 13, 2020, 1:51pm UTC](https://forum.code.org/t/to-debug-the-issue-of-repeatition-of-sound/32773/3 "2020-06-13T13:51:29Z")

</div>

> **[Check out what I made](https://studio.code.org/projects/gamelab/hmgGY148AzwyK_8Y3Y5ABhDjQdvxTJASy-ahAmUr8dk)**
>
> I wrote the code myself with Code.org

Please refer.  
Regards  
Sushmita

---

<div class="post-metadata">

**Author:** ![learnfromsushmita](https://avatars.discourse-cdn.com/v4/letter/l/d78d45/32.png) [@learnfromsushmita](https://forum.code.org/u/learnfromsushmita)\
**Post date:** [June 13, 2020, 2:31pm UTC](https://forum.code.org/t/to-debug-the-issue-of-repeatition-of-sound/32773/4 "2020-06-13T14:31:54Z")

</div>

The **idea of this project** is to create random bubble after certain frameCounts.When someone clicks on the bubble it should burst and a sea animal should appear with it’s specific sound.

**Bug:** There is repeation of the sound of the animal when the bubble is bursted.

So want to fix this and get sea animals generated one after another with bursting of bubble with no repeatition of sound.

Looking forward to the issue resolution. 🙂  
Regards  
Sushmita

---

<div class="post-metadata">

**Author:** ![melynn](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/melynn/32/4925_2.png) [@melynn](https://forum.code.org/u/melynn)\
**Post date:** [June 15, 2020, 3:02pm UTC](https://forum.code.org/t/to-debug-the-issue-of-repeatition-of-sound/32773/5 "2020-06-15T15:02:32Z")

</div>

Hi @learnfromsushmita,

The bug (the repeating sound) occurs because vdefiner stays a constant value while it is inside the loop. So, the sound will play 32 time per second for as long as that variable holds that value. You will need to immediately change the value of vdefiner in some way to get the sound to stop looping. Here is a post with some [example solutions](https://forum.code.org/t/music-loops-too-many-times-when-game-ends/31956/10).

As for the sea animals, it looks like your sea animals are being generated randomly but they are not associated with a bubble animation BEFORE I click on them but there ARE associated with an animal animation AFTER I click on them. Can you associate a bubble animation to the animal BEFORE the mouse click in the same way you associated an animal animation after the mouse click?

FYI - I like the use of the modulus to time the animation - very clever.

Good luck as you continue to iterate the game!  
~Michelle
