https://github.com/loiccoyle/shazam-cli
🎶 CLI music recognition using the Shazam API
https://github.com/loiccoyle/shazam-cli
cli music music-recognition shazam
Last synced: 5 months ago
JSON representation
🎶 CLI music recognition using the Shazam API
- Host: GitHub
- URL: https://github.com/loiccoyle/shazam-cli
- Owner: loiccoyle
- License: mit
- Created: 2021-09-09T20:24:18.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-10-01T16:43:27.000Z (about 1 year ago)
- Last Synced: 2025-04-05T13:51:23.650Z (6 months ago)
- Topics: cli, music, music-recognition, shazam
- Language: Shell
- Homepage:
- Size: 16.6 KB
- Stars: 52
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🎶 shazam-cli
Record audio and use the [Shazam](https://rapidapi.com/apidojo/api/shazam/) music recognition API from the command line. It is free for 500 queries per month.
The [`shazam`](./shazam) scripts queries the Shazam API. This repository also contains [`shazam-notif`](./shazam-notif) which uses [`shazam`](./shazam) and `libnotify` to return the match result.
## 📦 Installation
### Dependencies
The `shazam` script requires:
- [curl](https://github.com/curl/curl)
- [ffmpeg](https://git.ffmpeg.org/ffmpeg.git)In addition to the above the `shazam-notif` script requires:
- [jq](https://github.com/stedolan/jq)
- notify-send
- [dunst](https://github.com/dunst-project/dunst) (optional)#### Manual
Just clone this repo and place the `shazam` and `shazam-notif` scripts on your `$PATH`.
#### Arch (AUR)
Using your favourite AUR helper:
```sh
paru -S shazam-cli-git
```## 📋 Usage
To use these scripts you'll need your own API key.
It can be obtained from [`rapidapi`](https://rapidapi.com/apidojo/api/shazam/) 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.