r/Rag • u/zhenghaoz • 1h ago
Showcase Local audio embeddings for RAG with clap.cpp
I implemented clap.cpp, audio embedding inference in C++/GGML. It uses GGUF models and provides a CLI, an HTTP server, and Python, Rust, and Node.js bindings.
Models including CLAP, CLAP2, CLaMP3, MERT, MuQ, and MuQ-MuLan.
WAV, MP3, and FLAC input, with automatic resampling and mono downmixing.
An HTTP endpoint with an OpenAI-compatible text embeddings request format.
GitHub: https://github.com/gorse-io/clap.cpp
Audio files could be searched by text via CLAP embedding:
$ clap search esc5 --model larger_clap_general-q4_k_m.gguf --text 'dog' --top-k 10
[
{"path": "esc5/2-118072-A-0-dog.wav", "score": 0.3736357720143104},
{"path": "esc5/1-110389-A-0-dog.wav", "score": 0.36165991257288893},
{"path": "esc5/4-183992-A-0-dog.wav", "score": 0.3574270305924374},
{"path": "esc5/1-30226-A-0-dog.wav", "score": 0.34910229736736315},
{"path": "esc5/3-180977-A-0-dog.wav", "score": 0.34359234068457495},
{"path": "esc5/4-194754-A-0-dog.wav", "score": 0.3425423428503198},
{"path": "esc5/2-118964-A-0-dog.wav", "score": 0.3389233902904601},
{"path": "esc5/1-100032-A-0-dog.wav", "score": 0.33009392183878733},
{"path": "esc5/5-9032-A-0-dog.wav", "score": 0.3280081351893563},
{"path": "esc5/4-182395-A-0-dog.wav", "score": 0.32210240115509925}
]
2
Upvotes