Live data from Hacker News

Show HN: Get the guitar chords from your Spotify playlists

spotifychords.luca.gg

61–70 of 83 posts

Re: Show HN: Get the guitar chords from your Spotify playlists

#61
post #22

Earlier quoted context omitted.

The trouble with analysing "notes" in a composition (or even just with a polyphonic instrument) is the pesky harmonics. The timbre of different instruments produce harmonics that happen to be the fundamental frequencies of other notes.

Would it be possible to eke out the harmonics by saying (for 'x' type of guitar tuned in 'y' way with 'z' effect, harmonics look like this). Like if the fundamental frequency is f, then the whole note looks like 0db at f and -5db at 2 f and -10db at 3 f or something. Then, when you're looking at the frequency domain, you start from the lower notes and say "hmm, looks like there's a fundamental at f, are the expected…

It is absolutely possible (and effective, depending on what you consider to be an adequate ROI) to apply this sort of heuristic to this domain.

The "holy grail" of a universal AMT that works with any number of instruments of any type played concurrently isn't exactly an intractable problem to begin with, but if you constrain the problem in various ways (to specific instruments, to known tunings, etc.) you can definitely take advantage of a priori knowledge about the "timbre" of the instrument and the way in which the sound wave evolves over the duration of the note/notes to work-around what would otherwise be more ambiguous data. The octave/harmonics problem is one example of the kind of problem that is much easier to eliminate (relative to the abstract case) if you can make assumptions about the type of instrument that is generating the sound.

The overtones generated by the vibrations of a guitar string (for example) follow a fairly specific and distinctive pattern. If you dig a little bit into the physics/mechanics by which a given instrument generates sound there is a lot of tell-tale information to take advantage of.

Re: Show HN: Get the guitar chords from your Spotify playlists

#64
post #57

Earlier quoted context omitted.

Heres one https://jguitar.com/chordname

Amazing! Search for finger pattern = {5 4 3 4 1 1}: 16 results found. A+add9add#9 A Augmented Add 9th Add Sharp 9th C#+7add7/A C#/A Augmented 7th Add Major 7th F5addb5addb11addb13/A F/A 5th Add Flat 5th Add Flat 11th Add Flat 13th ...

I can't quite figure out if your response is meant to be sarcastic or not - i.e., if you're "amazed" at the completeness here or maybe mocking the specialized/exotic chords it came up with in this case.

I apologize if this is obvious or well known to you, but for anyone not already familiar with it recognize that much like (and not wholly independent of) musical scales, chords are essentially defined by a predictable "formula".

E.g., every major chord is described by interval pattern 0-4-7: starting at any note, take the root, major-third (4 semi-tones above the root) and perfect-fifth (7 semi-tones above the root) and you have the major chord. For the root note C that yields C-E-G.

Rotate that pattern so that the root note is pitched above the major-third and perfect-fifth (e.g. something like 4-7-12) and you have an "inversion" of the major chord. For the root note C that's E-G-C (known as "C/E") or G-C-E (known as C/G).

Based on these interval patterns it's not hard to generate an exhaustive list of chord "families" (with members like "Major" or "Dom13Aug5" or whatever) - there are at most 4096 (=2**12) of these interval patterns in a single octave, and many of those are relatively uninteresting due to symmetry, degenerate cases or just plain dissonance. (To be fair many common chords span more than one octave.)

A given collection of notes (fret/string combos on a 6-string guitar for example) is usually going to map to some variation of one of those interval patterns, possibly with a stray interval added, dropped or repeated. (E.g., the typical X32010 fingering of C Major on guitar corresponds to C-E-G-C-E rather that "simply" C-E-G.)

So it might seem like mapping an arbitrary fingering to the corresponding chord name requires a lot of information, but it's just matching notes (or pitch classes) to a moderately small number of named interval patterns.

And it might seem like "F5addb5addb11addb13/A" is a ridiculously over-specified chord name, but that's a function of applying a set of conventional "modifiers" to a simpler/better-known/more-common chord. (In this case, `F5addb5addb11addb13` = `F5 + add(b5) + add(b11) + add(b13)`, i.e., F5 (F + C) with a diminished-5th (C), diminished-11th (B) and diminished-13th (C#) added.) You could argue that the pattern matching is trying too hard in this case, but if you're dedicated to assigning a "conventional" chord name to an arbitrary collection of notes, there's algorithmic way to do that.

Again, apologies if this is obvious to you (user Y_Y), I just thought I'd try to de-mystify it a bit for anyone to whom this seems like alchemy.

Music theory has a bunch of semi-arbitrary naming conventions that make it sound really complicated to the uninitiated, but in the abstract the chord names are basically just bit-masks that specify interval offsets from a given root note.

Re: Show HN: Get the guitar chords from your Spotify playlists

#65
post #21

Earlier quoted context omitted.

This is the right approach for song recommendation too — try your approach there and see what happens. If you want help on the business side, reach out.

That is very kind of you to offer. I don't know if I'd be able to find the time to dedicate to having this function as an actual product though!

You're already leaps and bounds into a good partnership - realistic expectations. Consider it again when you get downtime, no rush over here, more fun.

Re: Show HN: Get the guitar chords from your Spotify playlists

#67

You would think getting the notes and converting them to chords, and tablature, would be one of those "exactly suited for neural nets" type of problem. If you want the chords to "Here comes the sun," you can find dozens of hits, but try something slightly obscure and they are hard to come by. (People with great ears have no idea what I am talking about.)

