beatd-js 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2026 Yusuke Nakada
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,149 @@
1
+ # beatd
2
+
3
+ [![CI](https://github.com/nuskey8/beatd/actions/workflows/ci.yml/badge.svg)](https://github.com/nuskey8/beatd/avctions/workflows/ci.yml)
4
+ [![Release](https://img.shields.io/github/v/release/nuskey8/beatd)](https://github.com/nuskey8/beatd/releases/latest)
5
+ [![crates.io](https://img.shields.io/crates/v/beatd)](https://crates.io/crates/beatd)
6
+ [![npm](https://img.shields.io/npm/v/beatd-js)](https://www.npmjs.com/package/beatd-js)
7
+ [![NuGet](https://img.shields.io/nuget/v/Beatd)](https://www.nuget.org/packages/Beatd)
8
+ [![Unity](https://img.shields.io/badge/Unity-6000.0%2B-black?logo=unity)](https://github.com/nuskey8/beatd/tree/main/beatd-dotnet/Beatd.Unity/Packages/com.nuskey8.beatd.unity)
9
+
10
+ English | [日本語](https://github.com/nuskey8/beatd/blob/main/README.ja.md)
11
+
12
+ GUI application and library for streaming audio analysis and OSC conversion.
13
+
14
+ ![hero](https://raw.githubusercontent.com/nuskey8/beatd/main/assets/hero.png)
15
+
16
+ ## Overview
17
+
18
+ beatd is a cross-platform application and library for streaming audio analysis.
19
+
20
+ It started with the concept of being a modern reimplementation of [Sound2Light](https://github.com/ETCLabs/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.
21
+
22
+ 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).
23
+
24
+ ## Screenshot
25
+
26
+ ![img](https://raw.githubusercontent.com/nuskey8/beatd/main/assets/img1.png)
27
+
28
+ ## Installation
29
+
30
+ Select the latest release from GitHub [Releases](https://github.com/nuskey8/beatd/releases/latest) and download the executable file for your operating system.
31
+
32
+ ## libbeatd
33
+
34
+ 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.
35
+
36
+ ### Rust
37
+
38
+ Add the crate via cargo.
39
+
40
+ ```sh
41
+ cargo add beatd
42
+ ```
43
+
44
+ ```rust
45
+ use beatd::Analyzer;
46
+
47
+ let mut analyzer = Analyzer::new(48_000);
48
+
49
+ // samples: &[f32] (-1.0 to 1.0)
50
+ analyzer.push(&samples);
51
+
52
+ let level = analyzer.level();
53
+ let bpm = analyzer.bpm();
54
+ let spectrum = analyzer.spectrum();
55
+ let waveform = analyzer.waveform();
56
+ let beats = analyzer.beat_offsets(bpm);
57
+ ```
58
+
59
+ ### C
60
+
61
+ Build the library with the `ffi` feature enabled.
62
+
63
+ ```sh
64
+ cargo build -p beatd --features ffi
65
+ ```
66
+
67
+ Add the generated `libbeatd.so` / `libbeatd.dylib` / `beatd.dll` along with `beatd/beatd.h` to your project, and specify `-lbeatd` during linking.
68
+
69
+ ```c
70
+ #include "beatd.h"
71
+
72
+ beatd_analyzer *analyzer = beatd_new(48000);
73
+ if (analyzer == NULL) {
74
+ return 1;
75
+ }
76
+
77
+ beatd_set_bpm_range_min(analyzer, 75);
78
+ beatd_push(analyzer, samples, count);
79
+
80
+ float level = beatd_level(analyzer);
81
+ float bpm = beatd_bpm(analyzer);
82
+
83
+ float spectrum[1024];
84
+ size_t bins = beatd_spectrum(analyzer, spectrum, 1024);
85
+
86
+ beatd_free(analyzer);
87
+ ```
88
+
89
+ ### JavaScript
90
+
91
+ Add the library via npm.
92
+
93
+ ```sh
94
+ npm i beatd-js
95
+ ```
96
+
97
+ ```js
98
+ import { createAnalyzer } from "beatd-js";
99
+
100
+ using analyzer = createAnalyzer({ sampleRate: 48000 });
101
+
102
+ // samples: Float32Array
103
+ analyzer.push(samples);
104
+
105
+ console.log(analyzer.level(), analyzer.bpm());
106
+ console.log(analyzer.spectrum());
107
+ console.log(analyzer.waveform());
108
+ console.log(analyzer.beatOffsets(analyzer.bpm()));
109
+ ```
110
+
111
+ ### C# / Unity
112
+
113
+ For .NET projects, you can add the package from NuGet.
114
+
115
+ ```sh
116
+ dotnet package add Beatd
117
+ ```
118
+
119
+ For Unity, you can add the package from the Package Manager using the git URL.
120
+
121
+ ```
122
+ https://github.com/nuskey8/beatd.git?path=beatd-dotnet/Beatd.Unity/Packages/com.nuskey8.beatd.unity
123
+ ```
124
+
125
+ ```csharp
126
+ using Beatd;
127
+
128
+ using var analyzer = new BeatdAnalyzer(48_000);
129
+ analyzer.BpmRangeMin = 75;
130
+
131
+ analyzer.Push(samples); // ReadOnlySpan<float>
132
+
133
+ Console.WriteLine($"{analyzer.Level}, {analyzer.Bpm}");
134
+ float[] spectrum = analyzer.GetSpectrum();
135
+ float[] beats = analyzer.GetBeatOffsets(analyzer.Bpm);
136
+ ```
137
+
138
+ Please note that the .NET/Unity version currently supports only the following platforms:
139
+
140
+ | Platform | RID | .NET (NuGet) | Unity |
141
+ | :------------------ | :---------- | :----------: | :---: |
142
+ | Windows x64 | `win-x64` | ✅ | ✅ |
143
+ | Linux x64 | `linux-x64` | ✅ | ✅ |
144
+ | macOS Intel | `osx-x64` | ✅ | ✅ |
145
+ | macOS Apple Silicon | `osx-arm64` | ✅ | ✅ |
146
+
147
+ ## License
148
+
149
+ beatd is released under the [MIT License](https://github.com/nuskey8/beatd/blob/main/LICENSE).
@@ -1,5 +1,12 @@
1
1
  # beatd
2
2
 
3
+ [![CI](https://github.com/nuskey8/beatd/actions/workflows/ci.yml/badge.svg)](https://github.com/nuskey8/beatd/avctions/workflows/ci.yml)
4
+ [![Release](https://img.shields.io/github/v/release/nuskey8/beatd)](https://github.com/nuskey8/beatd/releases/latest)
5
+ [![crates.io](https://img.shields.io/crates/v/beatd)](https://crates.io/crates/beatd)
6
+ [![npm](https://img.shields.io/npm/v/beatd-js)](https://www.npmjs.com/package/beatd-js)
7
+ [![NuGet](https://img.shields.io/nuget/v/Beatd)](https://www.nuget.org/packages/Beatd)
8
+ [![Unity](https://img.shields.io/badge/Unity-6000.0%2B-black?logo=unity)](https://github.com/nuskey8/beatd/tree/main/beatd-dotnet/Beatd.Unity/Packages/com.nuskey8.beatd.unity)
9
+
3
10
  English | [日本語](https://github.com/nuskey8/beatd/blob/main/README.ja.md)
4
11
 
5
12
  GUI application and library for streaming audio analysis and OSC conversion.
Binary file
@@ -2,7 +2,7 @@
2
2
  "name": "beatd",
3
3
  "type": "module",
4
4
  "description": "A cross-platform library for Streaming audio analysis.",
5
- "version": "0.0.1",
5
+ "version": "0.1.0",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
@@ -26,4 +26,4 @@
26
26
  "fft",
27
27
  "wasm"
28
28
  ]
29
- }
29
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "beatd-js",
3
- "version": "0.0.1",
3
+ "version": "0.1.0",
4
4
  "description": "beatd bindings for JavaScript",
5
5
  "license": "MIT",
6
6
  "author": "nuskey",