Ankitha Vasudev – Project 10 – Interactive Sonic Sketch

sketch

// Ankitha Vasudev
// Section B
// ankithav@andrew.cmu.edu
// Project 10 - Sonic Sketch

//global variables
var rx = 80;      //x position of stereo
var ry = 150;     //y position of stereo
var stereoImg;    //stereo image
var radiosong;    //slow song
var catchysong;   //fast song
var static;       //static/interference sound
var phonering;    //phone ring sound
var switcheffect; //play/pause switch sound effect
var Amp = 0;

// preloading sounds and image
function preload() {

    // stereo image
    var ImageURL = "https://i.imgur.com/MX0qMoE.jpg"
    stereoImg = loadImage(ImageURL);

    // Loading five sounds
    radiosong = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/10/basic.wav");
    catchysong = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/10/bg.mp3");
    static = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/10/interference.wav");
    phonering = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/10/ringing.wav");
    switcheffect = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/10/switch.wav");
}

function setup() {
    createCanvas(450, 450);
    background(0);
}

function soundSetup() {
    //volume for individual sounds
    radiosong.setVolume(1);
    catchysong.setVolume(0.5);
    static.setVolume(0.5);
    phonering.setVolume(0.4);
    switcheffect.setVolume(0.6);
}

function draw() {
    noStroke();

    // grey background behind stereo 
    fill(220);
    rect(0, 0, width, 300);

    // brown table
    fill(130, 80, 50);
    rect(0, ry+150, width, 200);

    // phone on table
    push();
    translate(75, 410);
    rotate(5);
    fill(80);
    rect(0, 0, 50, 90);
    fill(240);
    rect(5, 5, 40, 80);
    fill(30);
    rect(5, 10, 40, 70);
    pop();

    // antennae behind stereo
    fill(75);
    rect(350, 40, 5, 150);

    // stereo img
    image(stereoImg, rx, ry);

    // pause button 
    fill(200, 60, 60);
    rect(width/2+10, 200, 15, 20);
    stroke(30);
    strokeWeight(2);
    line(width/2+16, 205, width/2+16, 215);
    line(width/2+20, 205, width/2+20, 215);

    // play button 
    noStroke();
    fill(200, 60, 60);
    rect(width/2-10, 200, 15, 20);
    fill(50);
    triangle(width/2-7, 205, width/2-7, 215, width/2+2, 210);
}

function mousePressed() {

    //Play music when play button is pressed - switch between two songs
    if (mouseX>=(width/2)-10 & mouseX<=(width/2)+5 & mouseY<=220 & mouseY>=200) {
        if (radiosong.isLooping()) {
            catchysong.loop();
            radiosong.pause();
        } else {
            switcheffect.play();
            radiosong.loop();
            catchysong.pause();
        }
    }
    

    //Click on pause switch to stop music
    if (mouseX>=width/2+10 & mouseX<=width/2+25 & mouseY<=220 & mouseY>=200) {
        if (catchysong.isLooping || radiosong.isLooping) {
            switcheffect.play();
            catchysong.pause();
            radiosong.pause();
        }
    }


    //Play static when antennae is clicked on
    if (mouseX>=350 & mouseX<=355 & mouseY<=190 && mouseY>=40) {
        if (static.isLooping()) {
            static.pause();
        } else {
            catchysong.pause();
            radiosong.pause();
            static.loop();
        } 
    }   else {
            static.pause(); 
        }


    //Play phone ring when phone is clicked on
    if (mouseX>100 & mouseX<160 & mouseY>375 && mouseY<440) {
        if (phonering.isLooping()) {
            phonering.pause();
        } else {
            catchysong.pause();
            radiosong.pause();
            static.pause();
            phonering.loop();
        }  
    }
}

This project was tricky but fun to create. I decided to create a stereo with different sound effects that can play multiple songs when clicked on. Overall, there are five sounds in this project.

When the play button is pressed a song is played and can be changed to the next song by clicking the button again. The pause button stops the music. I added a clicking sound effect every time one of the buttons are pressed to make it more realistic.When the antennae is clicked a static noise plays and can be stopped by clicking anywhere else on the canvas. When the phone is clicked on, a ringing noises plays and can be stopped by re-clicking on the phone. 

