- vibra is a C++ music file recognition tool that uses an unofficial Shazam API.
- vibra analyzes music files and returns fingerprint data. It searches the Shazam database to identify the song.
- The Shazam algorithm is based on:
- I referenced the Rust implementation of the Shazam client code from SongRec.
- I created this project for embedded devices such as Raspberry Pi or Jetson Nano, which are challenging to set up with Python or Rust environments.
Platform | Architecture | Build Status |
---|---|---|
WebAssembly | - | β |
Linux | x86_64 | β |
Linux | ARM64 | β |
Windows | x86_64 | β |
macOS | x86_64 | β |
macOS | ARM64 | β |
Raspberry Pi 4 | ARMv8-A | β |
Raspberry Pi Zero | ARMv6 | β |
- vibra uses CMake for building. You need to install CMake to build vibra.
- vibra utilizes C++11 features.
- vibra depends on the following libraries or tools:
- Ubuntu
sudo apt-get update
sudo apt-get install cmake libcurl4-openssl-dev libfftw3-dev
sudo apt-get install ffmpeg
(Optional)
-
Clone repository recursively to include submodules.
git clone --recursive https://github.com/bayernmuller/vibra.git
-
Run the following commands to build vibra:
mkdir build && cd build
cmake ..
make
Use --help option to see the help message.
vibra {COMMAND} [OPTIONS]
Options:
Commands:
-F, --fingerprint Generate a fingerprint
-R, --recognize Recognize a song
-h, --help Display this help menu
Sources:
File sources:
-f, --file File path
Raw PCM sources:
-s, --seconds Chunk seconds
-r, --rate Sample rate
-c, --channels Channels
-b, --bits Bits per sample
vibra --recognize --file sample.wav > result.json
jq .track.title result.json
"Stairway To Heaven"
jq .track.subtitle result.json
"Led Zeppelin"
jq .track.share.href result.json
"https://www.shazam.com/track/5933917/stairway-to-heaven"
sox -d -t raw -b 24 -e signed-integer -r 44100 -c 1 - 2>/dev/null
| vibra --recognize --seconds 5 --rate 44100 --channels 1 --bits 24 > result.json
jq .track.title result.json
"Bound 2"
jq .track.subtitle result.json
"Kanye West"
jq .track.sections[1].text result.json
[
"B-B-B-Bound to fall in love",
"Bound to fall in love",
"(Uh-huh, honey)",
...
]
- You need to install FFmpeg on your system to decode non-WAV media files.
- Vibra will try to locate FFmpeg in your PATH environment variable. Alternatively, you can specify the FFmpeg path by setting the
FFMPEG_PATH
environment variable.
# Automatically find FFmpeg in PATH
vibra --recognize --file out.mp3
# Specify the FFmpeg path
export FFMPEG_PATH=/opt/homebrew/bin/ffmpeg
vibra --recognize --file out.mp3
- You can see the sample shazam result json file in here
- I compared the performance of vibra with the SongRec rust and python version on the Raspberry Pi 4.
- vibra is about 2 times faster than the SongRec!
- Please read wasm/readme.md to build vibra webassembly version.
- Real time music tracker and lighting solution "Mooding", which uses vibra.
- Click to view!
- vibra is licensed under the GPLv3 license. See LICENSE for more details.