Today’s Exercise:
- Play/Discuss one song from Discord
- Workshop that continues upon last week’s work
- Notes on Piano
- For more info on frequency of notes:
- Tone.Sampler()
- Group Work - break out into groups of 4
- Example: https://editor.p5js.org/des8963/sketches/-yfTSkb7c
- For the rest of the lab class, we are going to build out a sketch that will let us play music together. It is important that we work together on this project. As a suggestion, I would assign roles to each member of the group:
- Development Lead, Developer, User Interface Lead, Music Director, Content Researcher, Art Director
- As a group discuss a particular vibe or arc of the music that you want to perform later in the day
- By the end of the class, each of the 4 groups will present what they have.
- Upload your completed sketch to the Discord Server.
Tone.JS Sampler Object - Playing Notes with Samples
Tone.Sampler documentation on Tone.JS web site.
let sampler;
let baseURL= "<https://publicbucket2share.s3.amazonaws.com/Dirt-Samples/>";
function setup() {
createCanvas(400, 400);
btn=createButton("Play Note 1");
btn.position(100,200);
btn.mousePressed(playNote1);
btn=createButton("Play Note 2");
btn.position(200,200);
btn.mousePressed(playNote2);
sampler = new Tone.Sampler({
urls: {
A2: "juno/03_juno_chorus_low.wav",
A3: "juno/04_juno_chorus_mid.wav",
},
baseUrl: baseURL,
}).toDestination();
}
function playNote1() {
sampler.triggerAttackRelease(["C2","E2","G2"],0.5);
}
function playNote2() {
sampler.triggerAttackRelease(["A3","C3","E3"]);
}
function draw() {
background(220);
}
An example that we reviewed in class at the P5 Editor