public inbox for [email protected]  
help / color / mirror / Atom feed
From: Susmitha S <[email protected]>
To: [email protected]
Subject: audio_similarity – simple SELECT query for audio similarity search
Date: Mon, 13 Apr 2026 15:56:19 +0530
Message-ID: <CAMEKmwCyUPKbUfz=YWE3MBwQnMmsy-PnNOSNY3zYn=oWif9iow@mail.gmail.com> (raw)

Hello PostgreSQL community,

I have been working on a small extension that adds audio similarity
search to PostgreSQL. I would like to ask for your suggestions on the
approach and the SQL interface.

IDEA:

Once audio embeddings are generated, users can find similar audio with
a simple SELECT query:


SELECT * FROM similar_audio(42, 5);


This returns the 5 most similar audio files to the file with id 42,
including similarity score, speaker name, and filename.

 How it works

- Audio files are processed using MFCC (librosa) to produce
26‑dimensional embeddings.
- Embeddings are stored using `pgvector`.
- Similarity is cosine distance with an HNSW index for speed.

What I would like your feedback on

- Is the SELECT‑based interface intuitive enough for end users?
- Are there better patterns for similarity search in PostgreSQL?
- Any performance or design pitfalls I should be aware of?

The extension currently provides these functions:

- similar_audio(id, limit)– search by audio ID
- similar_audio_by_filename(filename, limit) – search by filename
- search_similar(file_path, limit) – search by full path

Requirements

- PostgreSQL 18+ (or 17/16)
- plpython3u and pgvector
- Python 3.11 with librosa, soundfile, numpy

I have tested it on 7,595 audio files (total ~10 hours) with good
performance.

I would greatly appreciate any suggestions on improving the query
interface, indexing strategy, or embedding pipeline.

Thank you for your time.


Attachments:

  [image/png] Screenshot from 2026-04-09 12-38-30.png (44.2K, 3-Screenshot%20from%202026-04-09%2012-38-30.png)
  download | view image

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: audio_similarity – simple SELECT query for audio similarity search
  In-Reply-To: <CAMEKmwCyUPKbUfz=YWE3MBwQnMmsy-PnNOSNY3zYn=oWif9iow@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox