Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
RayhaanSheeraj authored Sep 24, 2021
1 parent 93f676c commit be71a7c
Show file tree
Hide file tree
Showing 11 changed files with 129 additions and 0 deletions.
Binary file added 2021-08-31 (1).jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2021-08-31.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2708694.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added hero-img_copy.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<title>AI Music WEB APP</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
<script>"https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.0/p5.min.js"</script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.0.0/p5.js"></script>

<script src="https://unpkg.com/[email protected]/dist/ml5.min.js"></script>

<link rel="stylesheet" type="text/css" href="style.css">
<script src="//cdn.jsdelivr.net/npm/[email protected]/lib/addons/p5.sound.min.js" target="_blank"></script>
<script src = "https://cdn.jsdelivr.net/npm/[email protected]/lib/addons/p5.sound.min.js"></script>
</head>
<body background="hero-img_copy.jpg">
<center>
<h3 class = "btn btn-warning heading">AI MUSIC WEB APP
<br>
<span class="note">NOTE - Get you left hand wrist in front of web cam to play one music and Get you right hand wrist in front of web cam to play different music</span>
</h3>
<button onclick="play()" class="btn btn-primary play_button">Play</button>
</center>

<script src="main.js"></script>
</body>
</html>
76 changes: 76 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
song1 ="";
song2 = "";
leftwristx = 0;
rightwristx = 0;
leftwristy = 0;
rightwristy = 0;
scoreleftwrist = 0;
scorerightwrist = 0;
song1_status = "";
song2_status = "";
function preload(){
song1 = loadSound("music.mp3");
song2 = loadSound("music2.mp3");
}
function setup(){
canvas = createCanvas(600,500);
canvas.center();
video = createCapture(VIDEO);
video.hide();
poseNet = ml5.poseNet(video,modelLoaded);
poseNet.on('pose', gotPoses);

}

function modelLoaded(){
console.log("pose net is inilitized");
}
function gotPoses(results){
if(results.length > 0){
console.log(results);
scoreleftwrist = results[0].pose.keypoints[9].score;
console.log("left wrist score = " + scoreleftwrist);
scorerightwrist = results[0].pose.keypoints[10].score;
console.log("right wrist score = " + scorerightwrist);
leftwristx = results[0].pose.leftWrist.x;
leftwristy = results[0].pose.leftWrist.y;
console.log("leftwristx = " + leftwristx + "leftwristy = " + leftwristy);
righttwristx = results[0].pose.rightWrist.x;
rightwristy = results[0].pose.rightWrist.y;
console.log("rightwristx = " + rightwristx + "rightwristy = " + rightwristy);
}



}

function draw(){
image(video,0,0,600,500);
song1_status = song1.isPlaying();
song2_status = song2.isPlaying();
fill('#00FFFF');
stroke('#00FFFF');
if(scorerightwrist > 0.2){
circle(rightwristx,rightwristy,20);
song2.stop();
if(song1_status == false){
song1.play();
document.getElementById("song").innerHTML = "playing - Harry potter theme song";
}

}
if(scoreleftwrist > 0.2){
circle(leftwristx,leftwristy,20);
song1.stop();
if(song2_status == false){
song2.play();
document.getElementById("song").innerHTML = "playing - Peter Pan song";
}

}
}
function play(){
song.play();
song.setVolume(1);
song.rate(1);
}
Binary file added music.mp3
Binary file not shown.
Binary file added music2.mp3
Binary file not shown.
23 changes: 23 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.heading{
font-size:23px;
width:100%;
margin:0px;

}
.note{
font-size: 15px;
color: black;

}
body{
background-size: cover;

}
.play_button{
width: 130px;
font-size: 25px;
}
canvas{
border: 5px solid white;
border-radius: 20px;
}
Binary file added unnamed.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit be71a7c

Please sign in to comment.