# U3L7 Level 6 - Music Player

**URL:** <https://forum.code.org/t/u3l7-level-6-music-player/35381>\
**Category:** Coding and Debugging Help\
**Tags:** csd-unit-3\
**Created:** [November 8, 2021, 10:29pm UTC](https://forum.code.org/t/u3l7-level-6-music-player/35381 "2021-11-08T22:29:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![burnsk](https://avatars.discourse-cdn.com/v4/letter/b/3ab097/32.png) [@burnsk](https://forum.code.org/u/burnsk)\
**Post date:** [November 8, 2021, 10:29pm UTC](https://forum.code.org/t/u3l7-level-6-music-player/35381/1 "2021-11-08T22:29:42Z")

</div>

Does anyone notice that the music is still layering and how to correct it?

> **[Check out what I made](https://studio.code.org/projects/applab/Oa1rRmP_EuR01mZFolgEKMyhyub-r2P9O-GYCU5j-ek/view)**
>
> I wrote the code myself with Code.org

// In this level the first onEvent is also holding all the other onEvents.  
// This is what is causing this issue as it starts layering the sounds.  
// To fix it, just end the first onEvent right after the setProperty line  
// on line 11 in this answer and remove the “});” from the end.

// Show the controls when the user clicks the up button  
onEvent(“upButton”, “click”, function( ) {  
console.log(“Showing controls”);  
setProperty(“downButton”, “hidden”, false);  
setProperty(“playButton”, “hidden”, false);  
setProperty(“stopButton”, “hidden”, false);  
});

// Hide the controls  
onEvent(“downButton”, “click”, function( ) {  
setProperty(“downButton”, “hidden”, true);  
setProperty(“playButton”, “hidden”, true);  
setProperty(“stopButton”, “hidden”, true);  
console.log(“Hiding controls”);  
});

// Play the music  
onEvent(“playButton”, “click”, function( ) {  
playSound(“sound://category\_loops/vibrant\_game\_musical\_harping\_movement\_loop\_1\_accents.mp3”);  
console.log(“Playing song”);  
});

// Stop the music  
onEvent(“stopButton”, “click”, function( ) {  
stopSound();  
console.log(“Stopping song”);  
});

---

<div class="post-metadata">

**Author:** ![sangeeta50](https://avatars.discourse-cdn.com/v4/letter/s/779978/32.png) [@sangeeta50](https://forum.code.org/u/sangeeta50)\
**Post date:** [November 9, 2021, 12:43am UTC](https://forum.code.org/t/u3l7-level-6-music-player/35381/3 "2021-11-09T00:43:14Z")

</div>

Try stopping the sound before playing it again when the play button is clicked.

---

<div class="post-metadata">

**Author:** ![jdonwells](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/jdonwells/32/7900_2.png) [@jdonwells](https://forum.code.org/u/jdonwells)\
**Post date:** [November 11, 2021, 1:36pm UTC](https://forum.code.org/t/u3l7-level-6-music-player/35381/4 "2021-11-11T13:36:53Z")

</div>

I have not tested it in a while.

I opened a bug up for it last year. You should open another.