Steven Fei – Project – 10

sketch

//Steven Fei
//Assignment 10
//Section - A
//zfei@andrew.cmu.edu
function setup() {
    createCanvas(600, 480);
    useSound();
    
}

var size = 8; //hexagon size that can change according to the mouse movement
let color = 0; //hexagon color that can change according to the mouse movement
var colorDir = 2; //the degree of change for the color change
let angle = 0; //the initial rotation angle for the hexagon
var dir = 1; // the growing direction of the hexagon, either positive or negative
var speed = 2; //the growing speed of the hexagon
var clickSoundSciFi;
var ghost;
var sizeShrink;
var rotatingPeriod;
function preload(){
    clickSoundSciFi = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/10/490266__anomaex__sci-fi-explosion-2.wav");
    ghost = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/10/490515__staudio__ghostguardian-attack-01.wav");
    rotatingPeriod = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/10/490316__nicknamelarry__cartoon-space-sfx.wav");
    sizeShrink = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/10/489892__tkky__slutty-808.wav");
}
function soundSetup(){
    clickSoundSciFi.setVolume(0.3);
    ghost.setVolume(0.3);
    sizeShrink.setVolume(0.4);
    rotatingPeriod.setVolume(0.5);
}
function mousePressed(){
    clickSoundSciFi.play();//an explosion sound when mouse is pressed
}
function mouseMoved(){
    color = color +colorDir;
    if (color<0){
        colorDir = 2;
    } else if (color>255){
        ghost.play(); //a ghost will be created when the color of the hexagon transitions between purple and blue
        colorDir = -2;
    }
    angle +=0.5;
    if(angle % 60 == 0){
        rotatingPeriod.play();// a "boon" sound will make when the hexagons finishes 1/6 of a cycle
    }
    size += dir * speed;
    if(size<0){
        dir = 1;
        size = 0;
    }else if (size>=60){
        dir = -1;
        size = 60;
        sizeShrink.play();//a sound is made to imply the hexagons are reaching the maximum sizes
    }
}

var diffx = 0;
var diffy = 0;
var circlex = 300;
var circley = 300;

