@audio/stft 1.0.1 → 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.
Files changed (3) hide show
  1. package/LICENSE +40 -0
  2. package/README.md +31 -2
  3. package/package.json +9 -4
package/LICENSE ADDED
@@ -0,0 +1,40 @@
1
+ Kṛṣnized
2
+
3
+ This is a reminder that, in the absolute sense, all results of work belong to the Supreme.
4
+
5
+ While software and intellectual property (IP) require a formal license to define authorship,
6
+ responsibilities, or distribution limitations, these are temporary material designations.
7
+ The origin and destination of all ideas, as well as the ultimate owner of all results,
8
+ is the Supreme. The most meaningful action is to dedicate these results to the Supreme.
9
+ This process is known as Karma-Yoga and is described in BG 3.9, BG 12.10 and BG 18.46.
10
+
11
+ "Work done as a sacrifice for the Supreme must be performed;
12
+ otherwise, work binds one to the material world."
13
+
14
+ This license does not override or alter the terms specified by the material-level license below.
15
+
16
+ ॐ
17
+
18
+ ---
19
+
20
+ MIT License
21
+
22
+ Copyright (c) Dmitry Iv
23
+
24
+ Permission is hereby granted, free of charge, to any person obtaining a copy
25
+ of this software and associated documentation files (the "Software"), to deal
26
+ in the Software without restriction, including without limitation the rights
27
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
28
+ copies of the Software, and to permit persons to whom the Software is
29
+ furnished to do so, subject to the following conditions:
30
+
31
+ The above copyright notice and this permission notice shall be included in all
32
+ copies or substantial portions of the Software.
33
+
34
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
35
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
36
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
37
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
38
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
39
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
40
+ SOFTWARE.
package/README.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # @audio/stft
2
2
 
3
- > Shared STFT — batch / stream / analyse, one canonical implementation for all @audio packages
3
+ > Canonical STFT for the `@audio` ecosystem — batch / stream / analyse, stream ≡ batch under any chunking.
4
4
 
5
- Planned — not implemented yet. See the umbrella README for status and sources.
5
+ Hann analysis + synthesis windows with correctly normalized overlap-add. Extracted verbatim from `@audio/denoise-core` (differential-tested there since wave 1), including the shared stream ring-compaction fix.
6
+
7
+ ```js
8
+ import { stftBatch, stftStream, stftAnalyse } from '@audio/stft'
9
+
10
+ // process(mag, phase, state, ctx) → { mag, phase }, called per frame
11
+ const identity = (mag, phase) => ({ mag, phase })
12
+
13
+ // batch — whole signal in, Float32Array out
14
+ let out = stftBatch(input, identity, { fs: 44100, frameSize: 2048, hopSize: 512 })
15
+
16
+ // stream — real-time chunks; identical output to batch for any chunk sizes
17
+ let s = stftStream(identity, { fs: 44100 })
18
+ let piece = s.write(chunk) // returns processed samples as they become available
19
+ let tail = s.flush()
20
+
21
+ // analyse — visit magnitude/phase frames without resynthesis
22
+ stftAnalyse(input, (mag, phase, ctx) => { /* inspect */ }, { fs: 44100 })
23
+ ```
24
+
25
+ Also exports `wrapPhase`, `hannWindow`, `normFloor`, `PI2` (window math shared with [`@audio/window`](https://github.com/audiojs/window)).
26
+
27
+ ## See also
28
+
29
+ - [`@audio/window`](https://github.com/audiojs/window) — audio-facing window kit (fills, apply, COLA check)
30
+ - [`fourier-transform`](https://github.com/scijs/fourier-transform) — the FFT underneath (scijs layer)
31
+
32
+ ## License
33
+
34
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@audio/stft",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "Canonical STFT — batch / stream / analyse with normalized Hann OLA; stream ≡ batch under any chunking",
@@ -35,11 +35,16 @@
35
35
  },
36
36
  "repository": {
37
37
  "type": "git",
38
- "url": "git+https://github.com/audiojs/stft.git",
39
- "directory": "packages/stft"
38
+ "url": "git+https://github.com/audiojs/stft.git"
40
39
  },
41
- "homepage": "https://github.com/audiojs/stft/tree/main/packages/stft",
40
+ "homepage": "https://github.com/audiojs/stft#readme",
42
41
  "bugs": {
43
42
  "url": "https://github.com/audiojs/stft/issues"
43
+ },
44
+ "scripts": {
45
+ "test": "node test.js"
46
+ },
47
+ "devDependencies": {
48
+ "tst": "^9.4.0"
44
49
  }
45
50
  }