[HN Gopher] Show HN: Get the guitar chords from your Spotify pla...
       ___________________________________________________________________
        
       Show HN: Get the guitar chords from your Spotify playlists
        
       Author : lucaaa
       Score  : 85 points
       Date   : 2021-12-06 14:16 UTC (8 hours ago)
        
 (HTM) web link (spotifychords.luca.gg)
 (TXT) w3m dump (spotifychords.luca.gg)
        
       | tinyhouse wrote:
       | Oh so this is not what I thought it is. I thought it actually
       | figures out the chords for any given song.
        
         | wsinks wrote:
         | Yeah agreed.. wishing I hadn't given them my Spotify
         | credentials.
         | 
         | I feel a lot of egg on my face
        
         | kej wrote:
         | You want Chordify, then. It uses YouTube instead of Spotify but
         | does a pretty good job of finding chords.
         | 
         | https://chordify.net/
        
       | zwily wrote:
       | Tangentially, if you want to get chords from a song (and can't
       | find them already written online), Capo does a pretty great job
       | at it and is very easy to use. Mac/iOS only, but the best I've
       | seen.
       | 
       | https://supermegaultragroovy.com/products/capo/
        
       | driekwartappel wrote:
       | In the good old days of Winamp (15 years ago...) I created a
       | plugin that scraped the web and showed the chord in Winamp as you
       | played a song. The code was dead easy to implement as it was just
       | an embedded site within Winamp (HTML & Javascript & Winamp JS
       | SDK). And surprisingly the site is still running! Not sure if the
       | scraping still works though
       | http://pikkipowpow.davidsmit.za.net/Home.aspx
       | 
       | So yes there are definitely a use case for all the new media
       | players to show chords
        
       | michaeljgerace wrote:
       | Hi! In terms of your credential flow - did you get a quote
       | extension from Spotify for your use-case? I know that this kind
       | of log in flow is really restricted without requested (at least
       | in my experience working with the API).
        
         | lucaaa wrote:
         | Hi, I didn't get a quote extension, I never actually looked at
         | the quote limitation because I was only using it myself.
         | 
         | Edit: I checked on the Spotify developer dashboard and it says
         | "App Status: Granted quota extension"
        
           | simonebrunozzi wrote:
           | Someone from Spotify should have read this on HN and decided
           | to give you a present :)
        
       | costcopizza wrote:
       | Learn them by ear, no tabs, YT vids, or anything else. Much more
       | gratifying, you'll thank me later and become a better player.
        
       | omarhaneef wrote:
       | 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.)
        
         | CardenB wrote:
         | Ubisoft has a new version of rocksmith coming out and plans to
         | build most of their library on this technology.
        
           | bentcorner wrote:
           | Wait, really? I would think they would use some kind of
           | canonical source for the tabs they've licensed. Maybe I
           | expect too much.
        
             | colejohnson66 wrote:
             | With OG Rocksmith (and 2014), the charts were supposedly
             | all done by the folks at Ubisoft. They'd watch live videos
             | and have multiple go-overs with each other to make it as
             | accurate as possible. Besides, "official" tabs (at least
             | historically) were usually not done by the actual artists,
             | but some company that was just given the recordings and
             | paid to figure it out.
        
             | CardenB wrote:
             | They have two modes: 1. Transcribed tabs. They own the
             | transcription as they have done with their catalogue in
             | existing Rocksmith games. I believe they claim they use
             | some "AI assistance" here, but I could be wrong. At the end
             | of the day, they pay a large number of musicians to chew
             | through songs and write tabs. 2. Chord following. They use
             | automated transcription to get the chords for a very large
             | number of songs. This is a new mode in the newest game and
             | is entirely automated, but limited.
        
         | cnity wrote:
         | 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_matrix_factorizat...
         | 
         | _edit_
         | 
         | That said, you'd probably need something more hard-core for
         | extraction from an actual track, so you're probably right.
        
           | anonymouse008 wrote:
           | 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.
        
             | cnity wrote:
             | 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!
        
           | notfed wrote:
           | As an amateur musician I see this as a missing holy grail
           | killer app. I'd love to have it just to pull the chords out
           | of some of my own old recordings that I can't figure out how
           | to repeat.
           | 
           | If anyone knows of any apps (even prototypes) that can do
           | this, please provide links.
        
             | cpdomina wrote:
             | Ableton Live has a Audio to Midi [1] feature that works
             | pretty well to extract notes from audio. Melodyne [2] is a
             | very powerful tool to mess around with notes in general.
             | 
             | There's also some open source projects out there, such as
             | aubio [3] and Omnizart [4].
             | 
             | [1] https://www.ableton.com/en/manual/converting-audio-to-
             | midi/
             | 
             | [2] https://www.celemony.com/en/melodyne/what-is-melodyne
             | 
             | [3]
             | https://aubio.readthedocs.io/en/latest/cli.html#aubionotes
             | 
             | [4] https://music-and-culture-technology-
             | lab.github.io/omnizart-...
        
             | cnity wrote:
             | I may have to blow the dust off of my prototype.
        
               | moehm wrote:
               | If you do, make sure to make it a Show HN to let us know!
        
             | cannam wrote:
             | There are various commercial offerings that do this,
             | including Chordify and Capo.
             | 
             | Alternatively if you want a flexible free (GPLv2) option
             | with source code, consider the Chordino plugin
             | (http://www.isophonics.net/nnls-chroma, C++ code at
             | https://github.com/c4dm/nnls-chroma) which you can run in
             | Sonic Visualiser (https://www.sonicvisualiser.org/), or
             | indeed in Audacity.
             | 
             | There is a reference describing the Chordino method in the
             | page linked above, but roughly it's not too far from the
             | description of the parent poster - a non-negative least-
             | squares method produces a frame-by-frame semitone-scaled
             | decomposition which is then matched against templates and
             | turned into a chord sequence using a hidden Markov model.
             | Some sort of intelligent smoothing like this is certainly
             | needed, the raw template matching is not especially useful
             | on its own.
             | 
             | This type of method is now routinely outperformed by neural
             | networks (see e.g. these MIREX evaluation results from 2018
             | which compare Chordino with a few other academic methods
             | https://www.music-
             | ir.org/mirex/wiki/2018:Audio_Chord_Estimat...) but I would
             | suggest that it's still good enough to be useful - and I
             | encourage the parent to continue their work, as it's an
             | interesting area to explore.
        
             | rodw wrote:
             | Automated music transcription - the process of generating a
             | musical score from an audio recording - is a pretty active
             | topic in signal processing (and has been for a couple of
             | decades at least).
             | 
             | The monophonic case (one note at a time) is fairly well
             | solved at this point: there are decades old solutions in
             | both the frequency domain (like FFT) and time domain (like
             | auto-correlation and the dozens of refinements of that
             | basic concept) that work quite well under less than ideal
             | conditions and in near real-time. Even naive solution like
             | just counting the number of zero-crossings in the audio
             | signal to estimate the fundamental frequency works pretty
             | well.
             | 
             | The _polyphonic_ case (like chord detection) is trickier,
             | especially depending on what you 're looking for exactly.
             | I.e., is it sufficient to say "that's a C Major chord" or
             | are you looking for a specific inversion or even fingering?
             | Does it need to happen in real-time based off a microphone
             | or could you batch-process an audio file instead?
             | 
             | But there are both academic solutions and consumer-oriented
             | tools that can do a reasonable job of it (again, depending
             | on what you're looking for).
             | 
             | If you're looking for guitar-chord detection in particular,
             | I'd recommend you take a look at Chordify
             | (https://chordify.net/). I'm even the developer of a
             | product that competes with (or at least overlaps with)
             | Chordify, but frankly it pretty much does what it says on
             | the tin (extracts chords from audio recordings with more
             | than acceptable fidelity, especially if you're willing and
             | able to refine that by ear using the automated
             | transcription as a starting point).
             | 
             | I'm pretty sure Chorify's solution is based on "deep
             | learning" (ANN) techniques, but others have noted in this
             | thread that's not the _only_ viable way to do it. I suspect
             | some combination of increasing computational power and
             | algorithmic refinements will eventually lead to a  "direct
             | analysis" approach that becomes as common/conventional for
             | polyphonic pitch detection as FFT and AC are for the
             | monophonic case. There are already a number of fairly
             | effective techniques depending on the constraints you want
             | to put on the problem.
        
         | astrea wrote:
         | 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?
        
           | cnity wrote:
           | 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.
        
             | etskinner wrote:
             | 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 harmonics there"? If yes, that's the
             | note, if no, it's something else.
        
               | cnity wrote:
               | This is basically how you'd do it with non-negative
               | matrix factorization. You take the spectrogram of a bunch
               | of known notes for that type of guitar, and store them in
               | a template library (just a vector of vectors, where each
               | inner vector is a spectrogram of that note). Then NNMF
               | determines how much of each template contributes to some
               | given signal. The templates are the "harmonics look like
               | this" thing you're talking about. It works pretty well.
               | 
               | By the way, the reason it is easier to use NNMF than try
               | to implement your suggestion as a heuristic is because
               | there's much more overlap between the different notes
               | than you might think, and (worst of all) the timbre of
               | the note:
               | 
               | 1. evolves over time!
               | 
               | 2. depends on the velocity of the note (how hard the
               | string was strum)
               | 
               | 3. and the notes actually interact with each other. If
               | you play an E, the A string will mildly reverberate too
               | because of the shared harmonics
        
               | rodw wrote:
               | 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.
        
           | omarhaneef wrote:
           | Well the NN has to have something to operate on, and I think
           | a Fourier analysis may help as an input.
           | 
           | There is just too much going on with a track. Its really
           | strange for us to say this mash up of sounds is "really"
           | A-D-E at the heart of it, and when I play these chords it
           | will suggest that wall of sound you heard on the record. The
           | net is just capturing our biases.
        
           | PeterisP wrote:
           | No, at the very least you also need to do the instrument
           | separation, e.g. bass might match guitar chord root note at
           | one moment, and do something entirely different half a second
           | later, and of course in a coherent song all the different
           | instruments will merge in the same frequency bins, either
           | directly or with their overtones. Also, for certain
           | instruments and effects on e.g. guitar amps the strongest
           | peaks of Fourier transform for the instrument output may not
           | necessarily match the notes that are actually being played.
        
         | dodgrile wrote:
         | 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 picking
         | chord inversions for melody, which on guitar will affect how /
         | where you play a chord) and how the mechanics fit together
         | overall (I probably don't want to play an open C chord followed
         | by something on the 11th fret, for example).
        
           | gerbilly wrote:
           | Yeah exactly what I was going to say, you have to consider
           | the chord voicing, the strum pattern, and whether the
           | sequence of chords makes sense for a human to comfortably
           | play.
           | 
           | Someone above mentioned: "Here comes the sun", which is a
           | great example.
           | 
           | First gotcha, it sort of sounds finger picked, but it's not
           | it's flat picked. Another unusual thing about that song is
           | that it's played w/ a capo on 7th fret.
           | 
           | Now I'm sure some software could figure out the individual
           | notes, but I wouldn't be surprised if it transcribed it as
           | nonsense sequence of notes all over on the g, b and e
           | strings, instead of arpeggiated chords as it really is
           | played.
        
           | tyingq wrote:
           | Aren't there a fair amount of songs where the guitar is in
           | some non-standard tuning or played with a kapo, etc? I
           | imagine a naive ML approach would spit out some tabs that
           | would be difficult to play without that context.
        
           | omarhaneef wrote:
           | Tell me you have a good ear without telling me you have a
           | good ear.
        
       | standard09 wrote:
       | This is really great product. Keep it up!
        
       | the_arun wrote:
       | Is there a way to demo how it works, before I sign in with my
       | Spotify account & share my data?
        
       | dvsfish wrote:
       | Hah! I made a similar thing where I have a button in my extension
       | bar on chrome that I click to perform a google search of [song
       | I'm listening to on spotify] + " chords". Waiting for firefox
       | manifest v3 update to add final touches.
        
       | xnzakg wrote:
       | Wish there was some kind of example of what it looks like before
       | I log in with my spotify account.
        
         | dsizzle wrote:
         | Yeah. The playlist part seems unnecessary too -- why not just
         | have it work on a single song?
        
           | jaywalk wrote:
           | Because all it does is scrape search results from ultimate-
           | guitar.com so without the Spotify playlist integration it
           | would be entirely pointless.
        
       | Malp wrote:
       | This is great, I was thinking of a similar idea recently- thank
       | you for making this! If you haven't already, I would suggest
       | sharing it on reddit too- I think /r/guitar and some others would
       | love it :)
        
       | CountDrewku wrote:
       | This just searches ultimate-guitar.com for you. Why do I need
       | your app for that? I'll just go to the source.
        
       | Y_Y wrote:
       | 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.
        
         | saevarom wrote:
         | I actually run a guitar chord website, www.guitarparty.com,
         | that provides chords for songs, but also some additional
         | functionality such as PDF books, transposing songs etc for
         | subscribers. But the content is free although you have to
         | tolerate a few Google ads. We're mostly local to Iceland but
         | there are always some users and subscribers from around the
         | world.
         | 
         | We once attempted to go the legal route globally and make a
         | deal with Harry Fox Agency (the agency that took down OLGA), we
         | had a contract ready but it would have been quite expensive and
         | risky for us. That being said, we pay royalties to our local
         | copyright agency based on usage.
        
           | fenderbluesjr wrote:
           | Does your site or any other allow a user to click notes on a
           | fretboard and have the app deduce the chord from the
           | positions? I know a lot of chords the names of which I have
           | forgotten, and don't have the theory chops to work it out
           | myself
        
             | cyberbanjo wrote:
             | Heres one https://jguitar.com/chordname
        
               | Y_Y wrote:
               | 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
               | ...
        
               | rodw wrote:
               | 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.
        
         | dsizzle wrote:
         | One of my first tastes of the web was finding tabs on ftp
         | servers!
        
         | vitorbaptistaa wrote:
         | As an alternative, I use cifraclub.com.br for many years, and
         | enjoy the interface and the overall quality of the chords (not
         | affiliated with them).
         | 
         | It's not in English, but you should be able to figure out
         | where's the search bar and use it without much effort.
        
         | jamespwilliams wrote:
         | If anyone knows of a free and open-source guitar tab sharing
         | site, I'd be interested.
         | 
         | I wrote some tabs recently and ended up just putting them on my
         | personal website. Hopefully people will search via Google and
         | find them.
        
         | scarecrowbob wrote:
         | 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 hurry and want a quick idea of
         | other folks' take on the structure of a song, but I'm thankful
         | I outgrew the need for other folks' transcriptions.
        
           | phasersout wrote:
           | I disagree.. I learned guitar in the late 80s and getting
           | tabs back then meant to get on the train, drive an hour into
           | the city pay like 20 to 30 bucks for - one album worth of
           | tabs - lets say "Appetite for Destruction" and drive home
           | another hour... and then a lot of this "official tabs" were
           | complete rubbish...
           | 
           | So Ultimate Guitar is a steal really. I got a lifetime
           | subscription a couple of years ago but I would also sign up
           | for a monthly plan gladly.
        
           | soylentcola wrote:
           | Heh...a guy I knew in college got a meeting with admin when
           | he thought it would be cool to host an OLGA mirror on his
           | university web storage around 1995 or 1996.
        
         | jaywalk wrote:
         | Looking at the JavaScript of the site, it looks like all it
         | does it scrape the search results from ultimate-guitar.com for
         | the songs in your playlist.
        
         | boringg wrote:
         | Seriously ultimate guitar just effed over so many people who
         | put time and effort into spreading guitar chords.
         | 
         | That and their site is covered in so much ad content.
        
           | tokamak-teapot wrote:
           | I have contributed many tabs to guitar archives over the
           | years. Some are available via Ultimate Guitar.
           | 
           | How am I being 'effed over'? I might be, but I haven't
           | spotted how.
        
             | olivermarks wrote:
             | It's classic tragedy of the commons - most of
             | ultimateguitar and other sites have just scraped 'content'
             | off the good old spirit of the early web all the way back
             | to newsgroups then put a paywall and ads all over it.
             | 
             | still beats pre internet though when you'd buy an expensive
             | book of sheet music with first position camp fire chord
             | diagrams and a piano arrangement written out by someone who
             | appeared to have little feel for the actual recorded music.
             | 
             | Without inversions, suspended chords, added base notes etc
             | most chord naming isn't much use, tabbed out diagrams for
             | guitar and keyboard are really helpful along with all the
             | wonderful youtube content from jamesjames, late night
             | lessons etc
        
           | [deleted]
        
       | japers wrote:
       | I built something similar for personal use. It's a Mac app that
       | uses AppleScript to poll Spotify for the track that is currently
       | playing. It then looks for chords on Ultimate Guitar through a
       | small NodeJS API that uses Puppeteer to scrape the site. I'll
       | usually just put my guitar playlist on shuffle and have this app
       | open alongside it.
        
       | weystrom wrote:
       | UltimateGuitar is so pushy with their ads and subscriptions, it's
       | a crime.
       | 
       | Neat shortcut though. Thanks for the effort.
        
         | JulianWasTaken wrote:
         | uBlock + some extra style blocks works pretty well to make it
         | go away IME. The extra style blocks will remove the fake
         | overlays with videos that they add, or the tight padding, etc.
        
       | lucaaa wrote:
       | Hello, I am the creator of the website. The main goal is not
       | having to search on UltimateGuitar for the chords of the songs
       | you want to play, but instead get a direct link to the song on
       | UG. I made it because I was tired of checking my Spotify
       | playlists for songs of which I didn't remember the title but I
       | wanted to play and then go on UG and type the title in the search
       | field. It's more of a "I'm lazy" tool than an actual tab website.
        
       ___________________________________________________________________
       (page generated 2021-12-06 23:01 UTC)