A mobile application that identifies songs from microphone input using audio fingerprinting techniques.
I built FindMySong to explore how audio recognition systems work internally. Applications like Shazam appear like magic from the outside, and I wanted to understand the underlying mechanisms by implementing a simplified version myself.
This project focuses on learning and experimentation, it has no intention of being a commercial tool.
At a high level, the idea is to turn audio into a compact representation that can be matched efficiently.
Instead of comparing raw audio, the system extracts distinctive patterns from a recording and converts them into a set of fingerprints. These fingerprints capture the structure of the sound in a way that remains stable even if the recording conditions are noisy.
When a new audio sample is recorded, the same process is applied to generate its fingerprints. These are then compared against a database of previously stored fingerprints from known tracks.
If a strong match is found, the corresponding song is returned. Otherwise, the system can reject the input and return no result.
- Easy one-line command for indexing process
- Real-time audio recognition from phone
- Generates fingerprints from recorded input
- Matches input against a stored database of pre-indexed tracks
- Returns the most likely song match
- Simple and clean mobile interface
- App can do offline recording and retrieve results automatically when internet is available
- Quick matching and pretty high accuracy. It can reliably detect most of my tests in under 5 seconds. If the input is noisy it can take longer.
- The system includes a rejection mechanism that avoids false matches by returning no result when confidence is low or the track is not present in the database.
This project is not intended to compete with production systems.
- It uses a limited personal dataset (800 tracks)
- It can be sensitive to background noise and recording quality
- Matching accuracy varies depending on input conditions
- The indexing process can be compute heavy and take some time
The goal was to understand how the system works and not worry about optimisations, and large-scale deployment.
- Languages: Python, Kotlin
- Audio processing:
numpy,audiofile,pyfftw - Android Libraries:
Hilt,Jetpack Compose,Retrofit,Gson,WorkManager - Databases: PostgreSQL
- Improve robustness against noise
- Explore more advanced fingerprinting techniques
- Test it on a larger scale database (thousands of tracks)
- Create a user interface for the server to ease testing, and indexing
First, clone the repo then follow these steps to run the app
-
Install PostgreSQL on your system if you don't have it
-
Navigate to the backend folder, go to
database/config.pyand configure your database parameters -
Start indexing your library. In the backend folder run this command:
python -m indexing.index_songs _library_dir_ -m MAXIMUM_TRACK_LENGTH_IN_SECONDS -w NUMBER_OF_WORKERS -pt
> Note: The-m,-wand-ptmodifiers are optional.-ptjust makes it output a pretty table to report results -
Run the server
uvicorn api.server:app --reload --host 0.0.0.0 -
Now the server is running and ready to respond to recognition requests
- Open the
androidfolder on Android Studio and install all the dependencies - Navigate to the
network/constants.ktfile and edit theIPandPORTto match your computer's ip address and the server's port (obviously they should be connected to the same local network) - Build and run on a device with mic access
- Start matching on any playing song and it should work
- To test offline recognition, turn off Wifi and start the recognition process until it saves the recording
- Close the app, turn on Wifi and you should see it return the results
If you find this topic interesting, you can check these sources as they provided me with the necessary details to implement this project.


