Skip to content

🎶 CLI music recognition using the Shazam API

License

Notifications You must be signed in to change notification settings

loiccoyle/shazam-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎶 shazam-cli

Record audio and use the Shazam music recognition API from the command line. It is free for 500 queries per month.

The shazam scripts queries the Shazam API. This repository also contains shazam-notif which uses shazam and libnotify to return the match result.

📦 Installation

Dependencies

The shazam script requires:

In addition to the above the shazam-notif script requires:

Manual

Just clone this repo and place the shazam and shazam-notif scripts on your $PATH.

Arch (AUR)

Using your favourite AUR helper:

paru -S shazam-cli-git

📋 Usage

To use these scripts you'll need your own API key. It can be obtained from rapidapi you'll need a RapidAPI account and subscribe to the Shazam API (there is a free a plan). Provide the API key either through the -a flag or by writing to ${XDG_CONFIG_HOME:-$HOME/.config}/shazam-cli/key.

$ shazam -h
Usage: shazam [OPTION]... [FILE]
Query the Shazam music recognition API.

Get free API access at: https://rapidapi.com/apidojo/api/shazam/

The API key can be read from file:
$ echo "api-key" > "~/.config/shazam-cli/key"

If no FILE is provided, a recording is made using the AUDIO_SOURCE.

Usage:
    -h                    Show this message and exit.
    -a API_KEY            API token.
    -s AUDIO_SOURCE       ffmpeg audio input source, (default: "default").
    -t RECORDING_TIME     Length of recording time, in seconds, (default: 5).

You can use ffmpeg -sources pulse to list available sources.