Play sound in code.org unit 3 lesson 14

My students are wanting to use sounds but they repeat the sound before it completes. I am not understanding the support document for this, can anyone help me solve and teach this problem for my students?

Hi @joell.boast,

Sound can be tricky. It is a little hard to know what is going on with your code without a link. Here are some tips that may help:

  • The playSound block has a boolean property and if it is set to true, it will repeat or loop but if it is set to false it will only play once. I think you just need to set this property to false.

    The issue is if the block is a part of a conditional statement that is true each time the function (draw) loop loops (which is about 30 times per second) which may be causing the sound to play repeatedly. So…below is a trick that might work depending on your code…
  • This little super simple trick might work for your code.

Good Luck,
~Michelle

1 Like