8000 GitHub - nuskey8/beatd: A cross-platform GUI application and library for analyzing streaming audio and converting it to OSC. · GitHub
[go: up one dir, main page]

Skip to content
nuskey8Public

About

A cross-platform GUI application and library for analyzing streaming audio and converting it to OSC.

Topics

Resources

Stars

12 stars

Watchers

0 watching

Forks

Repository files navigation

beatd

CI Release crates.io npm NuGet Unity

English | 日本語

A cross-platform GUI application and library for analyzing streaming audio and converting it to OSC.

hero

Overview

beatd is a cross-platform application and library for streaming audio analysis.

It started with the concept of being a modern reimplementation of Sound2Light, utilizing a Rust implementation to create an easy-to-use, cross-platform GUI. It can send audio analysis results via OSC to integrate with external VJ software and similar tools.

Additionally, the core analysis engine is provided as an independent library so that it can be embedded into applications for Rust, C, C# (.NET/Unity), and JavaScript (WebAssembly).

Screenshot

img

Installation

Select the latest release from GitHub Releases and download the executable file for your operating system.

macOS

The macOS build is not signed or notarized with an Apple Developer ID. On first launch, macOS may show a message such as "beatd cannot be opened because the developer cannot be verified."

To open it anyway:

  1. Right-click (or Control-click) beatd.app, choose Open, then click Open again.
  2. Or allow it from System Settings → Privacy & Security after trying to open it once.
  3. Or remove the quarantine attribute in Terminal:
xattr -dr com.apple.quarantine /Applications/beatd.app

libbeatd

The streaming audio analysis in beatd is implemented in Rust as an independent crate. By embedding this, you can use features such as BPM analysis within your applications.

Rust

Add the crate via cargo.

cargo add beatd
use beatd::Analyzer;

let mut analyzer = Analyzer::new(48_000);

// samples: &[f32] (-1.0 to 1.0)
analyzer.push(&samples);

let level = analyzer.level();
let bpm = analyzer.bpm();
let spectrum = analyzer.spectrum();
let waveform = analyzer.waveform();
let beats = analyzer.beat_offsets(bpm);

C

Build the library with the ffi feature enabled.

cargo build -p beatd --features ffi

Add the generated libbeatd.so / libbeatd.dylib / beatd.dll along with beatd/beatd.h to your project, and specify -lbeatd during linking.

#include "beatd.h"

beatd_analyzer *analyzer = beatd_new(48000);
if (analyzer == NULL) {
    return 1;
}

beatd_set_bpm_range_min(analyzer, 75);
beatd_push(analyzer, samples, count);

float level = beatd_level(analyzer);
float bpm = beatd_bpm(analyzer);

float spectrum[1024];
size_t bins = beatd_spectrum(analyzer, spectrum, 1024);

beatd_free(analyzer);

JavaScript

Add the library via npm.

npm i beatd-js
import { createAnalyzer } from "beatd-js";

using analyzer = createAnalyzer({ sampleRate: 48000 });

// samples: Float32Array
analyzer.push(samples);

console.log(analyzer.level(), analyzer.bpm());
console.log(analyzer.spectrum());
console.log(analyzer.waveform());
console.log(analyzer.beatOffsets(analyzer.bpm()));

C# / Unity

For .NET projects, you can add the package from NuGet.

dotnet package add Beatd

For Unity, you can add the package from the Package Manager using the git URL.

https://github.com/nuskey8/beatd.git?path=beatd-dotnet/Beatd.Unity/Packages/com.nuskey8.beatd.unity
using Beatd;

using var analyzer = new BeatdAnalyzer(48_000);
analyzer.BpmRangeMin = 75;

analyzer.Push(samples); // ReadOnlySpan<float>

Console.WriteLine($"{analyzer.Level}, {analyzer.Bpm}");
float[] spectrum = analyzer.GetSpectrum();
float[] beats = analyzer.GetBeatOffsets(analyzer.Bpm);

Please note that the .NET/Unity version currently supports only the following platforms:

Platform RID .NET (NuGet) Unity
Windows x64 win-x64 ✅ ✅
Windows ARM64 win-arm64 ✅ ✅
Linux x64 linux-x64 ✅ ✅
Linux ARM64 linux-arm64 ✅ ✅
macOS Intel osx-x64 ✅ ✅
macOS Apple Silicon osx-arm64 ✅ ✅

License

beatd is released under the MIT License.

About

A cross-platform GUI application and library for analyzing streaming audio and converting it to OSC.

Topics

Resources

Stars

12 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0