function draw() {
    background(0);
//    locate the mouse position
    diffx = mouseX - circlex;
    diffy = mouseY - circley;
    circlex = circlex + 0.1*diffx;
    circley = circley + 0.1*diffy;
    fill("white");
    circle(circlex,circley,20);
    
    fill(color,37,213);
    var x = max(min(mouseX,300),5); // decide the starting point of the hexagon, when the mouse is far on the left the canvas, the hexagons may shrink together and when the mouse is far on the right of the canvas, the hexagons may move away from each other
    translate(300,240); //move to the center of the canvas
//    draw the basic shape for 1st Hexagon  
    beginShape();
    rotate(radians(angle));
    vertex(x/2,0);
    vertex(x/2+size*cos(radians(60)),0-size*sin(radians(60)));
    vertex(x/2+size+size*cos(radians(60)),0-size*sin(radians(60)));
    vertex(x/2+size+2*size*cos(radians(60)),0);
    vertex(x/2+size+size*cos(radians(60)),size*sin(radians(60)));
    vertex(x/2+size*cos(radians(60)),size*sin(radians(60)));
    endShape();
    // draw the basic shape for 2nd Hexagon
    rotate(radians(60));
    beginShape();
    vertex(x/2+1.3,0);
    vertex(x/2+1.3+1.3*size*cos(radians(60)),0-1.3*size*sin(radians(60)));
    vertex(x/2+1.3+1.3*size+1.3*size*cos(radians(60)),0-1.3*size*sin(radians(60)));
    vertex(x/2+1.3+1.3*size+2*1.3*size*cos(radians(60)),0);
    vertex(x/2+1.3+1.3*size+1.3*size*cos(radians(60)),1.3*size*sin(radians(60)));
    vertex(x/2+1.3+1.3*size*cos(radians(60)),1.3*size*sin(radians(60)));
    endShape();
//    draw the basic shape for 3rd Hexagon
    rotate(radians(60));
    beginShape();
    vertex(x/2+1.5,0);
    vertex(x/2+1.5+1.5*size*cos(radians(60)),0-1.5*size*sin(radians(60)));
    vertex(x/2+1.5+1.5*size+1.5*size*cos(radians(60)),0-1.5*size*sin(radians(60)));
    vertex(x/2+1.5+1.5*size+2*1.5*size*cos(radians(60)),0);
    vertex(x/2+1.5+1.5*size+1.5*size*cos(radians(60)),1.5*size*sin(radians(60)));
    vertex(x/2+1.5+1.5*size*cos(radians(60)),1.5*size*sin(radians(60)));
    endShape();
//  draw the basic shape for 4th Hexagon
    rotate(radians(60));
    beginShape();
    vertex(x/2+1.7,0);
    vertex(x/2+1.7+1.7*size*cos(radians(60)),0-1.7*size*sin(radians(60)));
    vertex(x/2+1.7+1.7*size+1.7*size*cos(radians(60)),0-1.7*size*sin(radians(60)));
    vertex(x/2+1.7+1.7*size+2*1.7*size*cos(radians(60)),0);
    vertex(x/2+1.7+1.7*size+1.7*size*cos(radians(60)),1.7*size*sin(radians(60)));
    vertex(x/2+1.7+1.7*size*cos(radians(60)),1.7*size*sin(radians(60)));
    endShape();
//    draw the basic shape for 5th Hexagon
    rotate(radians(60));
    beginShape();
    vertex(x/2+1.9,0);
    vertex(x/2+1.9+1.9*size*cos(radians(60)),0-1.9*size*sin(radians(60)));
    vertex(x/2+1.9+1.9*size+1.9*size*cos(radians(60)),0-1.9*size*sin(radians(60)));
    vertex(x/2+1.9+1.9*size+2*1.9*size*cos(radians(60)),0);
    vertex(x/2+1.9+1.9*size+1.9*size*cos(radians(60)),1.9*size*sin(radians(60)));
    vertex(x/2+1.9+1.9*size*cos(radians(60)),1.9*size*sin(radians(60)));
    endShape();
//    draw the basic shape for 6th Hexagon
    rotate(radians(60));
    beginShape();
    vertex(x/2+2.1,0);
    vertex(x/2+2.1+2.1*size*cos(radians(60)),0-2.1*size*sin(radians(60)));
    vertex(x/2+2.1+2.1*size+1.9*size*cos(radians(60)),0-2.1*size*sin(radians(60)));
    vertex(x/2+2.1+2.1*size+2*2.1*size*cos(radians(60)),0);
    vertex(x/2+2.1+2.1*size+1.9*size*cos(radians(60)),2.1*size*sin(radians(60)));
    vertex(x/2+2.1+2.1*size*cos(radians(60)),2.1*size*sin(radians(60)));
    endShape();
    
    
}

For this project, I applied 4 different sounds into my project 3 post. When the mouse clicks, an explosion will be initiated to represent a start of the program. There are 3 variables in my sketch – the size that directly controls the radius of the hexagons, the color that changes when the mouse moves, and the angles that manipulates the positions of the hexagons on the canvas. Therefore, the idea is to give the 3 variables different sound effects to determine whether they have reached certain bounds. For the size, a “slutty wave” sound will pop up to indicate the size of the first hexagon in the sketch reaches the upper limit. For the color changing, a ghostly impression will be made everytime when the color transitions between pink(blue) and purple. Ultimately, the angular positions of the hexagons will be suggested through a “boon” sound everytime the hexagons finishes a 1/60 cycle. All the changes can be initiated when the mouse moves and clicks.

Raymond Pai – Project 10 – Sonic Sketch

sketch

Coins are hidden in your keyboard! Press different keys until you find (hear) the jackpot! There are 4 different coin sounds in total. The sounds are inspired by retro video game coin sounds.

