Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
p5js-sound1 [2024/03/19 23:25] renickp5js-sound1 [2024/03/19 23:27] (current) renick
Line 1: Line 1:
 ====== the basics of sound in p5js ====== ====== the basics of sound in p5js ======
 +
 +All of the documentation for sound-related functions in p5js is here: https://p5js.org/reference/#/libraries/p5.sound
  
 ===== making a sound play and loop ===== ===== making a sound play and loop =====
 +
 +Let's get a sound playing in p5js.
 +
 +This works, but notice the problem when you click the square more than once!
 +
 <HTML> <HTML>
 <iframe src="https://editor.p5js.org/renick/sketches/xK8lVKUCP" width=99% height=800></iframe> <iframe src="https://editor.p5js.org/renick/sketches/xK8lVKUCP" width=99% height=800></iframe>
 </HTML> </HTML>
- 
  
 ===== making a sound play only when the mouse is clicked ===== ===== making a sound play only when the mouse is clicked =====
Line 15: Line 21:
 <iframe src="https://editor.p5js.org/renick/sketches/PC5p6LAGl" width=99% height=800></iframe> <iframe src="https://editor.p5js.org/renick/sketches/PC5p6LAGl" width=99% height=800></iframe>
 </HTML> </HTML>
- 
  
 ===== the problem: clicking ===== ===== the problem: clicking =====
Line 25: Line 30:
 <iframe src="https://editor.p5js.org/renick/sketches/N5C_DXuiP" width=99% height=800></iframe> <iframe src="https://editor.p5js.org/renick/sketches/N5C_DXuiP" width=99% height=800></iframe>
 </HTML> </HTML>
- 
  
 ===== stopping a loop ===== ===== stopping a loop =====
  • p5js-sound1.txt
  • Last modified: 6 weeks ago
  • by renick