I don't think finding individual notes / the inherent notes within a chord is likely that difficult. The problem with this sort of thing is the nuance that's really involved - a player with a decent ear will be able to tell if the same A note is played on an open string, on the lower, fatter strings, or further up the neck. With chords, you also need to start considering voice leading (where you're specifically picki…

In addition to that, the same set of notes can represent different chords depending on the context and the chord's function, so instead of just picking up notes and recognizing them, the software has to actually understand the chord progression and the harmony.

Re: Show HN: Get the guitar chords from your Spotify playlists

#68
post #3

Against my better judgement I actually logged in with Spotify, only to find that it just didn't work. I'm not really sure what I was expecting anyway. There used to be a great trade in guitar chords online, but then lots of small sites got taken down and ultimategyitar tried to put a big shitty paywall around years and years of high quality content made by volunteers and often scraped from other sites.

I learned to play guitar back in the 90s when the OLGA was still a thing. UG sucks for precisely the reasons you mention. I suppose the trade-off is that now all the great folks who were making nice tab content are on YT, but still, if you'r business model is making money off aggregating a bunch of content people created in the early 00s because the love of it, then that's hyper lame. I still use UG if I am in a hurr…

OLGA was the Eldorado for my teen self. Its demise was a disaster.

I still have a full copy of its archives somewhere collecting dust in my old hard drives.

Re: Show HN: Get the guitar chords from your Spotify playlists

#69
post #17

You would think getting the notes and converting them to chords, and tablature, would be one of those "exactly suited for neural nets" type of problem. If you want the chords to "Here comes the sun," you can find dozens of hits, but try something slightly obscure and they are hard to come by. (People with great ears have no idea what I am talking about.)

I've worked on this problem for some time on a personal project, and I'm pretty convinced you can basically solve this problem without deep learning or AI techniques, and instead use non-negative matrix factorization[0] as a bank of note templates (from their spectrograms). I have a fairly well working proof of concept and the approach is supported by the literature. [0]: https://en.wikipedia.org/wiki/Non-negative_ma…

I've also spent a fair bit of time on this topic and for what it's worth I agree with you. It is a harder problem than the monophonic case (and more sensitive to problems like noise under real-world conditions) but you don't strictly need deep learning or AI techniques to solve it.

I mean, computational complexity aside it seems like at least hypothetically you could even just apply basic auto-correlation-style logic to detect the period of the combined wave much like you do in the monophonic case (assuming the chord is sustained for long enough to actually capture that full period, which of course it won't be in the general case). There's nothing magical about a neural-net or other deep-learning-style solution to this problem - at the end of the day that's just an approximation of a formula that could in theory be derived through more direct means anyway. And (as far as I know) there's no reason to believe the polyphonic case is fundamentally resistant to more traditional techniques.

And as implied by your comment, the problem is made easier (or at least less resource-intensive) in practice than it is in the abstract: we're mostly interested in audio that's comprised of actual notes from the chromatic scale (rather than a combination of arbitrary frequencies). There's only ~140 or so component frequencies we really need to consider in practice. (Not to mention the semi-predictable repetition/progression patterns you're likely to encounter in most conventional songs. That's inadequate by itself but certainly a good way to error correct, fill in gaps, resolve ambiguous cases, etc.)

But that said, it does seem like polyphonic pitch detection is a problem that responds really well to machine-learning techniques. In my experience, even a fairly simplistic ANN (e.g., no hidden layers, ~1k to ~10k weights depending upon how the inputs/outputs are modeled) - when seeded with a little bit of domain-specific knowledge - can very quickly learn to perform reliable polyphonic pitch detection under real-world conditions.

To be fair, I haven't quite put my money where my mouth is on this topic (yet): I develop software that includes this sort of functionality and the current production version uses more conventional (or at least direct) analysis rather than so called "deep learning" techniques for polyphonic pitch detection. There are pros and cons to either approach, but I can definitely see why some find the deep learning solution attractive. There's probably some degree of magical thinking involved (i.e., "AI will solve this pattern recognition problem that's too hard for me to work out from first principles"), but it also seems to work really well in this case.

For what it's worth I think you've got the right general idea, or at least (based on your brief description) I think I arrived at a solution that's based on some similar concepts and found it fairly effective (beyond the proof-of-concept phase). And as you noted there are related concepts discussed in some of the published academic research. I'd love to hear a little more about your approach if you're willing and able to share any more details. (Noting that at least part of my interest in that topic is selfish, of course.)

Re: Show HN: Get the guitar chords from your Spotify playlists

#70
post #19

You would think getting the notes and converting them to chords, and tablature, would be one of those "exactly suited for neural nets" type of problem. If you want the chords to "Here comes the sun," you can find dozens of hits, but try something slightly obscure and they are hard to come by. (People with great ears have no idea what I am talking about.)

Thus propagating the NN "If all you have is a hammer" trend. I don't quite know the nuance of music theory, but could you not get away with traditional Fourier analysis? You just need to decompose the song into its constituent frequency "bins" right?

As other commenters have expounded on, the short answer is "no". While I definitely agree that one must be careful about falling into the trap of thinking everything is a nail to be hammered with NNs, it's also pretty common to fall into the "this is easy, why don't you just..." trap for things that humans do with (relative) ease.
Post reply on HN