SongRec: An Open-Source Shazam Client for Linux

 

Everybody knows Shazam. The service is owned by Apple and it can identify songs from a short sample which is fingerprinted and compared against it’s database. If you’re looking for a way to use Shazam on your Linux machine, you can take a look at SongRec.

SongRec is an open source client that uses Shazam’s audio fingerprinting algorithm and can identify a song from an audio file or by using the microphone.

FEATURES

  • Recognize audio from an arbitrary audio file.
  • Recognize audio from the microphone.
  • Usage from both GUI and command line (for the file recognition part).
  • Provide an history of the recognized songs on the GUI, exportable to CSV.
  • Continuous song detection from the microphone, with the ability to choose your input device.
  • Generate a lure from a song that, when played, will fool Shazam into thinking that it is the concerned song.

 

 

HOW TO INSTALL

SongRec is available as a flatpak for an easy install across many distros. If flatpak is not your cup of coffee…

… and you’re using Arch ( or derivates ) SongRec is available in the AUR as songrec and songrec-git. ( NOTE: for some reasons yay failed to install SongRec, but I had no issues using pamac to build and install it. )

If you’re using Ubuntu ( or derivates ) you can add the repo with sudo apt-add-repository ppa:marin-m/songrec -y -u and install SongRec with sudo apt install songrec -y

Alternatively, you can install SongRec using Cargo (example):

sudo apt install cargo rustc -y
echo 'export PATH="$HOME/.cargo/bin:$PATH"' | tee -a ~/.profile ~/.bashrc
source ~/.bashrc

sudo apt install build-essential libasound2-dev libgtk-3-dev libssl-dev -y
cargo install songrec

NOTE: if you take the Cargo route, SongRec won’t be available in your applications menu. You can only open it from the terminal by running songrec

 

 

It’s time to test if and how it works. Problem is….

Normally you would use the microphone and have Shazam, or SongRec in this case, record a sample of what you want to “discover”. The problem is that the mic on my computer is physically disconnected and I don’t have access to my external mic right now. Not to worry, I can upload an audio file and test SongRec that way. Well…

I have no audio files on my computer other than some .m4a files downloaded from soundcloud. The problem is that SongRec does not work with .m4a files. Seems like it only works with .mp3, .flac, .wav and .ogg

So what to do? I used this to see what’s the most streamed song of the day on Spotify in the US. Then I’ve downloaded the .mp3 from YouTube using youtube-dl ( NOTE: I don’t promote piracy, it’s for testing purpouses only. ).

Once the song was downloaded, I renamed it to song.mp3 and used exiftool to see if there’s any metadata that could help SongRec identify the song. Nope… no metadata.

 

Back in SongRec, I clicked on ‘Recognize from file’, browsed to my desktop, selected the song and 5 seconds later I had the name of the artist and the song, as well as the album cover.

 

From there you can search for the “recognized” song on YouTube, and you can also export your “discovery” list.

That’s pretty much it. It seems to work and it works well and fast. If for some reason you need such a client, there you go. SongRec – a free and open source Shazam client for Linux.

For more info check out SonRec’s project page on GitHub.