The keys that hide the coins are ‘a’ ‘r’ ‘u’ and ‘b’. This is achieved through keyTyped. These keyCodes play their respective retro coin sounds.

Looking Outwards 10- Alice Cai


“And I will always love you…” 
This sound art by Martin Backes blurs the lines of AI and humans but at the same time makes it all the more clear. Martin Backs feeds a computed system number-one ballads from 1990, and all of them are extremely EMOTIONAL songs. He has the computer reproduce the song with its own “emotional interpretations”. The machine attempts to replicate the human sentiment in the original song. While I listen to the machine, I can hear what seems to be crescendos and decrescendos as well as vibratos in the notes. However, it is glitchy and very clearly electronically made. You can tell that code is constantly running during the song.
The code is calculating current pitch, found pitch, frequency, and loudness. 



I find this project extremely intriguing because I was actually very impressed with the replication of the song by the machine. However, because of the clear distinctions and flaws in the replication, it also reassures me that human emotion is the one thing that cannot be replaced by electronics.

Project 10 Sonic Sketch- Alice Cai

SK

//alcai@andrew.cmu.edu
//AliceCai
//Project 10
//Section E

//load all the sound links and set the volume
function preload() {
    a = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/10/217214__goldkelchen__slap-in-the-face-1.wav");
    b = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/10/148997__adam-n__slap-2-1.wav");
    c = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/10/421876__sventhors__ouch-2.wav");
    d = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/10/348244__newagesoup__punch-boxing-01.wav");
    a.setVolume(1);
    b.setVolume(1);
    c.setVolume(1);
    d.setVolume(1);
}

function setup() {
    createCanvas(400, 400);
    background(200, 220, 250);
}

function draw() {
    //color change if mouse is pressed
    //draw face
    if (mouseIsPressed) {
        fill('red');
        noStroke();
        ellipse(width/2,height/2,400,400);
    } else {
        fill('yellow'); 
        noStroke();
        ellipse(width/2,height/2,400,400);
    }

    fill('black');
    ellipse(width/4,height/5 *2 ,30,60);
    ellipse(width/4 * 3,height/5 *2 ,30,60);
    //change to tears when face is hit
    if (mouseIsPressed) {
        fill('blue')
        ellipse(width/4*3, height/5* 3,20,50);
        ellipse(width/4, height/5* 3,20,90);
    } else {
        fill('pink');
        arc(width/2, height/1.8, 200, 200, 0, PI, PI);
    }

    print(mouseIsPressed);
}

function mousePressed (){
    //call different sounds for where the mouse is clicked
    if (mouseX < width/2 & mouseY > height/2) {
        a.play();
    }

    if (mouseX > width/2 & mouseY < height/2) {
        b.play();
    }

    if (mouseY > height/2 & mouseX > height/2) {
        c.play();
    }

    if (mouseY < height/2 & mouseX < width/2) {
        d.play();
    }
}

This is my sound project. It plays four sounds when the mouse clicks (or “hits) the face: big slap, small slap, punch, and OOF!, depending on where the mouse is clicked (four quadrants). When the mouse is clicked the face turns red and starts crying too! I thought it would be funny and simple.

Min Ji Kim Kim – Project 10 – Sonic-Sketch


sketch

I got this week’s project inspiration from the facebook emojis and decided to animate them with sound. You can click on each emoji and it will generate the corresponding mood sound. The hardest part of this project was trying to figure out how to use a local host and uploading it to WordPress, but overall, it was really fun!

/*
Min Ji Kim Kim
Section A
mkimkim@andrew.cmu.edu
Project-10
*/

var laugh;
var wow;
var crying;
var angry;

function preload() { //load sound files
    laugh = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/10/laugh.wav");
    wow = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/10/wow.wav");
    crying = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/10/crying.wav");
    angry = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/10/angry.wav");
}

function setup() {
    createCanvas(480, 300);
    noStroke();
    //create different background colors
    fill("#184293"); //laughing emoji
    rect(0, 0, width / 4, height);
    fill("#05B5C3"); //wow emoji
    rect(width / 4, 0, width / 4, height);
    fill('#BC2D15'); //angry emoji
    rect(width / 2, 0, width / 4, height);
    fill(0); //sad emoji
    rect(width * 3 / 4, 0, width / 4, height);
}

