Search⌘ K
AI Features

Storing Audio and Metadata Embeddings to Vector Database

Explore how to set up a persistent Chroma client and create collections for metadata and audio embeddings. Learn to add song details and embeddings to these collections, enabling effective storage for similarity-based music recommendations.

We’ll use Chroma DB to store our embeddings. Let’s jump right in.

Create a chroma client

First, we import chromadb and initialize a persistent Chroma client. This setup ensures that the database is saved and loaded on our local machine, with data being automatically persisted and reloaded upon startup if it exists.

Python 3.10.4
import chromadb
client = chromadb.PersistentClient(path="/usr/local/musicRecommendationSystemDir/database")
...