2023

Code Project – JavaScript Drum Kit

The second actual project from the class I’ve been doing is a simple clickable drum kit. Part of the purpose was to work with signs and to work with clickable elements. Like the dice roller game, the basic HTML and images were provided, though there was some freedom in arranging the icons and sounds.

It feel a bit flaky, when it comes to overlapping sounds, but that also feels like a bit of a limitation with the code itself, or at least, the simplicity of what is being done here. I’m sure it’s “fixable” with some more advanced work. But for now it’s pretty neat. Works with clicks and keyboard presses.

It can be played by going here, and the full repository can be found here.

var w = new Audio('sounds/snare.mp3');
var a = new Audio('sounds/tom-1.mp3');
var s = new Audio('sounds/tom-3.mp3');
var d = new Audio('sounds/kick-bass.mp3');
var j = new Audio('sounds/tom-4.mp3');
var k = new Audio('sounds/tom-2.mp3');
var l = new Audio('sounds/crash.mp3');

for(var i=0 ; i < document.querySelectorAll(".drum").length; i++) {
    document.querySelectorAll(".drum")[i].addEventListener("click", function(event) {
    clickHandler(event.target.innerHTML)});
}

document.addEventListener("keydown", function(event) {
    clickHandler(event.key);
});

function clickHandler(which_sound) {
//    console.log(which_sound)
//    alert("Clicked!"); 
    flashButton(which_sound);

    switch (which_sound){
    case "w":
        w.play();
        break;
    case "a":
        a.play();
        break;
    case "s":
        s.play();
        break;
    case "d":
        d.play();
        break;
    case "j":
        k.play();
        break;
    case "k":
        k.play();
        break;
    case "l":
        l.play();
        break;
    default:
        console.log(which_sound)
        break;
    }
}

function flashButton (whichFlash) {
    var activeButton = document.querySelector("."+whichFlash);
    activeButton.classList.add("pressed");
    setTimeout(function(){ activeButton.classList.remove("pressed"); },0.3);
}

The large bulk of the code here is handling the sound. I feel like there could almost be a more elegant way of handling this process with a list, but I’m not positive since it would mean taking the text of a list element and using it as the name of a variable. The top chunk of definitions manages creating the sound elements themselves, and the switch statement in the middle plays one based on what the user did.

This function:

function flashButton (whichFlash) {
    var activeButton = document.querySelector("."+whichFlash);
    activeButton.classList.add("pressed");
    setTimeout(function(){ activeButton.classList.remove("pressed"); },0.3);
}

Makes the flash happen. Like I did for the Python class, I tried to construct most of these on my own, so had to do a bit of research to find a way to make the button add the “pressed” class, to get the bright effect, then shortly after, remove it. This seemed to be the appropriate method based on a couple of sources.

The real “meat” of this lesson was this bit of code.

for(var i=0 ; i < document.querySelectorAll(".drum").length; i++) {
    document.querySelectorAll(".drum")[i].addEventListener("click", function(event) {
    clickHandler(event.target.innerHTML)});
}

document.addEventListener("keydown", function(event) {
    clickHandler(event.key);
});

Specifically, using the event listener function, to call an embedded function in order to pass data around. Its similar in concept to some things I’d done in Python, and I am sure it’s nothing super fancy in technique, but its “new to me” in the Javascript sense. Also, I think the instructor handled this a different way, but I’ve set these two event listeners, one for the buttons for clicks, and one for the page for key presses, in a way that made the clickHandler a lot simpler, since they both work off of the same bit of data.

Wednesday 2023-03-08 – Link List

Blogging Intensifies Link List for Wednesday 2023-03-08

08-Mar-2023 – Free and open source 6DOF flight racer Fly Dangerous has a huge second update

Brief Summary: “It’s fast, it gives you six degrees of freedom (6DOF) and it’s open source too! Fly Dangerous just had it’s second big upgrade since entering Early Ac”

08-Mar-2023 – LEGO Jurassic Park 30th Anniversary Sets Revealed

Brief Summary: ”
LEGO will be celebrating the 30th anniversary of Jurassic Park with five new sets coming this summer. The sets will feature various scenes from the f”

08-Mar-2023 – Coffee House

Brief Summary: ”
Toy Name (Short)

  Coffee House

Toy Number

  21102

Toy Review Summary

  Coffee House

Original Price

08-Mar-2023 – International Women’s Day: Here Are 10 More Female-Fronted Bands and Artists That Should Be on Your Radar

Brief Summary: ”
If there’s one thing I love doing, it’s gathering a list of underrated female-fronted bands and artists for your listening pleasure. Music is my life”

08-Mar-2023 – Godot Engine – Resources

Brief Summary: ”
This blog post is to provide resources and links related to the open source Godot game Engine.
https://godotengine.org/
https://docs.godotengine.org/”

08-Mar-2023 – [Humble Bundle] Humble Heroines – Control: Ultimate Edition, Syberia: The World Before, Praey for the Gods, Hellblade: Senua’s Sacrifice, Baltora, Sable, Dreamscaper and Call of the Sea (€14.12)

