Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

deej‑ai.cpp

A C++ implementation for inference of Deej‑AI models using ONNX Runtime.

Overview

deej‑ai.cpp is designed to be portable so the onnx runtime is bundled in the build. Running CMake will download Eigen and the prebuild ONNX Runtime. The only external requirement is the ffmpeg executable. The playlist generation is much faster than the python version, the scan is also quite faster.

Prerequisites

  • C++20
  • CMake ≥ 3.15
  • Ninja
  • ffmpeg

Quick Start

Build

Linux:

git clone https://github.com/StergiosBinopoulos/deej-ai.cpp
cd deej-ai.cpp
cmake -B build -G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release
ninja -C build deej-ai

MacOS (Universal):

cmake -B build -G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
ninja -C build deej-ai

On Windows I suggest using MinGW and gcc:

cmake -B build -G Ninja -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release
ninja -C build deej-ai

To get a portable package build the package target instead:

ninja -C build package

The bundle is exported in the package folder. Use target package_zip to also zip the output.

Windows static build

To build statically on Windows, you will need Visual Studio 2022 and Git Bash. Open Git Bash, navigate to the root directory, and run the following commands:

git clone https://github.com/supertone-inc/onnxruntime-build.git onnxruntime-build
cd onnxruntime-build
git checkout v1.22.2
./build-static_lib.sh
cd ..

after the onnxruntime static library build is completed you can configure the project and build:

cmake -B build_static -G "Visual Studio 17 2022" -DSTATIC_BUILD=ON
cmake --build build_static --target deej-ai --config Release
# or 
# cmake --build build_static --target package --config Release

Download a model

You can download a ready to go ONNX deej-ai model or use the scipts in the Deej-AI repository to convert your existing model to ONNX.

curl -L https://huggingface.co/StergiosBinopoulos/deej-ai.onnx/resolve/main/deej-ai.onnx?download=true --output deej-ai.onnx

Make sure you have ffmpeg installed

sudo apt update
sudo apt install ffmpeg

If you are using Windows, download ffmpeg and add it to your PATH, or specify your ffmpeg executable path by using the --ffmpeg argument.

Usage

Scan your Libary

Scan your music folder(s). Replace <music_folder> with the folder you like to scan. Adjust the name of the vectors directory accordingly.

build/bin/deej-ai --model deej-ai.onnx --scan <music_folder_1> --scan <music_folder_2> --vec-dir test_folder

Generate a Playlist.

Example 1: Append 15 songs at the end of the input. (This will print the output)

  build/bin/deej-ai --generate append --input <path_of_song_1> --input <path_of_song_2> ... --nsongs 15 --vec-dir test_folder

To save the output in m3u file use --m3u-out or -o:

  build/bin/deej-ai --generate append --input <path_of_song_1> --input <path_of_song_2> ... --nsongs 15 --vec-dir test_folder --m3u-out playlist.m3u

Example 2: Connect your input songs with 6 songs inbetween them:

  build/bin/deej-ai --generate connect --input <path_of_song_1> --input <path_of_song_2> --nsongs 6 --vec-dir test_folder

Example 3: Append 20 songs. Only determine the playlist from the original cluster of input songs.

  build/bin/deej-ai --generate cluster --input <path_of_song_1> --input <path_of_song_2> --nsongs 20 --vec-dir test_folder

Example 4: Reorder an existing playlist to improve the listening experience.

  build/bin/deej-ai --reorder --input <path_of_song_1> --input <path_of_song_2> ... --first <path_of_song_1>

Use -h to view all options:

build/bin/deej-ai -h

About

A C++ implementation for inference of Deej‑AI models using ONNX Runtime.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages