Skip to content

About

An acoustic music librarian AI agent that uses 33-dimensional DSP audio vectors and Neo4j graph traversals for zero-hallucination, cross-genre music recommendations.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

β–ˆβ–ˆβ•—   β–ˆβ–ˆβ•—β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•—  β–ˆβ–ˆβ•—
β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β•β•β• β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•‘
β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—  β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘
β•šβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•  β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β• β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘
 β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘     β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•‘
  β•šβ•β•β•β•  β•šβ•β•β•šβ•β•β•β•β•β• β•šβ•β•β•β•β•β•β• β•šβ•β•β•β•β•β• β•šβ•β•  β•šβ•β•β•šβ•β•  β•šβ•β•β•šβ•β•     β•šβ•β•  β•šβ•β•

An Acoustic Knowledge Graph for Context-Aware Music Intelligence

Python Neo4j librosa Dataset License


Live Deployment Judge Walkthrough


The Premise

Most music recommendation systems treat songs as rows in a database. They match tags, count streams, and recommend based on what is popular. They fundamentally cannot answer the question:

"Find me something that sounds like this β€” not what people say it sounds like, but what the audio waveform actually is."

VibeGraph AI is built on a different principle. Every track in this system has been mathematically fingerprinted using Digital Signal Processing. The result is a 33-dimensional acoustic vector β€” a precise numerical identity derived from the audio itself β€” stored inside a Neo4j Knowledge Graph alongside rich relational context.

Why 33 Dimensions?

