Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
run: sudo apt-get install -y lcov

- name: Configure
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DVELOCILOOPS_COVERAGE=ON
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DVELOCILOOPS_ENABLE_COVERAGE=ON

- name: Build
run: cmake --build build --parallel $(nproc)
Expand All @@ -44,7 +44,7 @@ jobs:
run: |
lcov -c -d build \
--ignore-errors mismatch,unused,inconsistent,unsupported \
--include "*/src/*" \
--include "*/src/*.cpp" \
-o build/coverage.info

- name: Check Coverage
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/fuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,20 @@ jobs:
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DVELOCILOOPS_SANITIZERS=ON \
-DVELOCILOOPS_ENABLE_SANITIZERS=ON \
-DVELOCILOOPS_ENABLE_FUZZING=ON

- name: Build
run: cmake --build build-fuzz --parallel $(nproc) --target velociloops_fuzzer

- name: Fuzz
run: |
./build-fuzz/tests/velociloops_fuzzer \
tests/fuzz/ \
./build-fuzz/fuzz/velociloops_fuzzer \
-max_total_time=60 \
-max_len=980128 \
-rss_limit_mb=512 \
-entropic=0 \
fuzz/data/ \
tests/data/
env:
ASAN_OPTIONS: halt_on_error=1:detect_leaks=0
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/sanitizers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ jobs:
run: |
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Debug \
-DVELOCILOOPS_SANITIZERS=ON
-DVELOCILOOPS_ENABLE_SANITIZERS=ON

- name: Build
run: cmake --build build --parallel
run: cmake --build build --parallel $(nproc)

- name: Test
run: ctest --test-dir build --output-on-failure
run: ctest --test-dir build --parallel $(nproc) --output-on-failure
env:
ASAN_OPTIONS: halt_on_error=1:detect_leaks=1
UBSAN_OPTIONS: halt_on_error=1:print_stacktrace=1
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}

- name: Build
run: cmake --build build --config ${{ env.BUILD_TYPE }}
run: cmake --build build --config ${{ env.BUILD_TYPE }} --parallel $(nproc)

- name: Test
run: ctest --test-dir build --build-config ${{ env.BUILD_TYPE }} --output-on-failure
run: ctest --test-dir build --build-config ${{ env.BUILD_TYPE }} --parallel $(nproc) --output-on-failure
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@

# Folders
.venv/
.gitnexus/
_build/
build*/
parking/
Expand Down
34 changes: 19 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,47 +12,51 @@ option(VELOCILOOPS_ENABLE_SHARED "Build shared library" ON)
option(VELOCILOOPS_ENABLE_TESTING "Build tests" ON)
option(VELOCILOOPS_ENABLE_DEMO "Build demo" ON)

cmake_dependent_option(VELOCILOOPS_ENABLE_COVERAGE "Enable coverage" OFF
"VELOCILOOPS_ENABLE_TESTING;LCOV_EXECUTABLE;GENHTML_EXECUTABLE" OFF)

cmake_dependent_option(VELOCILOOPS_ENABLE_FUZZING
"Build libFuzzer target (requires Clang with -fsanitize=fuzzer)" OFF
"VELOCILOOPS_ENABLE_TESTING" OFF)

cmake_dependent_option(VELOCILOOPS_ENABLE_SANITIZERS
"Enable AddressSanitizer + UBSan (requires Clang or GCC)" OFF
"VELOCILOOPS_ENABLE_TESTING" OFF)

if (VELOCILOOPS_ENABLE_STATIC)
add_library(velociloops_static STATIC src/velociloops.cpp)
add_library(velociloops_static STATIC src/velociloops.cpp src/fft8g.h)
target_include_directories(velociloops_static PUBLIC include)
target_compile_features(velociloops_static PRIVATE cxx_std_17)
endif()

if (VELOCILOOPS_ENABLE_SHARED)
add_library(velociloops_shared SHARED src/velociloops.cpp)
add_library(velociloops_shared SHARED src/velociloops.cpp src/fft8g.h)
target_include_directories(velociloops_shared PUBLIC include)
target_compile_features(velociloops_shared PRIVATE cxx_std_17)
endif()

if (PROJECT_IS_TOP_LEVEL)
include(CTest)
if (VELOCILOOPS_ENABLE_TESTING)
cmake_dependent_option(VELOCILOOPS_COVERAGE "Enable coverage" OFF
"VELOCILOOPS_ENABLE_TESTING;LCOV_EXECUTABLE;GENHTML_EXECUTABLE" OFF)

if (VELOCILOOPS_COVERAGE)
if (VELOCILOOPS_ENABLE_COVERAGE)
target_compile_options(velociloops_static PRIVATE --coverage)
target_link_options(velociloops_static INTERFACE --coverage)
endif()

cmake_dependent_option(VELOCILOOPS_SANITIZERS
"Enable AddressSanitizer + UBSan (requires Clang or GCC)" OFF
"VELOCILOOPS_ENABLE_TESTING" OFF)

if (VELOCILOOPS_SANITIZERS)
if (VELOCILOOPS_ENABLE_SANITIZERS)
target_compile_options(velociloops_static PRIVATE
-fsanitize=address,undefined -fno-omit-frame-pointer -g)
target_link_options(velociloops_static INTERFACE
-fsanitize=address,undefined)
endif()

cmake_dependent_option(VELOCILOOPS_ENABLE_FUZZING
"Build libFuzzer target (requires Clang with -fsanitize=fuzzer)" OFF
"VELOCILOOPS_ENABLE_TESTING" OFF)

add_subdirectory(tests)
endif()

if (VELOCILOOPS_ENABLE_FUZZING)
add_subdirectory(fuzz)
endif()

if (VELOCILOOPS_ENABLE_DEMO)
add_subdirectory(demo)
endif()
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ exposes per-slice float audio, and supports a full read/write round-trip.
### Authoring and mutation

- **Create new RX2 files** — Build mono or stereo loops from caller-supplied float slices.
- **SuperFlux auto-slicing** — Build a save-ready loop from full-loop mono or stereo float PCM using onset detection.
- **Set file and creator metadata before writing** — Configure tempo, original tempo, time signature, bit depth, transient settings, and creator fields before adding audio.
- **Append and remove slices** — Add slices by PPQ position and remove existing slices by index.
- **Round-trip by re-encoding** — Decode existing slices to float audio, mutate metadata/slices, and save a fresh RX2 file.
Expand Down Expand Up @@ -80,6 +81,12 @@ executable.

Extracts every slice as a WAV file and performs a save/reload round-trip check.

```sh
./build/demo/velociloops tests/data/120Stereo.wav out/120Stereo_auto.rx2 120
```

Auto-slices a WAV file with SuperFlux onset detection and writes a REX2 file.

### Embed in your project

```cmake
Expand Down
Binary file added demo/amen.wav
Binary file not shown.
Loading