-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
93f676c
commit be71a7c
Showing
11 changed files
with
129 additions
and
0 deletions.
There are no files selected for viewing
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.
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.