@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 CHANGED
@@ -2,26 +2,34 @@
2
2
 
3
3
  [![CI](https://img.shields.io/github/actions/workflow/status/libraz/libsonare/ci.yml?branch=main&label=CI)](https://github.com/libraz/libsonare/actions)
4
4
  [![npm](https://img.shields.io/npm/v/@libraz/libsonare)](https://www.npmjs.com/package/@libraz/libsonare)
5
- [![codecov](https://codecov.io/gh/libraz/libsonare/branch/main/graph/badge.svg)](https://codecov.io/gh/libraz/libsonare)
5
+ [![PyPI](https://img.shields.io/pypi/v/libsonare)](https://pypi.org/project/libsonare/)
6
6
  [![License](https://img.shields.io/github/license/libraz/libsonare)](https://github.com/libraz/libsonare/blob/main/LICENSE)
7
- [![C++17](https://img.shields.io/badge/C%2B%2B-17-blue?logo=c%2B%2B)](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
- // Quick analysis
19
- const result = await analyze(audioBuffer, sampleRate);
20
- console.log(`BPM: ${result.bpm}, Key: ${result.key.tonic} ${result.key.mode}`);
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
- // Individual features
23
- const bpm = detectBpm(audioBuffer, sampleRate);
24
- const key = detectKey(audioBuffer, sampleRate);
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 (webpack, Vite, Next.js, etc.)
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 / tempo detection
52
- - Key detection (major/minor)
53
- - Beat tracking
54
- - Chord recognition
55
- - Onset detection
56
- - Mel spectrogram, MFCC, Chroma
57
- - Spectral features (centroid, bandwidth, rolloff, flatness)
58
- - Pitch detection (YIN, pYIN)
59
- - HPSS (harmonic-percussive separation)
60
- - Time stretching & pitch shifting
61
- - Real-time streaming analysis
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
  [![CI](https://img.shields.io/github/actions/workflow/status/libraz/libsonare/ci.yml?branch=main&label=CI)](https://github.com/libraz/libsonare/actions)
4
4
  [![npm](https://img.shields.io/npm/v/@libraz/libsonare)](https://www.npmjs.com/package/@libraz/libsonare)
5
- [![codecov](https://codecov.io/gh/libraz/libsonare/branch/main/graph/badge.svg)](https://codecov.io/gh/libraz/libsonare)
5
+ [![PyPI](https://img.shields.io/pypi/v/libsonare)](https://pypi.org/project/libsonare/)
6
6
  [![License](https://img.shields.io/github/license/libraz/libsonare)](https://github.com/libraz/libsonare/blob/main/LICENSE)
7
- [![C++17](https://img.shields.io/badge/C%2B%2B-17-blue?logo=c%2B%2B)](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
- // Quick analysis
19
- const result = await analyze(audioBuffer, sampleRate);
20
- console.log(`BPM: ${result.bpm}, Key: ${result.key.tonic} ${result.key.mode}`);
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
- // Individual features
23
- const bpm = detectBpm(audioBuffer, sampleRate);
24
- const key = detectKey(audioBuffer, sampleRate);
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 (webpack, Vite, Next.js, etc.)
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 / tempo detection
52
- - Key detection (major/minor)
53
- - Beat tracking
54
- - Chord recognition
55
- - Onset detection
56
- - Mel spectrogram, MFCC, Chroma
57
- - Spectral features (centroid, bandwidth, rolloff, flatness)
58
- - Pitch detection (YIN, pYIN)
59
- - HPSS (harmonic-percussive separation)
60
- - Time stretching & pitch shifting
61
- - Real-time streaming analysis
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