function draw() {
    noStroke();
    //create 4 emoji heads
    for (i = 0; i < 4; i++) {
        fill("#FBD771");
        circle(i * width / 4 + 60, height / 2, 90);
    }
    
    //laughing emoji
    //eyes
    stroke(45);
    line(35, 130, 50, 135); //left
    line(35, 140, 50, 135);
    line(70, 135, 85, 130); //right
    line(70, 135, 85, 140);
    //mouth
    noStroke();
    fill(45);
    arc(60, 155, 55, 50, 0, PI);
    fill('#F35269');
    ellipse(60,170,38,20);
    
    //wow emoji
    //eyes & mouth
    fill(45);
    ellipse(160, 140, 13, 20);
    ellipse(200, 140, 13, 20);
    ellipse(180, 170, 25, 35);
    //eyebrows
    noFill();
    stroke(45);
    strokeWeight(3);
    curve(130, 180, 152, 125, 166, 120, 140, 120);
    curve(170, 140, 193, 120, 207, 125, 200, 150);

    //angry emoji
    //eyebrows
    stroke(45);
    strokeWeight(4);
    line(270, 150, 290, 155);
    line(310, 155, 330, 150);
    //eyes
    fill(45);
    circle(283, 157, 5);
    circle(318, 157, 5);
    //mouth
    ellipse(300,170,20,3);

    //crying emoji
    //eyes
    ellipse(400, 150, 10, 12);
    ellipse(440, 150, 10, 12);
    //eyebrows
    noFill();
    stroke(45);
    strokeWeight(3);
    curve(410, 130, 392, 140, 405, 135, 450, 160);
    curve(410, 150, 435, 135, 448, 140, 450, 165);
    //mouth
    arc(420, 175, 20, 15, PI, TWO_PI);
    noStroke();
    //tear
    fill("#678ad6");
    circle(445, 185, 15);
    triangle(438, 182, 445, 165, 452, 182);
}

function mousePressed() {
    if(mouseX < width / 4) { //play lauging sound
        laugh.play();
    }
    if(mouseX > width / 4 & mouseX < width / 2) { //play wow sound
        wow.play();
    }
    if(mouseX > width / 2 & mouseX < width * 3 / 4) { //play angry sound
        angry.play();
    }
    if(mouseX > width * 3 / 4) { //play crying sound
        crying.play();
    }
}

lee chu – looking outwards 10

visuals from Porter Robinson’s Worlds tour

Porter Robinson, renown producer of electronic music, is also well known for his visuals at his live performances. Not only do the visuals need to be visually stunning, but they also need to correlate with and move with the music logically.

Porter aimed to bring beautiful and immersive sounds and visions to a genre of music too often associated with heavy bass drops. Porter sought to transport his audiences into hyper-real, neon-toned worlds of anime and MMORPG’s. These videogame-esque worlds unfold before you to bring back that childhood escapism into fantasy and fictional worlds.

Hyejo Seo – Looking Outwards – 10

Ge Wang’s Ted Talk on computer music

Ge Wang is a professor at Stanford Department of Music and a co-founder of ‘Smule’. As a professor at Stanford, he created different instruments for the Stanford Computer Orchestra, using programming language, Chuck, and game track. Game track was first commoditized for golf players as it is a device that tracks your hand gestures. After coding for different instruments, the orchestra members play these instruments using this device. It not only produces different sounds depending on how much you have pulled or the location of your hand (left or right), but it also promotes interactions just like the traditional instruments.

As a co-founder of Smule, Ge Wang created an app that would function as portable instruments. In his Ted talk, he demonstrates playing ocarina with this app. As he is blowing into the microphone of his phone and pushing different buttons on the screen, the app starts to make sound. The app has Chuck code – music programming language – that detects the strength of your blowing and synthesizing the sounds.

