MCPcopy Create free account
hub / github.com/codemistic/Web-Development / makeSound

Function makeSound

DrumKit-Extension/index.js:26–68  ·  view source on GitHub ↗
(key)

Source from the content-addressed store, hash-verified

24
25
26function makeSound(key) {
27
28 switch (key) {
29 case "w":
30 var tom1 = new Audio("sounds/tom-1.mp3");
31 tom1.play();
32 break;
33
34 case "a":
35 var tom2 = new Audio("sounds/tom-2.mp3");
36 tom2.play();
37 break;
38
39 case "s":
40 var tom3 = new Audio('sounds/tom-3.mp3');
41 tom3.play();
42 break;
43
44 case "d":
45 var tom4 = new Audio('sounds/tom-4.mp3');
46 tom4.play();
47 break;
48
49 case "j":
50 var snare = new Audio('sounds/snare.mp3');
51 snare.play();
52 break;
53
54 case "k":
55 var crash = new Audio('sounds/crash.mp3');
56 crash.play();
57 break;
58
59 case "l":
60 var kick = new Audio('sounds/kick-bass.mp3');
61 kick.play();
62 break;
63
64
65 default: console.log(key);
66
67 }
68}
69
70
71function buttonAnimation(currentKey) {

Callers 1

index.jsFile · 0.70

Calls 1

logMethod · 0.45

Tested by

no test coverage detected