104 points · by lucaaa · 4y ago · 80 comments
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.)
[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.
If anyone knows of any apps (even prototypes) that can do this, please provide links.
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.
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-...
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.
Assuming the answer is "yes", I'm not sure if I follow the leap from "non-negative matrix factorization as a bank of note templates (from their spectrograms)" to "song recommendations".
Very loosely speaking my (not wholly uninformed) interpretation of the "note templates" bit is sorta analogous to DFFT analysis with frequency bins centered around the "regular" notes of the chromatic scale - i.e., the cells of the matrix represent signal strength for the frequencies that correspond to conventional western notes (e.g. integer-valued midi note numbers) or (in aggregated form) octave-independent pitch-classes rather than arbitrary frequencies (that might fall between two conventional notes). It's a very useful representation of the component frequencies that appear in conventional music but at the end of the day it's more or less "here are the notes (or pitch classes) active for this given beat".
That is, I can imagine the role this information - essentially the musical score itself, or at least the pitch-specific dimension of that score - could play in a song-recommendation engine, but I'm curious how/why that specific spectrogram-template-based representation is significant.
Are you suggesting that that specific representation could be applied to song recommendations in a way that similar polyphonic-pitch-per-beat information derived from some other algorithm (FFT analysis for a hypothetical example) could not?
Or maybe I've misinterpreted your comment entirely?
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.)
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.
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.
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.
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.
That and their site is covered in so much ad content.
How am I being ‘effed over’? I might be, but I haven’t spotted how.
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
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.
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.
I still have a full copy of its archives somewhere collecting dust in my old hard drives.
It's not in English, but you should be able to figure out where's the search bar and use it without much effort.
I wrote some tabs recently and ended up just putting them on my personal website. Hopefully people will search via Google and find them.
Beyond the usual web-based suspects (some of which have been named elsewhere in this thread) there are also a number of other tab sharing "communities", including some relevant subreddits that might be the easiest way to spread the word if you're not comfortable uploading to a more directly for-profit service (not that Reddit isn't for-profit too, but guitar tabs certainly aren't their business model and you'd largely be linking to files stored elsewhere rather than uploading them directly).
But a lot of people seem to do what you did also. I suspect it's not super-effective as a distribution model, but if you dig a little it's not hard to find smaller/specialized tab collections on personal websites or general-purpose file hosting services like Google Drive/Dropbox or even at places like Github.
I don't think Google's `filetype:` operator respects guitar-tab-related extensions like `gpx` or `gp5` or `tab` or whatever but using the `inurl:` operator (or just including the tab-specific file extension) combined with the song title or artist name is a good way to find some of these less-centrally located tabs.
Also there are several massive collections available via torrent and on some of those more gray-hat-ish anonymous/one-off file-sharing services. Arguably these may have a more questionable provenance but I suspect the plurality if not the majority of the guitar tabs you'll find shared anywhere online could be traced back to old-school usenet or the first generation of tab-sharing websites that grew out those communities. Ultimate-Guitar for example self-reports as having "chords and tabs to over 1,100,000 songs", and likes to highlight their "official" (licensed) transcriptions (and to be fair they are nothing to sneeze at), but it's probably no coincidence that they don't seem to report the ratio of "official" to "community-provided" transcriptions.
EDIT: Just out of curiosity I checked the file-count reported at the bottom of UG's search page when filtered by file type, I see:
* 18,688 "official" tabs (AFAIK these are the only actually licensed transcriptions)
* 212,408 "Guitar Pro" (.gpx/.gp5/.gp4/.gp3) files; user-generated and many of which probably weren't originally uploaded to UG
* 1,115,129 plain-text transcriptions (801,597 "chords", 313,532 "tabs") that almost certainly date back to Usenet-era communities
The ~20K of licensed/official transcriptions are impressive (both individually and collectively) but represents less than 2% of the overall song catalog (and much less than 2% by file count).
Neat shortcut though. Thanks for the effort.
So yes there are definitely a use case for all the new media players to show chords
I feel a lot of egg on my face
Edit: I checked on the Spotify developer dashboard and it says "App Status: Granted quota extension"
If you want to kill someone's love for playing and have them hate their favorite songs, make them use their completely untrained ear to listen for chords they don't even know through layers of amp effects, pedals, and editing.