first commit

This commit is contained in:
Anuj Kaushik 2021-07-02 12:08:47 +05:30
parent da570a7da8
commit 552166b7f0
10 changed files with 147 additions and 0 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
.DS_Store

60
index.html Normal file
View file

@ -0,0 +1,60 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="https://fonts.googleapis.com/css?family=Poppins" rel="stylesheet" />
<link rel="stylesheet" href="./style.css" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Tap Music</title>
</head>
<body>
<section class="app">
<header>
<h1>Sound Pads</h1>
<p>Tap/Click on the buttons below.</p>
</header>
<div class="pads">
<div class="line">
<div class="kick">
<h3>Kick</h3>
<audio src="./sounds/kick.wav" class="sound"></audio>
</div>
<div class="_808">
<h3>808</h3>
<audio src="./sounds/808.wav" class="sound"></audio>
</div>
</div>
<div class="line">
<div class="snare">
<h3>Snare</h3>
<audio class="sound">
<source src="./sounds/snare.wav" />
</audio>
</div>
<div class="hat">
<h3>Hat</h3>
<audio class="sound">
<source src="./sounds/hat.wav" />
</audio>
</div>
</div>
<div class="line">
<div class="synth1">
<h3>Synth1</h3>
<audio class="sound">
<source src="./sounds/synth1.wav" />
</audio>
</div>
<div class="synth2">
<h3>Synth2</h3>
<audio class="sound">
<source src="./sounds/synth2.wav" />
</audio>
</div>
</div>
</div>
</section>
<script src="script.js"></script>
</body>
</html>

20
script.js Normal file
View file

@ -0,0 +1,20 @@
window.addEventListener("load", () => {
const sounds = document.querySelectorAll(".sound");
const pads = document.querySelectorAll(".line div");
const colors = [
"#60d394",
"#d36060",
"#c060d3",
"#d3d160",
"#606bd3",
"#60c2d3"
];
pads.forEach((pad, index) => {
pad.addEventListener("click", function() {
sounds[index].currentTime = 0;
sounds[index].play();
createBubble(index);
});
});
});

BIN
sounds/808.wav Executable file

Binary file not shown.

BIN
sounds/hat.wav Executable file

Binary file not shown.

BIN
sounds/kick.wav Executable file

Binary file not shown.

BIN
sounds/snare.wav Executable file

Binary file not shown.

BIN
sounds/synth1.wav Executable file

Binary file not shown.

BIN
sounds/synth2.wav Executable file

Binary file not shown.

65
style.css Normal file
View file

@ -0,0 +1,65 @@
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: "Poppins", sans-serif;
}
.app {
min-height: 100vh;
align-items: center;
}
header h1 {
margin: 50px 0px 20px 0px;
text-align: center;
font-size: 40px;
}
header p {
font-size: 25px;
text-align: center;
margin-bottom: 20px;
}
.pads {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
}
.kick {
background: #60d394;
}
._808 {
background: #d36060;
}
.snare {
background: #c060d3;
}
.hat {
background: #d3d160;
}
.synth1 {
background: #606bd3;
}
.synth2 {
background: #60c2d3;
}
.line {
display: flex;
}
.line > div {
padding: 3rem;
margin: 1rem;
}
h3 {
text-align: center;
color: white;
}