The Maths Behind A Chord Recognition Engine

A key part of any tertiary musical education is learning about all the wonderful (and less wonderful) types of chords out there. Typically this involves a great deal of exercises involving the identification of a given chord from its component notes. But how would you do this programmatically? Well, thankfully, the developers behind the WhatChord tool are happy to explain just how it’s done.

The problem with classifying chords is that the way musicians use them and construct them can be quite varied. Names can also be applied somewhat differently depending on the musical context of a given set of notes. To suit the musical reality of real players and composers, WhatChord uses a specially-developed scoring algorithm to try and nut out what a chord is actually supposed to be.

As an example, a major chord must require a root note and a major third interval. It can optionally include a perfect fifth. However, if there is a minor third, minor seventh, or major seventh present, then you’re almost certainly not looking at a simple major chord. WhatChord takes these things into account by weighting the different tones present and seeing which chord gets the highest score. The required notes add weight, while notes that shouldn’t be there add a penalty to the score. Then there are extra penalties for ambiguous “unexplained” tones, extensions, and a few other parameters to disambiguate edge cases.

If you’d like to see how it works in practice, you can check out the WhatChord app and see how good it is for yourself. Alternatively, explore some of the other chord-focused projects we’ve featured over the years, or send your best musical projects into the tipsline.

[Thanks to baschwar for the tip!]

The Rapper, The Canadian Academics, And The Secret Behind The Earworm

There are many events so far in 2026 that could reasonably have been predicted, but perhaps one which couldn’t is a Hackaday scribe in Europe unexpectedly finding herself with a constant earworm from Afroman. The rapper, who most of us know only from his year 2000 hit single about getting high, made the news after an inept police raid on his house, and in turn a court case over his musical denunciations of the authorities.

It’s fair to say they picked on the wrong guy, but in thinking about why, the answer is in the earworm. He has the unique skill of making a song irritatingly catchy, which led us to the question of how a catchy song works. As luck would have it a team from the University of Waterloo have recently released a paper in which they explain  it all in terms of maths, giving the rest of us a formula where the likes of Afroman are presumably born with it.

We won’t pretend that Hackaday’s mathematical expertise stretches beyond that needed for engineering, but for the more advanced numberphiles among us the university’s write-up goes into some detail about their use of group theory to study the patterns and symmetry in a given piece of music. It’s a new approach that joins other more famous guides to musical success, so perhaps if you couple it with the stuff your music teacher failed to tell you in school, you could be on your way to the top of the charts. Meanwhile here at Hackaday we’ll stick to more conventional inspiration.


Header: Chris Gilmore, CC BY-SA 2.0.

Analog Siren For Psychedelic Soundscapes

For better or worse, there are a few instruments that have been pigeonholed into specific genres of popular music. For example, banjos are often heard in bluegrass or folk, harmonicas in blues, and a sick horn section will take many of us immediately to third wave ska. Similarly, there are certain styles of synthesizers tied to various genres and if you’re a fan a certain sub-genre of reggae you’ll be familiar with the dub siren. This unique analog synth has a few tricks up its sleeve and [Jakub] shows us how he built his.

He’s calling this build the Sirenotron, and its based on the venerable 555 timer It also features an LFO built on an LM358, with triangle and square wave modes, plus an additional “acid mode” for the square wave which adds a single capacitor to the circuit but makes a big difference in the sound. Like any siren synth, there are potentiometers to control pitch and the pulse rate of the siren as well and another switch controls whether it is outputting sound or not. He’s also included the ability to control it with a foot pedal so he can use it while playing the bass guitar during live shows.

[Jakub] has gone through several prototypes before getting to this stage, and not only uses it when playing dub but also creates psychedelic soundscapes in a side project of his where it also fits right in. He’s also made the schematics available for anyone who wants to reproduce it or build on his design.

We’re always interested in a unique synthesizer build around here, and some of our favorites include this synth built from Sega Genesis parts and this one controlled more like a woodwind instrument.

Continue reading “Analog Siren For Psychedelic Soundscapes”

Simple MIDI Sample Player Runs On ESP32

[Jakub] is a musician, and found himself in need of a simple way to trigger samples via MIDI when on stage. So many commercial solutions exist, but most were overkill for the job or too messy and complicated to justify their use in a live environment. Thus, [Jakub] worked up Samplotron to do exactly the job needed with a minimum of fuss.

The project is based around the ESP32. It’s effectively a lightweight hardware sampler that can trigger sounds on command via MIDI. Sample data is loaded from an SD card, which also stores the device configuration. The Samplotron plays back mono 16-bit WAV files at 44,100 Hz, delivering audio via an ES8388 audio codec module connected via I2S. Two encoders are used to control the device, with a menu system presented via an SSD1309 OLED screen. Samples can be loaded and managed via this interface, and it allows tweaks to be made to volume levels and one-shot/loop playback as needed. MIDI input to the device is simply handled via the onboard UART functionality of the ESP32 itself.

It’s a neat little bit of music hardware that does exactly what [Jakub] needs and nothing more. We’ve featured similar builds before, like this neat RP2040 soundboard. If you’re building rad custom hardware for your own musical adventures, we’d love to know all about it. 

Inside A Dutch Street Organ: The Art Of Mechanical Music-Making

[James]’ Mechanical Organ of Dutch origin has been around longer than he has, but thanks to being rebuilt over the years and lovingly cared for, it delivers its unique performances just as well as it did back in the day. Even better, we’re treated to a good look at how it works.

The organ produces music by playing notes on embedded instruments, which are themselves operated by air pressure, with note arrangements read off what amounts to a very long punch card. [James] gives a great tour of this fantastic machine, so check it out in the video embedded below along with a couple of its performances.

Continue reading “Inside A Dutch Street Organ: The Art Of Mechanical Music-Making”

Playing YouTube From The Command Line

Generally, one opens a web browser or an app to use YouTube. However, if you’re looking to just listen to the audio, you can actually do that right from the terminal. You just need Shellbeats from [lalo-space].

Shellbeats is primarily intended for playing music from YouTube, and is well equipped for this task. It allows searching YouTube directly from the terminal, as well as streaming tracks or entire playlists from the command line interface. You can also make and edit playlists from within the tool, and even download the whole lot as MP3s if so desired. It’s all keyboard-operated and nicely lightweight. The overall experience isn’t dissimilar from operating a simple LCD-based MP3 player from 20 years ago.

There’s plenty of other fun stuff you can do in the terminal, too, as we’ve explored previously. If you’re working on your own media player hacks, be sure to notify us on the tipsline!

Companion MIDI Pedal Helps Roland Groovebox Along

The Roland SP-404 Mk2 is a popular groovebox that can deliver a great beat if you know how to use it. If you’re seeking greater control than is available out of the box, though, you might like to try a custom pedal built by [Romain Dereu].

The concept is simple enough—[Romain] whipped up a bespoke MIDI device to specifically control various features of the SP-404. It’s based on an Arduino Nano, though it could also be built with an Arduino Uno if so desired. The microcontroller sends the requisite MIDI messages out via its serial UART. The microcontroller is built into a pedal-style enclosure with a big toggle switch and a foot switch. This enables the triggering of various pads on the SP-404, with modes selected via the toggle.

It’s a simple build that opens up new possibilities when playing with the SP-404. If you’ve ever wanted a custom device to spit out some specific MIDI commands to control the synths or drum machines in your performance rig, this project is a great example of how easy this is to achieve. Meanwhile, if you’re whipping your own custom MIDI gear at home, we always love to see it land on our tipsline!