An audio recognition webapp built with Go, Gin, PostgreSQL, Redis, and FFmpeg that identifies songs using advanced digital signal processing techniques.
- Audio Fingerprinting Algorithm: Converts spectral peaks into compact 32-bit hashes using frequency pairs and time deltas
- Song Identification: 100ms timing tolerance for accurate recognition
- Hybrid Storage System: Redis for real-time fingerprint lookups and PostgreSQL for song metadata
- Performance Optimized: Downsampling and frequency range restriction (20Hz–5kHz) for enhanced signal-to-noise ratio (SNR)
- YouTube Integration: Fetch song information and metadata from YouTube API
- Backend: Go with Gin framework
- Databases: PostgreSQL (metadata), Redis (fingerprint storage)
- Audio Processing: FFmpeg for handling audio files
- APIs: YouTube Data API v3
- Go 1.19 or higher
- PostgreSQL
- Redis
- FFmpeg
- ytdlp
-
Clone the repository
git clone https://github.com/omcarr/Gozam.git cd gozam -
Install Go dependencies
cd server go mod download -
Install client dependencies
cd client npm install -
Set up your environment variables by creating a
.envfile:redisURL="" ytApiKey="" postgresURL="" ytBaseURL=""
-
Start the server:
cd server go run main.go -
Start the client (in a separate terminal):
cd client npm run dev -
Open your browser and navigate to the client URL (
http://localhost:3000)
- Audio Processing: Upload or record audio samples
- Fingerprinting: The system extracts spectral peaks and converts them to 32-bit hashes
- Matching: Compares fingerprints against the database using frequency pairs and time deltas
- Identification: Returns matching songs with metadata from PostgreSQL
The audio fingerprinting algorithm is based on research in digital signal processing:
- Spectral Peak Extraction: Identifies prominent frequency peaks in audio spectrograms
- Hash Generation: Creates compact 32-bit fingerprints using frequency pairs and time offsets
- Time Delta Matching: Provides robust identification with 100ms timing tolerance
- Frequency Range Optimization: Focuses on 20Hz–5kHz range for optimal signal-to-noise ratio
For a deeper understanding of the algorithm:
Description: Register a new song or playlist in the database with its audio fingerprints. (only support for yt links for now. Will extend to spotify in future)
Request:
{
"url": "https://www.youtube.com/playlist?list=PLWmBFjd0O0lKObLmy6vdUBL5FVKxZCUIP"
}Response (Success):
{
"message": "Song successfully registered and downloaded"
}Response (Error):
{
"status": "error",
"message": "Failed to process audio file",
"error": "detailed_error_message"
}Description: Find matching songs from an audio sample
Request:
{
"audio_file": "base64_encoded_audio_data"
}Response (Match Found):
{
"status": "success",
"matches": [
"matches": [
{
"SongID": 2274099950,
"SongTitle": "Teri Ore",
"SongArtist": "Pritam - Topic",
"YouTubeID": "fa4l-vJ_5ic",
"Timestamp": 23,
"Score": 32004000
},
]Response (Error):
{
"status": "error",
"message": "Failed to process audio",
"error": "Audio file format not supported"
}This project is licensed under the MIT License - see the LICENSE file for details.