Brief Summary: ” submitted by /u/forgotaboutlaye [link] [comments] “

08-Mar-2023 – A Layman’s Guide to Sky: Children of the Light – Intro

Brief Summary: “The Entire series can be found on this page.

I’ve been playing this game Sky: Children of the Light for a while, and like many games I play regular”

07-Mar-2023 – Meet anime’s newest isekai hero: a sentient vending machine in a fantasy world【Video】

Brief Summary: ”
Light novel series Reborn as a Vending Machine, I Now Wander the Dungeon makes the jump to anime.

In some ways, the setup for upcoming anime TV seri”

07-Mar-2023 – Live-action Totoro stage play nominated for nine of the U.K.’s highest theatrical honors

Brief Summary: ”
Adaptation of Studio Ghibli anime earns more Olivier Award nominations than any other production this year.

It was a bit of a shock last year when t”

08-Mar-2023 – PVRIS has dropped a video for ‘Goddess’

Brief Summary: “PVRIS has released a video for ‘Goddess’.

The track was released earlier this year to coincide with a bunch of UK and European dates, with Lynn Gun”

08-Mar-2023 – How can computing education promote an equitable digital future? Ideas from research

Brief Summary: “This year’s International Women’s Day (IWD) focuses on innovation and technology for gender equality. This cause aligns closely with our mission as a “

07-Mar-2023 – Elon Musk backpedals after mocking disabled Twitter worker in tweet ‘storm’

Brief Summary: “Haraldur Thorleifsson was locked out of his computer, but after nine days of no answer from the company, decided to tweet the CEOIf you’re not told yo”

07-Mar-2023 – ChatGPT’s alter ego, Dan: users jailbreak AI program to get around ethical safeguards

Brief Summary: “Certain prompts make the chatbot take on an uncensored persona who is free of the usual content standardsPeople are figuring out ways to bypass ChatGP”

07-Mar-2023 – Internet Archive gets DMCA exemption to help archive vintage software (2003)

Brief Summary: “Comments”

08-Mar-2023 – Pulling Data From HDMI RF leakage

Brief Summary: “A long-running story in the world of electronic security has been the reconstruction of on-screen data using RF interference from monitors or televisi”

Tuesday 2023-03-07 – Link List

Blogging Intensifies Link List for Tuesday 2023-03-07

07-Mar-2023 – Poster Art and Lobby Cards for ATTACK OF THE 50 FT WOMAN (1958)

Brief Summary: “”

07-Mar-2023 – Google plans to retire overlay ads on YouTube videos starting on April 6 to “improve the viewer experience and shift engagement to higher performing ad formats” (Damien Wilde/9to5Google)

Brief Summary: ”
Damien Wilde / 9to5Google:Google plans to retire overlay ads on YouTube videos starting on April 6 to “improve the viewer experience and shift engag”

07-Mar-2023 – Playdate is bumping its price to $199 in April

Brief Summary: “Photo by Vjeran Pavic / The VergePlaydate is announcing a suite of new games and a pricing update. The $179 USD handheld is going up by $20, effective”

07-Mar-2023 – Playdate’s new store launches today — here are some great games to check out

Brief Summary: “Photo by Vjeran Pavic / The VergeAs part of a showcase event, Panic announced that Catalog, a game store for its Playdate handheld, would be launching”

07-Mar-2023 – Niantic’s adorable pet game Peridot launches in May

Brief Summary: “Image: NianticNiantic, the studio behind Pokémon Go, is releasing its next big game very soon. The developer announced that the virtual pet game Perid”

07-Mar-2023 – LEGO Confirms LEGO Super Mario MAR10 Reveal Not 18+ Set

Brief Summary: ”
The LEGO Super Mario MAR10 Day celebration will be happening in a few days which includes some sort of reveal. Nobody knows what it is but LEGO on th”

07-Mar-2023 – Is hydrogen really a clean enough fuel to tackle the climate crisis?

Brief Summary: “Backers say hydrogen projects should be first in line for almost $26bn in US taxpayer money – but should we believe the hype?Hydrogen is the smallest,”

07-Mar-2023 – Elon Musk mocks disabled Twitter employee trying to find out if he’s been fired

Brief Summary: “The CEO also chatted openly about Halli Thorleifsson’s disability status, which is confidential information under the Americans with Disabilities Act.”

07-Mar-2023 – Covid booster jab to be offered this spring

Brief Summary: “Everyone over 75 is being advised to take up the extra vaccine to protect them over the summer.”

07-Mar-2023 – Can I use my rice cooker for anything else? | Kitchen aide

Brief Summary: “Grains, pasta, fish, eggs and even fondue are just some of the things that be prepared in a rice cooker, says our panel of cooks• Got a culinary dilem”

07-Mar-2023 – DAREDEVIL: BORN AGAIN: Jon Bernthal to Return as Punisher