I decided to talk about this talk for several reasons. First, the fact that Stanford University has Computer Orchestra was really impressive. Students are able to learn and experience the future of music – exploring the interdisciplinary field of Computer Science and Music. Furthermore, I thought it was really interesting that Ge decided to keep the interaction between the people and their instruments. Overall, his works are innovative and pioneering.

Carly Sacco – Looking Outwards – 10

LINES by Anders Lind.

LINES is an interactive sound art exhibit by Anders Lind that allows users to make music by moving their hands and feet over lines. The lines are paired with sensors and electronics to create the sounds of three different instruments. It works by distance sensors that are connected to an arduino board on a mac mini. The signals from users hands are then translated from distance to sound. Lind created LINES to allow people to experience a new form of musical interactions and experiences. 

I admire that this project has a direct correlation between human interaction and the sound produced. People can work together, or participate alone and the results will always be different based on how the people move their hands. I thought it was very interesting how Lind even incorporated the lines on the floor too to create more possibilities of interaction.

Emma NM-Project-10(Interactive Sound)

To hear the animal’s sound, click on the image. The four sounds are a dog barking, duck quacking, cat meowing, and cow mooing. To turn the sound off, click the image again.

sound

/* 
Emma Nicklas-Morris
Section B
enicklas
Project-10
Interactive Sound
*/


var cowSound;
var duckSound;
var catSound;
var dogSound;

var dogImg;
var cowImg;
var duckImg;
var catImg;
var adj = 10;


function preload() {
    // load my 4 animal sounds and images
    cowSound = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/10/cow.wav");
    duckSound = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/10/duck.wav");
    catSound = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/10/cat.wav");
    dogSound = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/10/dog.wav");

    catImg = loadImage("https://i.imgur.com/nliPYUx.jpg");
    duckImg = loadImage("https://i.imgur.com/mwzKbS9.jpg");
    cowImg = loadImage("https://i.imgur.com/u6LpEOD.jpg");
    dogImg = loadImage("https://i.imgur.com/0tT7kPQ.jpg");

}


function setup() {
    createCanvas(500, 400);
    useSound();

}


function soundSetup() {
    cowSound.setVolume(.5);
    catSound.setVolume(2);

}


function draw() {

    background("lightblue");

    // display the 4 animal images
    image(catImg, width/2 - adj, 0, catImg.width/2, catImg.height/2);
    image(duckImg, 0, 0, duckImg.width/5, duckImg.height/5);
    image(dogImg, -3 * adj, height/2, dogImg.width/2, dogImg.height/2);
    image(cowImg, width/2 + adj + 6, height/2, cowImg.width/1.5 , cowImg.height/1.5);

}



function mousePressed() {
    // when you click on duck picture, play quack sound
    // to turn off, click again.
    if ((mouseX < duckImg.width/5) & (mouseY < duckImg.height/5)) {
        if (duckSound.isLooping()) {
            duckSound.stop();
        }
        else {
            duckSound.loop();
        }

    }

    // when you click on cat picture, play meow sound
    // to turn off, click again.
    else if ((mouseX > duckImg.width/5) & (mouseY < height/2)) {
        if (catSound.isLooping()) {
            catSound.stop();
        }
        else {
            catSound.loop();
        }

    }

    // when you click on dog picture, play barking sound
    // to turn off, click again.
    else if ((mouseX < width/2 + adj + 6) & (mouseY > duckImg.height/5)) {
        if (dogSound.isLooping()) {
            dogSound.stop();
        }
        else {
            dogSound.loop();
        }

    }

    // when you click on cow picture, play mooing sound
    // to turn off, click again.
    else if ((mouseX > width/2 + adj + 6) & (mouseY > height/2)) {
        if (cowSound.isLooping()) {
            cowSound.stop();
        }
        else {
            cowSound.loop();
        }

    }
}

I struggled a lot to get my sounds to work, most of it was something I didn’t quite understand with how p5.js needs to have the sound library called in the html. I also learned that sounds take up a lot of browsing cache, so to help keep your page refreshing properly, you need to clear your cache often when using sounds. My idea is geared towards a pre-school/kindergarten activity. It would allow them to learn what animals make what sounds.