While text embeddings (like OpenAI's) use 1536 dimensions, acoustic reality is highly orthogonal. By extracting 20 MFCCs (timbre), 12 Chroma features (harmony), and 1 Spectral Centroid (brightness), we capture the pure "Acoustic DNA" of a track.

Acoustic Feature Distributions

To prove this 33D space is sufficient, we performed unsupervised K-Means clustering on the dataset, achieving a Silhouette Score of 0.3988 and a Davies-Bouldin index of 0.91β€”mathematically validating that this compact vector perfectly separates tracks into meaningful sonic continents.

K-Means Elbow and Silhouette Analysis

The intelligence is not in the application layer. It is in the graph.

Visualizing Acoustic Continents

To see this in action, we mapped the 25,000 track 33D vectors down to 2D using t-SNE. Notice how the tracks form distinct acoustic continents based entirely on mathematical sound waves, completely ignoring human genre tags:

t-SNE Visualization of Acoustic Clusters


Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        DATA PLANE                               β”‚
β”‚                                                                 β”‚
β”‚  FMA Medium Dataset (22 GB)                                     β”‚
β”‚  25,000 MP3 files Β· Creative Commons Β· 156 Genre Dirs           β”‚
β”‚            β”‚                                                    β”‚
β”‚            β–Ό                                                    β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚   engine/pipeline   β”‚    β”‚     engine/audio_dsp         β”‚   β”‚
β”‚  β”‚                     β”‚    β”‚                              β”‚   β”‚
β”‚  β”‚  ProcessPoolExecutor│───▢│  librosa.load() β†’ 22kHz mono β”‚   β”‚
β”‚  β”‚  (12 CPU workers)   β”‚    β”‚  MFCC  Β· Chroma Β· Centroid   β”‚   β”‚
β”‚  β”‚                     β”‚    β”‚  β†’ normalize(reshape(1, -1)) β”‚   β”‚
β”‚  β”‚  crash-proof        β”‚    β”‚  β†’ 33-dim acoustic vector    β”‚   β”‚
β”‚  β”‚  checkpoint file    β”‚    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                β”‚                      β”‚
β”‚            β”‚                            β”‚                      β”‚
β”‚            β–Ό                            β–Ό                      β”‚
β”‚       data/staging/              data/staging/                 β”‚
β”‚       batch_XYZ.json  ◀──────── batch_XYZ.json                 β”‚
β”‚            β”‚                                                    β”‚
β”‚            β–Ό                                                    β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                                       β”‚
β”‚  β”‚  engine/ingest_      β”‚  UNWIND atomic transactions          β”‚
β”‚  β”‚  staging.py          β”‚  β†’ 100 tracks per batch              β”‚
β”‚  β”‚                      β”‚  β†’ Constraints + Vector Index setup  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                               β”‚
                               β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    KNOWLEDGE GRAPH (Neo4j Aura)                 β”‚
β”‚                                                                 β”‚
β”‚    (Artist)◄─────PERFORMED_BY──────(Track)──IN_GENRE──►(Genre) β”‚
β”‚                                       β”‚                        β”‚
β”‚                                       β”‚ audioEmbedding: [33D]  β”‚
β”‚                                       β”‚ sonicTraits: [...]     β”‚
β”‚                                       β”‚                        β”‚
β”‚                                   VECTOR INDEX                  β”‚
β”‚                              track_embedding                    β”‚
β”‚                           cosine similarity Β· 33D              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Graph Schema

Below is an actual visual representation of the VibeGraph database in Neo4j, showing how Tracks connect to their respective Genres and Artists:

Neo4j Knowledge Graph Visualization

Nodes

Label Key Properties Description
Track id, title, audioEmbedding[33], sonicTraits[] Core acoustic entity with normalized DSP vector
Artist name Unique artist identity node
Genre name Hierarchical genre classification

Relationships

Relationship Pattern Semantic Meaning
PERFORMED_BY (Track)β†’(Artist) Authorship provenance
IN_GENRE (Track)β†’(Genre) Genre classification
SOUNDS_LIKE (Track)β†’(Track) Nearest neighbor acoustic similarity (Top 5 per track)

Graph Scale

Tracks Seeded   : 24,985
Artists Mapped  : 5,533
Genres Indexed  : 871
Vector Index    : ONLINE (cosine, 33D)

The Aura Agent Configuration

This graph was purpose-built for the Neo4j Aura Agent Builder. By equipping an LLM with access to this graph, we create an intelligent audio librarian capable of true semantic music discovery.

Configured Tools

  1. Similarity Search: Pointed at the track_embedding vector index. Allows the LLM to instantly search the 33D acoustic space.
  2. Text2Cypher: Allows the LLM to traverse the graph (e.g., filtering by Genre or finding Artists).
  3. Acoustic Landscape Analyzer: A custom Cypher template that answers meta-questions like "What does the Folk genre actually sound like mathematically?" by aggregating sonicTraits across nodes connected to a specific Genre node.
  4. Sonic Bridge Builder: Uses shortest-path graph traversal over pre-computed [:SOUNDS_LIKE] edges to build gradient transition playlists between two acoustically dissimilar tracks.

Example Agent Conversation: Multi-Hop Acoustic Reasoning

User:

"I love the track 'Food' by AWOL (Track ID: 000002). It has this raw, gritty vibe β€” but I want something with that same sonic feel in the Electronic genre."

Aura Agent (Reasoning Chain):

  1. Text2Cypher: Queries the graph for (:Track {id: "000002"}) to retrieve the node and its audioEmbedding property.
  2. Similarity Search: Queries the track_embedding vector index using that embedding, returning the top 50 nearest neighbors by cosine similarity.
  3. Graph Traversal: Filters the 50 results by traversing (Track)-[:IN_GENRE]->(Genre {name: "Electronic"}).
  4. Text2Cypher: Retrieves the artist name by traversing (Track)-[:PERFORMED_BY]->(Artist) for the final candidate.

Aura Agent Response (Illustrative example of multi-hop output):

"Here's a match you might love β€” 'Bad Carnival Acid' by Illusion of Safety (Track ID: 000878). It lives in the Electronic genre and shares a strikingly similar harmonic footprint and timbral texture to 'Food'. That gritty, raw sonic character carries across β€” just with a different sonic coat."

Agent Capabilities In Action

Agent Search and Traversal 1 Agent Search and Traversal 2


The Application Layer (Frontend)

To interact with the Neo4j Aura Agent, we built a premium, brutalist web application heavily inspired by audiophile equipment (specifically Marshall Amplification aesthetics).

  • Framework: Next.js 16 (App Router)
  • Styling: Tailwind CSS v4 with fluid typography (clamp()) for HiDPI scaling
  • Animation: Framer Motion for seamless, SPA-like transitions between the landing hero and the chat interface without hard reloads
  • Integration: A secure backend API route (/api/agent/route.ts) handles OAuth2 token caching and securely proxies chat requests to the Neo4j Agent, keeping client credentials safe from the browser.

Acoustic Feature Engineering

Each track is decomposed into three orthogonal acoustic dimensions:

1. Timbral Envelope β€” 20 Dimensions

Mel-Frequency Cepstral Coefficients (MFCCs) Captures the texture and timbre of the sound β€” the difference between a piano and a guitar playing the same note. Computed across the entire 30-second clip and time-averaged into a single feature vector.

2. Harmonic Footprint β€” 12 Dimensions

Chroma STFT Maps energy distribution across the 12 musical pitch classes (C, C#, D, D#, ..., B). Two tracks sharing the same harmonic footprint are likely in the same key signature and will be perceived as acoustically compatible.

3. Spectral Brightness β€” 1 Dimension

Spectral Centroid The "center of mass" of the frequency spectrum. Tracks above the 2500 Hz threshold are classified as is_bright: true β€” a proxy for perceived brightness and energy. Heavy rock, electronic, and pop tracks typically score high. Ambient and folk tracks score low.

Vector Normalization

All three feature arrays are concatenated into a raw 33-dimensional array and L2-normalized using sklearn.preprocessing.normalize. This projects every track onto a unit hypersphere, making cosine similarity the ideal distance metric for cross-genre comparison.


Dataset Provenance

This project uses the Free Music Archive (FMA) Medium dataset.

Defferrard, M., Benzi, K., Vandergheynst, P., & Bresson, X.
"FMA: A Dataset for Music Analysis"
18th International Society for Music Information Retrieval Conference (ISMIR), 2017.
Property Value
Source Free Music Archive (FMA)
Tier fma_medium
Track Count 25,000
Duration 30s clips
Audio License Creative Commons (various)
Metadata License CC BY 4.0

πŸ’Ύ Download the Vector Dataset: We have open-sourced the pre-computed 33D acoustic vectors to save the community hundreds of hours of DSP compute time. Available now on Kaggle.

The metadata folder contains raw_tracks.csv which cross-references each numeric MP3 file ID to its artist name, title, and genre classification. The pipeline joins on the 6-digit zero-padded track ID (e.g., 000002.mp3 β†’ Track ID 000002).


Running the ETL Pipeline

Prerequisites

# 1. Clone repository
git clone https://github.com/shivam/vibegraph-ai
cd vibegraph-ai

# 2. Create and activate virtual environment
python -m venv venv
source venv/bin/activate

# 3. Install dependencies
pip install -r requirements.txt

Configuration

Create a .env file in the project root:

NEO4J_URI=neo4j+s://<your-aura-instance>.databases.neo4j.io
NEO4J_USERNAME=neo4j
NEO4J_PASSWORD=<your-password>
NEO4J_DATABASE=neo4j

Data Setup

Download and extract the FMA dataset into the data/ directory:

data/
β”œβ”€β”€ fma_medium/          ← Extract fma_medium.zip here
β”‚   β”œβ”€β”€ 000/
β”‚   β”œβ”€β”€ 001/
β”‚   └── ...
└── fma_metadata/        ← Extract fma_metadata.zip here
    β”œβ”€β”€ raw_tracks.csv
    └── ...

Execution

# Step 1: Extract acoustic features from all 25,000 MP3s locally
PYTHONPATH=. ./venv/bin/python engine/pipeline.py

# Step 2: Upload the acoustic knowledge graph to Neo4j Aura
PYTHONPATH=. ./venv/bin/python engine/ingest_staging.py

# Step 3: Verify graph integrity and vector index status
PYTHONPATH=. ./venv/bin/python engine/verify_db.py

Requirements

neo4j
python-dotenv
librosa
numpy
scikit-learn
pandas
httpx

License

The source code in this repository is released under the MIT License.

All acoustic vectors and derived metadata originate from the FMA Medium Dataset and are shared under Creative Commons CC BY 4.0, with attribution to Defferrard et al. (2017). The raw audio files are not included or redistributed.


Model Context Protocol (MCP) Integration

The VibeGraph AI Agent can be used as an MCP Server, allowing you to integrate the acoustic graph directly into Cursor or Claude Desktop.

If you have your Agent's MCP connection URL, you can configure it using the well-formatted JSON block below.

For Cursor (.cursor/mcp.json) or Claude Desktop (claude_desktop_config.json)

{
  "mcpServers": {
    "VibeGraphAI": {
      "command": "node",
      "args": [
        "path/to/mcp-proxy",
        "--url",
        "https://<YOUR_NEO4J_AURA_AGENT_MCP_LINK>"
      ],
      "env": {
        "NEO4J_AGENT_CLIENT_ID": "your-client-id",
        "NEO4J_AGENT_CLIENT_SECRET": "your-client-secret"
      }
    }
  }
}

(Note: Replace the URL and credentials with your specific Aura Agent MCP details. If your client supports native SSE URLs, you can supply the URL directly instead of using a proxy command).


Built for the Neo4j Aura Agent Hackathon 2026

About

An acoustic music librarian AI agent that uses 33-dimensional DSP audio vectors and Neo4j graph traversals for zero-hallucination, cross-genre music recommendations.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages