Check out the Code! 2 Sound Module Instructions Here

output.mp4

Topics in this Session

The video from my Nov 1 review session will go here :

Playing Sound Files - P5 Reference

let drums;

function preload() {
	// Note in order to play sound files, you need to upload them
	//   to the P5 editor. In this case, I have uploaded drums.mp3
	//   into my code folder.
  drums=loadSound("drums.mp3");  
}

function setup() {
  createCanvas(400, 400);
  drums.loop();
}

function mousePressed() {
  if (drums.isPlaying()) {
    drums.pause();
  } else {
    drums.loop();
  }
}

function draw() {
  background(220);
}

Here is the code on playing clips of sounds from our review session (this code is more advanced than the code above as it has three sounds and how to work with sliders)

Are you looking for sounds to play with? Here are some resources for finding sounds:

<aside> 💡 Are you looking for sounds to play with? Here are some resources for finding sounds:

Dirt Samples which is part of the Super-Dirt project. Dave has bucket on Amazon which you can access here: https://publicbucket2share.s3.amazonaws.com/Dirt-Samples/index.html

Free Music Archive (FMA) offers free access to open licensed, original music by independent artists around the world: https://freemusicarchive.org/genres

Freesound is a web site with free sounds you can use: https://freesound.org/

London Philharmonia Sound Samples: https://philharmonia.co.uk/resources/sound-samples/

Archive.org has a large amount of freely available music and sounds. Note that you want to find “mp3” files, much of their archive is streamable only, but there are many collections that have mp3 files to download

</aside>

Visualizing Sound

Amplitude - See P5 Reference. The following code is the minimum code needed to do an amplitude visualization. Note that this code will do nothing as the Sketch is not playing any sound. Add this code to a sketch that is making sound.