This is perfect. I've been thinking of setting up a system to automatically record the last couple minutes of every hour of my local NPR station, Shazam the bump music that they play, and post the results as a searchable schedule (since they refuse to do it themselves). I can't tell you how annoying it is to hear like 15 seconds of an interesting song, and have no way of knowing what it is if one's phone can't be reached in time (and to have it happen, like, twice a week).
...If anyone wants to steal this idea and do it themselves, I won't mind.
If you'd like an idea for adjacent project, I was planning to make a menubar app (on macOS) / applet (on Linux) wrapping shazactl after releasing it – I think that might be a nice addition to Shaq, too!
I have needed this so many times in my life! I usually run a virtual audio device router like Loopback or Soundflower or Background Music. It's so janky.
I don't know why, but Shazam has been really hit or miss lately. I've always managed to get sources for obscure elevator songs that would pop up but now it's failing to pick up the simplest stuff. I've since then switched to Google assistant which can get the song right in 3 seconds or less and with much more consistency. It's a shame because it's just one of those apps I thought was groundbreaking when I first started using it.
The blog post explains that the goal is to run this on a SBC that’s connected directly to my sound system. I don’t always have my computer turned on, or have Firefox open.
If you have Nix and want to test this without python versions, pip, whatnot you can use `nix run github:figsoda/nixpkgs/shaq#shaq -- --listen` or `nix shell github:figsoda/nixpkgs/shaq#shaq` and use `shaq` in your temp shell.
Or, once this @figsoda PR[0] gets merged and it gets in the nixpkgs unstable you can use `nix run nixpkgs#shaq -- --listen` or `nix shell nixpkgs#shaq` instead.
If you're wondering how to implement Shazam itself, it's surprisingly straightforward using a notion of "anchor points" and "constellations" within a spectogram to reduce the search space and be resistant to ambient noise.
At scale, you just need a really fast key-value lookup table - and of course, the legal permissions for all the audio files. But if you have a proprietary set of audio files you want to be able to match ambient audio recordings against, it's absolutely feasible to implement from scratch.
Implementing something like Shazam that works in a quiet room with perfect source might be "straight forward" and "just need a really fast key-value table" but the thing where Shazam shines is doing all of that with very quiet audio, bad quality, noisy background and all kinds of other non-lab conditions.
I think you are underselling the engineering effort a bit there, I'm sure the engineers working on it for years have a reason for still being there.
The fingerprinting algorithm described in the paper handles noise and quality issues - it’s not just for lab environments. That said there are many parameters that can be tuned from real-world data, additional filters that can be applied, and no doubt Shazam has improved things over the years.
With regards to engineering, I believe the lion’s share of Shazam’s engineering goes to things other than the core algorithm: app development, song ingestion pipelines, enterprise analytics for the record industry, etc.
Seems to me that Steam itself fits well into this category. It tracks your overall play time for games and has a recommender system, and also keeps global stats for a _lot_: https://store.steampowered.com/charts/
What is amazing about it, too, is that if you want to get better at using Shaq you could “increase your Shaq-fu”. For those who aren’t aware, there was a 2D fighting game released in the 1990s called Shaq Fu and featured Shaq [0]
I'll admit I don't use it all too much, but it has picked up almost every song I've tried it on over the last couple of months (14) - from video game soundtracks to a song echoing through a stadium.
Yes, I used it very frequently for years. Multiple times a week. This year I began looking for alternatives because Shazam has become so unreliable for me.
...If anyone wants to steal this idea and do it themselves, I won't mind.