@libraz/libsonare 1.0.0 → 1.0.2
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/README.md +47 -22
- package/README.npm.md +47 -22
- package/dist/sonare.js +2 -4056
- package/dist/sonare.wasm +0 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,26 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/libraz/libsonare/actions)
|
|
4
4
|
[](https://www.npmjs.com/package/@libraz/libsonare)
|
|
5
|
-
[](https://pypi.org/project/libsonare/)
|
|
6
6
|
[](https://github.com/libraz/libsonare/blob/main/LICENSE)
|
|
7
|
-
[](https://en.cppreference.com/w/cpp/17)
|
|
8
7
|
|
|
9
|
-
Fast, dependency-free audio analysis library for browser and Node.js via WebAssembly. A librosa-like API for music information retrieval.
|
|
8
|
+
Fast, dependency-free audio analysis library for browser and Node.js via WebAssembly. A librosa-like API for music information retrieval -- **tens of times faster** than Python.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @libraz/libsonare
|
|
14
|
+
```
|
|
10
15
|
|
|
11
16
|
## Usage
|
|
12
17
|
|
|
13
18
|
```typescript
|
|
14
|
-
import { init, detectBpm, detectKey, analyze } from '@libraz/libsonare';
|
|
19
|
+
import { init, detectBpm, detectKey, analyze, Audio } from '@libraz/libsonare';
|
|
15
20
|
|
|
16
21
|
await init();
|
|
17
22
|
|
|
18
|
-
//
|
|
19
|
-
const
|
|
20
|
-
|
|
23
|
+
// Function API
|
|
24
|
+
const bpm = detectBpm(samples, sampleRate);
|
|
25
|
+
const key = detectKey(samples, sampleRate);
|
|
26
|
+
const result = analyze(samples, sampleRate);
|
|
27
|
+
console.log(`BPM: ${result.bpm}, Key: ${result.key.name}`);
|
|
21
28
|
|
|
22
|
-
//
|
|
23
|
-
const
|
|
24
|
-
|
|
29
|
+
// Audio class API
|
|
30
|
+
const audio = Audio.fromBuffer(samples, sampleRate);
|
|
31
|
+
console.log(`BPM: ${audio.detectBpm()}`);
|
|
32
|
+
console.log(`Key: ${audio.detectKey().name}`);
|
|
25
33
|
```
|
|
26
34
|
|
|
27
35
|
### Browser (CDN)
|
|
@@ -35,7 +43,7 @@ const key = detectKey(audioBuffer, sampleRate);
|
|
|
35
43
|
</script>
|
|
36
44
|
```
|
|
37
45
|
|
|
38
|
-
### Bundlers (
|
|
46
|
+
### Bundlers (Vite, webpack, Next.js, etc.)
|
|
39
47
|
|
|
40
48
|
If your bundler doesn't automatically resolve the `.wasm` file, specify its path:
|
|
41
49
|
|
|
@@ -46,19 +54,36 @@ import { init } from '@libraz/libsonare';
|
|
|
46
54
|
await init({ wasmPath: wasmUrl });
|
|
47
55
|
```
|
|
48
56
|
|
|
57
|
+
### Real-time Streaming
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
import { init, StreamAnalyzer } from '@libraz/libsonare';
|
|
61
|
+
|
|
62
|
+
await init();
|
|
63
|
+
|
|
64
|
+
const analyzer = new StreamAnalyzer({ sampleRate: 44100 });
|
|
65
|
+
|
|
66
|
+
// In audio processing callback
|
|
67
|
+
analyzer.process(audioChunk);
|
|
68
|
+
|
|
69
|
+
const stats = analyzer.stats();
|
|
70
|
+
console.log(`BPM: ${stats.estimate.bpm}, Key: ${stats.estimate.key}`);
|
|
71
|
+
```
|
|
72
|
+
|
|
49
73
|
## Features
|
|
50
74
|
|
|
51
|
-
- BPM
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
75
|
+
- **Detection**: BPM, key, beats, onsets, chords, sections
|
|
76
|
+
- **Effects**: HPSS, time stretch, pitch shift, normalize, trim
|
|
77
|
+
- **Features**: STFT, mel spectrogram, MFCC, chroma, CQT/VQT, spectral features
|
|
78
|
+
- **Pitch**: YIN, pYIN algorithms
|
|
79
|
+
- **Streaming**: Real-time analysis with progressive estimates
|
|
80
|
+
- **Conversions**: Hz/mel/MIDI/note, frames/time, resample
|
|
81
|
+
|
|
82
|
+
## Also available
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
pip install libsonare # Python bindings with CLI
|
|
86
|
+
```
|
|
62
87
|
|
|
63
88
|
## License
|
|
64
89
|
|
package/README.npm.md
CHANGED
|
@@ -2,26 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/libraz/libsonare/actions)
|
|
4
4
|
[](https://www.npmjs.com/package/@libraz/libsonare)
|
|
5
|
-
[](https://pypi.org/project/libsonare/)
|
|
6
6
|
[](https://github.com/libraz/libsonare/blob/main/LICENSE)
|
|
7
|
-
[](https://en.cppreference.com/w/cpp/17)
|
|
8
7
|
|
|
9
|
-
Fast, dependency-free audio analysis library for browser and Node.js via WebAssembly. A librosa-like API for music information retrieval.
|
|
8
|
+
Fast, dependency-free audio analysis library for browser and Node.js via WebAssembly. A librosa-like API for music information retrieval -- **tens of times faster** than Python.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @libraz/libsonare
|
|
14
|
+
```
|
|
10
15
|
|
|
11
16
|
## Usage
|
|
12
17
|
|
|
13
18
|
```typescript
|
|
14
|
-
import { init, detectBpm, detectKey, analyze } from '@libraz/libsonare';
|
|
19
|
+
import { init, detectBpm, detectKey, analyze, Audio } from '@libraz/libsonare';
|
|
15
20
|
|
|
16
21
|
await init();
|
|
17
22
|
|
|
18
|
-
//
|
|
19
|
-
const
|
|
20
|
-
|
|
23
|
+
// Function API
|
|
24
|
+
const bpm = detectBpm(samples, sampleRate);
|
|
25
|
+
const key = detectKey(samples, sampleRate);
|
|
26
|
+
const result = analyze(samples, sampleRate);
|
|
27
|
+
console.log(`BPM: ${result.bpm}, Key: ${result.key.name}`);
|
|
21
28
|
|
|
22
|
-
//
|
|
23
|
-
const
|
|
24
|
-
|
|
29
|
+
// Audio class API
|
|
30
|
+
const audio = Audio.fromBuffer(samples, sampleRate);
|
|
31
|
+
console.log(`BPM: ${audio.detectBpm()}`);
|
|
32
|
+
console.log(`Key: ${audio.detectKey().name}`);
|
|
25
33
|
```
|
|
26
34
|
|
|
27
35
|
### Browser (CDN)
|
|
@@ -35,7 +43,7 @@ const key = detectKey(audioBuffer, sampleRate);
|
|
|
35
43
|
</script>
|
|
36
44
|
```
|
|
37
45
|
|
|
38
|
-
### Bundlers (
|
|
46
|
+
### Bundlers (Vite, webpack, Next.js, etc.)
|
|
39
47
|
|
|
40
48
|
If your bundler doesn't automatically resolve the `.wasm` file, specify its path:
|
|
41
49
|
|
|
@@ -46,19 +54,36 @@ import { init } from '@libraz/libsonare';
|
|
|
46
54
|
await init({ wasmPath: wasmUrl });
|
|
47
55
|
```
|
|
48
56
|
|
|
57
|
+
### Real-time Streaming
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
import { init, StreamAnalyzer } from '@libraz/libsonare';
|
|
61
|
+
|
|
62
|
+
await init();
|
|
63
|
+
|
|
64
|
+
const analyzer = new StreamAnalyzer({ sampleRate: 44100 });
|
|
65
|
+
|
|
66
|
+
// In audio processing callback
|
|
67
|
+
analyzer.process(audioChunk);
|
|
68
|
+
|
|
69
|
+
const stats = analyzer.stats();
|
|
70
|
+
console.log(`BPM: ${stats.estimate.bpm}, Key: ${stats.estimate.key}`);
|
|
71
|
+
```
|
|
72
|
+
|
|
49
73
|
## Features
|
|
50
74
|
|
|
51
|
-
- BPM
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
75
|
+
- **Detection**: BPM, key, beats, onsets, chords, sections
|
|
76
|
+
- **Effects**: HPSS, time stretch, pitch shift, normalize, trim
|
|
77
|
+
- **Features**: STFT, mel spectrogram, MFCC, chroma, CQT/VQT, spectral features
|
|
78
|
+
- **Pitch**: YIN, pYIN algorithms
|
|
79
|
+
- **Streaming**: Real-time analysis with progressive estimates
|
|
80
|
+
- **Conversions**: Hz/mel/MIDI/note, frames/time, resample
|
|
81
|
+
|
|
82
|
+
## Also available
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
pip install libsonare # Python bindings with CLI
|
|
86
|
+
```
|
|
62
87
|
|
|
63
88
|
## License
|
|
64
89
|
|