# Sound and light animation at the same time

**URL:** <https://forum.makecode.com/t/sound-and-light-animation-at-the-same-time/3436>\
**Category:** Adafruit Circuit Playground Express\
**Created:** [September 12, 2020, 7:27am UTC](https://forum.makecode.com/t/sound-and-light-animation-at-the-same-time/3436 "2020-09-12T07:27:40Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![wanderingaround](https://avatars.discourse-cdn.com/v4/letter/w/e480ec/32.png) [@wanderingaround](https://forum.makecode.com/u/wanderingaround)\
**Post date:** [September 12, 2020, 7:27am UTC](https://forum.makecode.com/t/sound-and-light-animation-at-the-same-time/3436/1 "2020-09-12T07:27:40Z")

</div>

Hello… can anyone help me fix this up so the melody plays at the same time as the light animation please… at the moment they run one after the other… thanks Mike

![ss](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/7/7aac76d6ca35729b0b161561c1e96f06aa3d8cfc.jpeg)

---

<div class="post-metadata">

**Author:** ![GameGod](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gamegod/32/2756_2.png) [@GameGod](https://forum.makecode.com/u/GameGod)\
**Post date:** [September 12, 2020, 4:01pm UTC](https://forum.makecode.com/t/sound-and-light-animation-at-the-same-time/3436/2 "2020-09-12T16:01:36Z")

</div>

Maybe you can make each a function, then call them in the A button pressed.

---

<div class="post-metadata">

**Author:** ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)\
**Post date:** [September 12, 2020, 9:59pm UTC](https://forum.makecode.com/t/sound-and-light-animation-at-the-same-time/3436/3 "2020-09-12T21:59:45Z")

</div>

That would be useless.

---

<div class="post-metadata">

**Author:** ![GameGod](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gamegod/32/2756_2.png) [@GameGod](https://forum.makecode.com/u/GameGod)\
**Post date:** [September 12, 2020, 10:00pm UTC](https://forum.makecode.com/t/sound-and-light-animation-at-the-same-time/3436/4 "2020-09-12T22:00:24Z")

</div>

Oh… works for me sometimes.

---

<div class="post-metadata">

**Author:** ![GameGod](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gamegod/32/2756_2.png) [@GameGod](https://forum.makecode.com/u/GameGod)\
**Post date:** [September 12, 2020, 10:01pm UTC](https://forum.makecode.com/t/sound-and-light-animation-at-the-same-time/3436/5 "2020-09-12T22:01:22Z")

</div>

How _would_ you do it?

---

<div class="post-metadata">

**Author:** ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)\
**Post date:** [September 12, 2020, 10:01pm UTC](https://forum.makecode.com/t/sound-and-light-animation-at-the-same-time/3436/6 "2020-09-12T22:01:38Z")

</div>

Really?

---

<div class="post-metadata">

**Author:** ![GameGod](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gamegod/32/2756_2.png) [@GameGod](https://forum.makecode.com/u/GameGod)\
**Post date:** [September 12, 2020, 10:02pm UTC](https://forum.makecode.com/t/sound-and-light-animation-at-the-same-time/3436/7 "2020-09-12T22:02:37Z")

</div>

I don’t know, I just tried it and It doesn’t work anymore. My logic is that is calls one, and then moves on while the function is running.

---

<div class="post-metadata">

**Author:** ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)\
**Post date:** [September 12, 2020, 10:02pm UTC](https://forum.makecode.com/t/sound-and-light-animation-at-the-same-time/3436/8 "2020-09-12T22:02:51Z")

</div>

In arcade, I would use darzu’s timer extension

> [@Timers extension: after X, debounce, throttle, and in-background](https://forum.makecode.com/t/timers-extension-after-x-debounce-throttle-and-in-background/1925):
>
> Hello world, I create a new “Timers” extension: [https://github.com/darzu/arcade-timers](https://github.com/darzu/arcade-timers) Early beta. Sample: [https://makecode.com/\_c57bYTea0RFV](https://makecode.com/_c57bYTea0RFV) Blocks Examples “After X do” / aka setTimeout: “Separately do” / aka run in background thread: “after Y settled for X do” / aka debounce: “for Y at most once every X do” / aka throttle:

But IDK if that would work in the OPs situation

---

<div class="post-metadata">

**Author:** ![GameGod](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gamegod/32/2756_2.png) [@GameGod](https://forum.makecode.com/u/GameGod)\
**Post date:** [September 12, 2020, 10:04pm UTC](https://forum.makecode.com/t/sound-and-light-animation-at-the-same-time/3436/9 "2020-09-12T22:04:37Z")

</div>

I agree. This block?  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/1/1d8cc600349009f2fd6e9559b232231005cdcece.png)

---

<div class="post-metadata">

**Author:** ![jwunderl](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/jwunderl/32/5308_2.png) [@jwunderl](https://forum.makecode.com/u/jwunderl)\
**Post date:** [September 12, 2020, 11:19pm UTC](https://forum.makecode.com/t/sound-and-light-animation-at-the-same-time/3436/11 "2020-09-12T23:19:09Z")

</div>

It looks like you want the `run in parallel` block from the control category - the issue is that both of these blocks pause so you can place multiple in a row to build larger animations / songs.

The block is here:

 ![Screenshot_20200912-161323_Chrome](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/0/06c2a900513dd606f3a5210b5bb5affe8662eba5.jpeg)

And you would use it like this:

 ![SmartSelect_20200912-161635_Chrome](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/0/0061fe21d8c070ad6f14e2d5747062f72a24d741.jpeg)

This will cause the two actions to run without blocking eachother

---

<div class="post-metadata">

**Author:** ![wanderingaround](https://avatars.discourse-cdn.com/v4/letter/w/e480ec/32.png) [@wanderingaround](https://forum.makecode.com/u/wanderingaround)\
**Post date:** [September 13, 2020, 5:25am UTC](https://forum.makecode.com/t/sound-and-light-animation-at-the-same-time/3436/12 "2020-09-13T05:25:42Z")

</div>

Thanks @jwunderl looks good but has unexpected results… I tried the way you suggested but the parallel blocks run later code in parallel too:

> **[Parallel 1](https://makecode.adafruit.com/93005-12127-45491-59342)**
>
> Made with ❤️ in Adafruit Circuit Playground Express - Blocks / Javascript editor.

I also tried both actions in the same block which also ran later code at the same time:

> **[Parallel 2](https://makecode.adafruit.com/91828-82152-22121-82412)**
>
> Made with ❤️ in Adafruit Circuit Playground Express - Blocks / Javascript editor.

I suspect the parallel block is the answer, I’ll read up on it’s use… Mike
