{"id":9519,"date":"2024-01-09T18:03:00","date_gmt":"2024-01-09T18:03:00","guid":{"rendered":"https:\/\/codehim.com\/?p=9519"},"modified":"2024-01-22T16:05:07","modified_gmt":"2024-01-22T11:05:07","slug":"drum-kit-using-javascript","status":"publish","type":"post","link":"https:\/\/codehim.com\/vanilla-javascript\/drum-kit-using-javascript\/","title":{"rendered":"Drum Kit Using JavaScript"},"content":{"rendered":"<p>This JavaScript code creates a virtual drum kit that you can play by pressing keys on your keyboard. When a key is pressed, it triggers a corresponding drum sound. The core functionality of this code is to associate specific keys with drum <a href=\"https:\/\/codehim.com\/vanilla-javascript\/javascript-play-sound-onclick\/\" target=\"_blank\" rel=\"noopener\">sounds and play them in response to key presses<\/a>. It provides an interactive and fun way to make music using your computer&#8217;s keyboard.<\/p>\n<h2>How to Create Drum Kit Using JavaScript<\/h2>\n<p>1. In your HTML file, create the structure for your drum kit. Use the following HTML code, which defines the keys and their corresponding sounds.<\/p>\n<pre class=\"prettyprint linenums lang-html\">&lt;!-- PRESS THE CORRESPONDING KEY ON YOUR KEYBOARD TO PLAY!--&gt;\r\n\r\n&lt;div class=\"center\"&gt;\r\n&lt;div class=\"keys\"&gt;\r\n  &lt;div data-key=\"65\" class=\"key\"&gt;\r\n    &lt;kbd&gt;A&lt;\/kbd&gt;\r\n    &lt;span class=\"sound\"&gt;clap&lt;\/span&gt;             &lt;\/div&gt;\r\n  &lt;div data-key=\"83\" class=\"key\"&gt;\r\n    &lt;kbd&gt;S&lt;\/kbd&gt;\r\n    &lt;span class=\"sound\"&gt;hihat&lt;\/span&gt;\r\n  &lt;\/div&gt;\r\n  &lt;div data-key=\"68\" class=\"key\"&gt;\r\n    &lt;kbd&gt;D&lt;\/kbd&gt;\r\n    &lt;span class=\"sound\"&gt;kick&lt;\/span&gt;\r\n  &lt;\/div&gt;\r\n  &lt;\/div&gt;\r\n&lt;div class=\"keys\"&gt;\r\n  &lt;div data-key=\"70\" class=\"key\"&gt;\r\n    &lt;kbd&gt;F&lt;\/kbd&gt;\r\n    &lt;span class=\"sound\"&gt;openhat&lt;\/span&gt;\r\n  &lt;\/div&gt;\r\n  &lt;div data-key=\"71\" class=\"key\"&gt;\r\n    &lt;kbd&gt;G&lt;\/kbd&gt;\r\n    &lt;span class=\"sound\"&gt;boom&lt;\/span&gt;\r\n  &lt;\/div&gt;\r\n  &lt;div data-key=\"72\" class=\"key\"&gt;\r\n    &lt;kbd&gt;H&lt;\/kbd&gt;\r\n    &lt;span class=\"sound\"&gt;ride&lt;\/span&gt;\r\n  &lt;\/div&gt;\r\n&lt;\/div&gt;\r\n&lt;div class=\"keys\"&gt;\r\n  &lt;div data-key=\"74\" class=\"key\"&gt;\r\n    &lt;kbd&gt;J&lt;\/kbd&gt;\r\n    &lt;span class=\"sound\"&gt;snare&lt;\/span&gt;\r\n  &lt;\/div&gt;\r\n  &lt;div data-key=\"75\" class=\"key\"&gt;\r\n    &lt;kbd&gt;K&lt;\/kbd&gt;\r\n    &lt;span class=\"sound\"&gt;tom&lt;\/span&gt;\r\n  &lt;\/div&gt;\r\n  &lt;div data-key=\"76\" class=\"key\"&gt;\r\n    &lt;kbd&gt;L&lt;\/kbd&gt;\r\n    &lt;span class=\"sound\"&gt;tink&lt;\/span&gt;\r\n  &lt;\/div&gt;\r\n  \r\n&lt;\/div&gt;\r\n&lt;\/div&gt;\r\n    \r\n&lt;audio data-key=\"65\" src=\"https:\/\/timothyrobards.github.io\/files\/js30\/sounds\/clap.wav\"&gt;&lt;\/audio&gt;\r\n&lt;audio data-key=\"83\" src=\"https:\/\/timothyrobards.github.io\/files\/js30\/sounds\/hihat.wav\"&gt;&lt;\/audio&gt;\r\n&lt;audio data-key=\"68\" src=\"https:\/\/timothyrobards.github.io\/files\/js30\/sounds\/kick.wav\"&gt;&lt;\/audio&gt;\r\n&lt;audio data-key=\"70\" src=\"https:\/\/timothyrobards.github.io\/files\/js30\/sounds\/openhat.wav\"&gt;&lt;\/audio&gt;\r\n&lt;audio data-key=\"71\" src=\"https:\/\/timothyrobards.github.io\/files\/js30\/sounds\/boom.wav\"&gt;&lt;\/audio&gt;\r\n&lt;audio data-key=\"72\" src=\"https:\/\/timothyrobards.github.io\/files\/js30\/sounds\/ride.wav\"&gt;&lt;\/audio&gt;\r\n&lt;audio data-key=\"74\" src=\"https:\/\/timothyrobards.github.io\/files\/js30\/sounds\/snare.wav\"&gt;&lt;\/audio&gt;\r\n&lt;audio data-key=\"75\" src=\"https:\/\/timothyrobards.github.io\/files\/js30\/sounds\/tom.wav\"&gt;&lt;\/audio&gt;\r\n&lt;audio data-key=\"76\" src=\"https:\/\/timothyrobards.github.io\/files\/js30\/sounds\/tink.wav\"&gt;&lt;\/audio&gt;\r\n<\/pre>\n<p>2. Now,\u00a0copy the CSS code to style your drum kit. You can customize the appearance to match your website&#8217;s design.<\/p>\n<pre class=\"prettyprint linenums lang-css\">@import url('https:\/\/fonts.googleapis.com\/css?family=Roboto+Mono');\r\n\r\nhtml {\r\n  background-color: #aa7400 !important;\r\n  background-image: url(\"data:image\/svg+xml,%3Csvg xmlns='http:\/\/www.w3.org\/2000\/svg' width='400' height='400' viewBox='0 0 200 200'%3E%3Cg fill='none' stroke='%237F3' stroke-width='1' stroke-opacity='0.2'%3E%3Crect x='-40' y='40' width='75' height='75'\/%3E%3Crect x='-35' y='45' width='65' height='65'\/%3E%3Crect x='-30' y='50' width='55' height='55'\/%3E%3Crect x='-25' y='55' width='45' height='45'\/%3E%3Crect x='-20' y='60' width='35' height='35'\/%3E%3Crect x='-15' y='65' width='25' height='25'\/%3E%3Crect x='-10' y='70' width='15' height='15'\/%3E%3Crect x='-5' y='75' width='5' height='5'\/%3E%3Crect width='35' height='35'\/%3E%3Crect x='5' y='5' width='25' height='25'\/%3E%3Crect x='10' y='10' width='15' height='15'\/%3E%3Crect x='15' y='15' width='5' height='5'\/%3E%3Crect x='40' width='75' height='75'\/%3E%3Crect x='45' y='5' width='65' height='65'\/%3E%3Crect x='50' y='10' width='55' height='55'\/%3E%3Crect x='55' y='15' width='45' height='45'\/%3E%3Crect x='60' y='20' width='35' height='35'\/%3E%3Crect x='65' y='25' width='25' height='25'\/%3E%3Crect x='70' y='30' width='15' height='15'\/%3E%3Crect x='75' y='35' width='5' height='5'\/%3E%3Crect x='40' y='80' width='35' height='35'\/%3E%3Crect x='45' y='85' width='25' height='25'\/%3E%3Crect x='50' y='90' width='15' height='15'\/%3E%3Crect x='55' y='95' width='5' height='5'\/%3E%3Crect x='120' y='-40' width='75' height='75'\/%3E%3Crect x='125' y='-35' width='65' height='65'\/%3E%3Crect x='130' y='-30' width='55' height='55'\/%3E%3Crect x='135' y='-25' width='45' height='45'\/%3E%3Crect x='140' y='-20' width='35' height='35'\/%3E%3Crect x='145' y='-15' width='25' height='25'\/%3E%3Crect x='150' y='-10' width='15' height='15'\/%3E%3Crect x='155' y='-5' width='5' height='5'\/%3E%3Crect x='120' y='40' width='35' height='35'\/%3E%3Crect x='125' y='45' width='25' height='25'\/%3E%3Crect x='130' y='50' width='15' height='15'\/%3E%3Crect x='135' y='55' width='5' height='5'\/%3E%3Crect y='120' width='75' height='75'\/%3E%3Crect x='5' y='125' width='65' height='65'\/%3E%3Crect x='10' y='130' width='55' height='55'\/%3E%3Crect x='15' y='135' width='45' height='45'\/%3E%3Crect x='20' y='140' width='35' height='35'\/%3E%3Crect x='25' y='145' width='25' height='25'\/%3E%3Crect x='30' y='150' width='15' height='15'\/%3E%3Crect x='35' y='155' width='5' height='5'\/%3E%3Crect x='200' y='120' width='75' height='75'\/%3E%3Crect x='40' y='200' width='75' height='75'\/%3E%3Crect x='80' y='80' width='75' height='75'\/%3E%3Crect x='85' y='85' width='65' height='65'\/%3E%3Crect x='90' y='90' width='55' height='55'\/%3E%3Crect x='95' y='95' width='45' height='45'\/%3E%3Crect x='100' y='100' width='35' height='35'\/%3E%3Crect x='105' y='105' width='25' height='25'\/%3E%3Crect x='110' y='110' width='15' height='15'\/%3E%3Crect x='115' y='115' width='5' height='5'\/%3E%3Crect x='80' y='160' width='35' height='35'\/%3E%3Crect x='85' y='165' width='25' height='25'\/%3E%3Crect x='90' y='170' width='15' height='15'\/%3E%3Crect x='95' y='175' width='5' height='5'\/%3E%3Crect x='120' y='160' width='75' height='75'\/%3E%3Crect x='125' y='165' width='65' height='65'\/%3E%3Crect x='130' y='170' width='55' height='55'\/%3E%3Crect x='135' y='175' width='45' height='45'\/%3E%3Crect x='140' y='180' width='35' height='35'\/%3E%3Crect x='145' y='185' width='25' height='25'\/%3E%3Crect x='150' y='190' width='15' height='15'\/%3E%3Crect x='155' y='195' width='5' height='5'\/%3E%3Crect x='160' y='40' width='75' height='75'\/%3E%3Crect x='165' y='45' width='65' height='65'\/%3E%3Crect x='170' y='50' width='55' height='55'\/%3E%3Crect x='175' y='55' width='45' height='45'\/%3E%3Crect x='180' y='60' width='35' height='35'\/%3E%3Crect x='185' y='65' width='25' height='25'\/%3E%3Crect x='190' y='70' width='15' height='15'\/%3E%3Crect x='195' y='75' width='5' height='5'\/%3E%3Crect x='160' y='120' width='35' height='35'\/%3E%3Crect x='165' y='125' width='25' height='25'\/%3E%3Crect x='170' y='130' width='15' height='15'\/%3E%3Crect x='175' y='135' width='5' height='5'\/%3E%3Crect x='200' y='200' width='35' height='35'\/%3E%3Crect x='200' width='35' height='35'\/%3E%3Crect y='200' width='35' height='35'\/%3E%3C\/g%3E%3C\/svg%3E\") !important;\r\n  \/* background customized from SVGBackgrounds.com *\/\r\n  font-size: 10px;\r\n}\r\n\r\nhtml, body {\r\n  margin: 0;\r\n  padding: 0;\r\n  height: 100%;\r\n  font-family: 'Roboto Mono', monospace;\r\n  font-weight: 400;\r\n}\r\n\r\n.center {\r\n  position: relative;\r\n  top: 50%;\r\n  transform: translateY(-50%);\r\n}\r\n\r\n.keys {\r\n  display: flex;\r\n  justify-content: center;\r\n  align-content: center;\r\n}\r\n\r\n.key {\r\n  border: .2rem solid #000;\r\n  border-radius: 6rem;\r\n  margin: 1rem;\r\n  font-size: 1.5rem;\r\n  padding: 1rem .5rem;\r\n  transition: all .07s ease;\r\n  width: 10rem;\r\n  text-align: center;\r\n  color: #fff;\r\n  background: #000;\r\n}\r\n\r\n.playing {\r\n  transform: scale(1.1);\r\n  border-color: #FFA500;\r\n  box-shadow: 0 0 5rem #fff;\r\n}\r\n\r\n.playing .sound {\r\n  color: #FFA500;\r\n}\r\n\r\nkbd {\r\n  display: block;\r\n  font-size: 5rem;\r\n  font-family: 'Roboto Mono', monospace;\r\n  font-weight: 200;\r\n  color: #fff;\r\n}\r\n\r\n.sound {\r\n  font-size: 1.2rem;\r\n  letter-spacing: .1rem;\r\n  color: #FFA500;\r\n}<\/pre>\n<p>3. Finally, incorporate the JavaScript code into your HTML document. This code handles key presses and plays the associated drum sound when a key is pressed. It also adds a visual effect to the pressed key.<\/p>\n<pre class=\"prettyprint linenums lang-js\">function removeTransition(e) {\r\n    if (e.propertyName !== 'transform') return;\r\n    e.target.classList.remove('playing');\r\n  }\r\n  function playSound(e) {\r\n    const audio = document.querySelector(`audio[data-key=\"${e.keyCode}\"]`);\r\n    const key = document.querySelector(`div[data-key=\"${e.keyCode}\"]`);\r\n    if (!audio) return;\r\n    key.classList.add('playing');\r\n    audio.currentTime = 0;\r\n    audio.play();\r\n  }\r\n  const keys = Array.from(document.querySelectorAll('.key'));\r\n  keys.forEach(key =&gt; key.addEventListener('transitionend', removeTransition));\r\n  window.addEventListener('keydown', playSound);<\/pre>\n<p>Feel free to customize the drum kit further. You can add more sounds, change the styling, or enhance the user experience according to your preferences.<\/p>\n<p>That&#8217;s all! hopefully, you have successfully created a Drum Kit Using JavaScript. If you have any questions or suggestions, feel free to comment below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This JavaScript code creates a virtual drum kit that you can play by pressing keys on your keyboard. When a&#8230;<\/p>\n","protected":false},"author":1,"featured_media":9533,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[116],"tags":[],"class_list":["post-9519","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vanilla-javascript"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Drum Kit Using JavaScript &#8212; CodeHim<\/title>\n<meta name=\"description\" content=\"Here is a free code snippet to create a Drum Kit Using JavaScript. You can view demo and download the source code.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/codehim.com\/vanilla-javascript\/drum-kit-using-javascript\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Drum Kit Using JavaScript &#8212; CodeHim\" \/>\n<meta property=\"og:description\" content=\"Here is a free code snippet to create a Drum Kit Using JavaScript. You can view demo and download the source code.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/codehim.com\/vanilla-javascript\/drum-kit-using-javascript\/\" \/>\n<meta property=\"og:site_name\" content=\"CodeHim\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/codehimofficial\" \/>\n<meta property=\"article:published_time\" content=\"2024-01-09T18:03:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-22T11:05:07+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/Drum-Kit-Using-JavaScript.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"960\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Asif Mughal\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@CodeHimOfficial\" \/>\n<meta name=\"twitter:site\" content=\"@CodeHimOfficial\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Asif Mughal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/drum-kit-using-javascript\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/drum-kit-using-javascript\/\"},\"author\":{\"name\":\"Asif Mughal\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed\"},\"headline\":\"Drum Kit Using JavaScript\",\"datePublished\":\"2024-01-09T18:03:00+00:00\",\"dateModified\":\"2024-01-22T11:05:07+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/drum-kit-using-javascript\/\"},\"wordCount\":207,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/codehim.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/drum-kit-using-javascript\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/Drum-Kit-Using-JavaScript.png\",\"articleSection\":[\"Vanilla JavaScript\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/codehim.com\/vanilla-javascript\/drum-kit-using-javascript\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/drum-kit-using-javascript\/\",\"url\":\"https:\/\/codehim.com\/vanilla-javascript\/drum-kit-using-javascript\/\",\"name\":\"Drum Kit Using JavaScript &#8212; CodeHim\",\"isPartOf\":{\"@id\":\"https:\/\/codehim.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/drum-kit-using-javascript\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/drum-kit-using-javascript\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/Drum-Kit-Using-JavaScript.png\",\"datePublished\":\"2024-01-09T18:03:00+00:00\",\"dateModified\":\"2024-01-22T11:05:07+00:00\",\"description\":\"Here is a free code snippet to create a Drum Kit Using JavaScript. You can view demo and download the source code.\",\"breadcrumb\":{\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/drum-kit-using-javascript\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/codehim.com\/vanilla-javascript\/drum-kit-using-javascript\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/drum-kit-using-javascript\/#primaryimage\",\"url\":\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/Drum-Kit-Using-JavaScript.png\",\"contentUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/Drum-Kit-Using-JavaScript.png\",\"width\":1280,\"height\":960,\"caption\":\"Drum Kit Using JavaScript\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/drum-kit-using-javascript\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/codehim.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Vanilla JavaScript\",\"item\":\"https:\/\/codehim.com\/category\/vanilla-javascript\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Drum Kit Using JavaScript\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/codehim.com\/#website\",\"url\":\"https:\/\/codehim.com\/\",\"name\":\"CodeHim\",\"description\":\"Web Design Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/codehim.com\/#organization\"},\"alternateName\":\"Web Design Codes\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/codehim.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/codehim.com\/#organization\",\"name\":\"CodeHim - Web Design Code & Scripts\",\"url\":\"https:\/\/codehim.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/logo\/image\/\",\"url\":\"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg\",\"contentUrl\":\"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg\",\"width\":280,\"height\":280,\"caption\":\"CodeHim - Web Design Code & Scripts\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/codehimofficial\",\"https:\/\/x.com\/CodeHimOfficial\",\"https:\/\/www.instagram.com\/codehim\/\",\"https:\/\/www.linkedin.com\/company\/codehim\",\"https:\/\/co.pinterest.com\/codehim\/\",\"https:\/\/www.youtube.com\/@codehim\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed\",\"name\":\"Asif Mughal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g\",\"caption\":\"Asif Mughal\"},\"description\":\"I code and create web elements for amazing people around the world. I like work with new people. New people new Experiences. I truly enjoy what I'm doing, which makes me more passionate about web development and coding. I am always ready to do challenging tasks whether it is about creating a custom CMS from scratch or customizing an existing system.\",\"sameAs\":[\"https:\/\/codehim.com\"],\"url\":\"https:\/\/codehim.com\/author\/asif-mughal\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Drum Kit Using JavaScript &#8212; CodeHim","description":"Here is a free code snippet to create a Drum Kit Using JavaScript. You can view demo and download the source code.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/codehim.com\/vanilla-javascript\/drum-kit-using-javascript\/","og_locale":"en_US","og_type":"article","og_title":"Drum Kit Using JavaScript &#8212; CodeHim","og_description":"Here is a free code snippet to create a Drum Kit Using JavaScript. You can view demo and download the source code.","og_url":"https:\/\/codehim.com\/vanilla-javascript\/drum-kit-using-javascript\/","og_site_name":"CodeHim","article_publisher":"https:\/\/www.facebook.com\/codehimofficial","article_published_time":"2024-01-09T18:03:00+00:00","article_modified_time":"2024-01-22T11:05:07+00:00","og_image":[{"width":1280,"height":960,"url":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/Drum-Kit-Using-JavaScript.png","type":"image\/png"}],"author":"Asif Mughal","twitter_card":"summary_large_image","twitter_creator":"@CodeHimOfficial","twitter_site":"@CodeHimOfficial","twitter_misc":{"Written by":"Asif Mughal","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/codehim.com\/vanilla-javascript\/drum-kit-using-javascript\/#article","isPartOf":{"@id":"https:\/\/codehim.com\/vanilla-javascript\/drum-kit-using-javascript\/"},"author":{"name":"Asif Mughal","@id":"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed"},"headline":"Drum Kit Using JavaScript","datePublished":"2024-01-09T18:03:00+00:00","dateModified":"2024-01-22T11:05:07+00:00","mainEntityOfPage":{"@id":"https:\/\/codehim.com\/vanilla-javascript\/drum-kit-using-javascript\/"},"wordCount":207,"commentCount":0,"publisher":{"@id":"https:\/\/codehim.com\/#organization"},"image":{"@id":"https:\/\/codehim.com\/vanilla-javascript\/drum-kit-using-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/Drum-Kit-Using-JavaScript.png","articleSection":["Vanilla JavaScript"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/codehim.com\/vanilla-javascript\/drum-kit-using-javascript\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/codehim.com\/vanilla-javascript\/drum-kit-using-javascript\/","url":"https:\/\/codehim.com\/vanilla-javascript\/drum-kit-using-javascript\/","name":"Drum Kit Using JavaScript &#8212; CodeHim","isPartOf":{"@id":"https:\/\/codehim.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/codehim.com\/vanilla-javascript\/drum-kit-using-javascript\/#primaryimage"},"image":{"@id":"https:\/\/codehim.com\/vanilla-javascript\/drum-kit-using-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/Drum-Kit-Using-JavaScript.png","datePublished":"2024-01-09T18:03:00+00:00","dateModified":"2024-01-22T11:05:07+00:00","description":"Here is a free code snippet to create a Drum Kit Using JavaScript. You can view demo and download the source code.","breadcrumb":{"@id":"https:\/\/codehim.com\/vanilla-javascript\/drum-kit-using-javascript\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/codehim.com\/vanilla-javascript\/drum-kit-using-javascript\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codehim.com\/vanilla-javascript\/drum-kit-using-javascript\/#primaryimage","url":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/Drum-Kit-Using-JavaScript.png","contentUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/Drum-Kit-Using-JavaScript.png","width":1280,"height":960,"caption":"Drum Kit Using JavaScript"},{"@type":"BreadcrumbList","@id":"https:\/\/codehim.com\/vanilla-javascript\/drum-kit-using-javascript\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/codehim.com\/"},{"@type":"ListItem","position":2,"name":"Vanilla JavaScript","item":"https:\/\/codehim.com\/category\/vanilla-javascript\/"},{"@type":"ListItem","position":3,"name":"Drum Kit Using JavaScript"}]},{"@type":"WebSite","@id":"https:\/\/codehim.com\/#website","url":"https:\/\/codehim.com\/","name":"CodeHim","description":"Web Design Code Snippets","publisher":{"@id":"https:\/\/codehim.com\/#organization"},"alternateName":"Web Design Codes","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/codehim.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/codehim.com\/#organization","name":"CodeHim - Web Design Code & Scripts","url":"https:\/\/codehim.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codehim.com\/#\/schema\/logo\/image\/","url":"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg","contentUrl":"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg","width":280,"height":280,"caption":"CodeHim - Web Design Code & Scripts"},"image":{"@id":"https:\/\/codehim.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/codehimofficial","https:\/\/x.com\/CodeHimOfficial","https:\/\/www.instagram.com\/codehim\/","https:\/\/www.linkedin.com\/company\/codehim","https:\/\/co.pinterest.com\/codehim\/","https:\/\/www.youtube.com\/@codehim"]},{"@type":"Person","@id":"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed","name":"Asif Mughal","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codehim.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g","caption":"Asif Mughal"},"description":"I code and create web elements for amazing people around the world. I like work with new people. New people new Experiences. I truly enjoy what I'm doing, which makes me more passionate about web development and coding. I am always ready to do challenging tasks whether it is about creating a custom CMS from scratch or customizing an existing system.","sameAs":["https:\/\/codehim.com"],"url":"https:\/\/codehim.com\/author\/asif-mughal\/"}]}},"views":972,"_links":{"self":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts\/9519","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/comments?post=9519"}],"version-history":[{"count":0,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts\/9519\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/media\/9533"}],"wp:attachment":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/media?parent=9519"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/categories?post=9519"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/tags?post=9519"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}