Brief Summary: “According to The Hollywood Reporter,  Jon Bernthal will reprise his role as Frank Castle, aka The Punisher, for the Marvel Cinematic Universe series D”

07-Mar-2023 – A Minecraft world editor could be coming to Bedrock, leaked footage suggests

Brief Summary: “Building things in Minecraft takes a long time. Even in the vastly quicker Creative mode, you’re limited to constructing your grand designs block-by-b”

07-Mar-2023 – Explore the Solar System’s edges in management sim Mars Horizon 2: The Search For Life

Brief Summary: ”
2020’s Mars Horizon was a space flight management game where you were in charge of constructing bases, building rockets, and leading missions into th”

07-Mar-2023 – Fortnite Chapter 4 Season 2 release date confirmed, first look at upcoming battle pass skin

Brief Summary: ”
After rumour upon rumour upon leak, Fortnite has finally confirmed Chapter 4 Season 2 will kick off this Friday, 10th March.

In a brief tweet, the “

07-Mar-2023 – [Steam] Blockstorm (Free / 100% off)

Brief Summary: ” submitted by /u/axemexa [link] [comments] “

07-Mar-2023 – Jon Bernthal Returns As The Punisher For Disney+ Daredevil Series

Brief Summary: “”

06-Mar-2023 – LL announce fee changes for Second Life land and Lindex

Brief Summary: “On Monday, March 6th, Linden Lab announced a series of fee changes / payment changes to Second Life which have sparked some debate. The announcement l”

07-Mar-2023 – Rovio may reverse its decision to remove Angry Birds from Google Play store

Brief Summary: ”
Rovio could reverse its decision to de-list Angry Birds from the Google Play store.

At the end of February, the mobile publisher removed the origina”

25-Feb-2023 – New AI game: role playing the Titanic

Brief Summary: “New AI game: role playing the Titanic
Fantastic Bing prompt from Ethan Mollick: “I am on a really nice White Star cruise from Southampton, and it is 1”

01-Mar-2022 – SNESMOD

Brief Summary: “Another option for SNES audio is SNESMOD. It doesn’t have its own tracker, but you would use OpenMPT in the IT format, and save the file as an IT file”

03-Feb-2022 – Sega Genesis FM Instrument Basics

Brief Summary: “This is a bit off subject for my other topics, but I find this stuff fascinating. The Sega Genesis / Mega Drive has a very interesting FM synth chip, “

07-Jan-2021 – NESIFIER

Brief Summary: “Hey, I made an app this week. It can convert an image into a 4 color NES palette image. It can also save as CHR and do different levels of dithering. “

Monday 2023-03-06 – Link List

Blogging Intensifies Link List for Monday 2023-03-06

06-Mar-2023 – Teenage Mutant Ninja Turtles: Mutant Mayhem’s first trailer has the heat

Brief Summary: “Paramount Pictures’ Teenage Mutant Ninja Turtles: Mutant Mayhem from director Jeff Rowe isn’t the only upcoming feature about heroic pizza-eating rept”

06-Mar-2023 – Get a free copy of Figment, plus lots of other deals going on right now

Brief Summary: “In the mood for a free game? How about a whole bunch of cheap games on sale? Come and have a look at what’s going on.”

06-Mar-2023 – Some Twitter services such as loading images and TweetDeck were down; clicking a link in a tweet gave the error “your current API plan does not include access” (Kris Holt/Engadget)

Brief Summary: ”
Kris Holt / Engadget:Some Twitter services such as loading images and TweetDeck were down; clicking a link in a tweet gave the error “your current A”

06-Mar-2023 – Cavetown has signed up dodie, Alfie Templeman and more for a huge Ally Pally show

Brief Summary: “Cavetown has announced a huge Ally Pally show.

Taking place on 24th September, he’s signed up dodie, Alfie Templeman, Tessa Violet and Cafuné to su”

06-Mar-2023 – Kerbal Space Program 2 player count has already dropped below first game

Brief Summary: ”
Kerbal Space Program 2 has had a rocky launch.

On the space-flight simulator’s release in Early Access, many found the game unplayable due to a col”

06-Mar-2023 – [GOG] Figment (Free / 100% off)

Brief Summary: ” submitted by /u/skud79 [link] [comments] “

06-Mar-2023 – Spider-Man: Across the Spider-Verse image sees Spider-Man 2099 charging into battle

Brief Summary: “Sony has released a new image from the highly anticipated Spider-Man: Across the Spider-Verse that showcases the film’s antagonist Miguel O’Hara/Spide”

Sunday 2023-03-05 – Link List

Blogging Intensifies Link List for Sunday 2023-03-05

05-Mar-2023 – Message to foreigners at Japanese convenience store sparks controversy online

Brief Summary: ”
Attempt to curtail customer rudeness comes off as incredibly rude.

Japanese convenience stores are known for being wonderful havens, where you can g”

05-Mar-2023 – No Wheels, No Mercy

Brief Summary: “We always like when a designer does something different. After all, it is easy just to do what everyone else is doing. But to see things a different w”