@audio/auditory 1.0.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,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 ADDED
@@ -0,0 +1,13 @@
1
+ # @audio/auditory
2
+
3
+ > Auditory filterbanks — psychoacoustic frequency decompositions.
4
+
5
+ | Package | What |
6
+ |---|---|
7
+ | `@audio/auditory-bark` | Bark-scale filterbank |
8
+ | `@audio/auditory-erb` | ERB-scale filterbank |
9
+ | `@audio/auditory-mel` | Mel-scale filterbank |
10
+ | `@audio/auditory-gammatone` | Gammatone filterbank |
11
+ | `@audio/auditory-octave` | IEC 61260 octave/fractional-octave bank |
12
+
13
+ Extracted from [filter](https://github.com/audiojs/filter).
package/index.d.ts ADDED
@@ -0,0 +1,44 @@
1
+ type Buf = Float32Array | Float64Array | number[]
2
+ interface BiquadCoef { b0: number; b1: number; b2: number; a1: number; a2: number }
3
+ type SOS = BiquadCoef[]
4
+
5
+ export interface GammatoneParams {
6
+ fc?: number // center frequency Hz (default 1000)
7
+ fs?: number // sample rate (default 44100)
8
+ order?: number // filter order (default 4)
9
+ [key: string]: unknown
10
+ }
11
+
12
+ /** Gammatone auditory filter — 4th-order cochlear model, in-place */
13
+ export function gammatone(data: Buf, params: GammatoneParams): Buf
14
+
15
+ export interface BankOpts {
16
+ fmin?: number // lowest band center Hz
17
+ fmax?: number // highest band center Hz
18
+ }
19
+
20
+ export interface ErbBankOpts extends BankOpts {
21
+ density?: number // bands per ERB (default 1)
22
+ }
23
+
24
+ export interface OctaveBand { fc: number; coefs: SOS }
25
+ export interface ErbBand { fc: number; erb: number }
26
+ export interface BarkBand { bark: number; fLow: number; fHigh: number; fc: number; coefs: SOS }
27
+
28
+ /** IEC 61260 fractional-octave filter bank. fraction default 3 (1/3-octave), fs default 44100, fmin/fmax default 31.25/16000 Hz */
29
+ export function octaveBank(fraction?: number, fs?: number, opts?: BankOpts): OctaveBand[]
30
+
31
+ /** ERB-spaced gammatone filter bank (Glasberg & Moore). fs default 44100, fmin/fmax default 50/min(16000, fs/2) Hz */
32
+ export function erbBank(fs?: number, opts?: ErbBankOpts): ErbBand[]
33
+
34
+ /** Bark-scale critical-band filter bank (Zwicker). fs default 44100, fmin/fmax default 20/min(15500, fs/2) Hz. A caller-supplied fmin below 20 Hz is honored as band 1's fLow instead of being clamped up. */
35
+ export function barkBank(fs?: number, opts?: BankOpts): BarkBand[]
36
+
37
+ export interface MelBankOpts extends BankOpts {
38
+ nFilters?: number // number of mel filters (default 26)
39
+ }
40
+
41
+ export interface MelBand { fc: number; fLow: number; fHigh: number; mel: number }
42
+
43
+ /** Mel-frequency triangular filter bank */
44
+ export function melBank(fs?: number, opts?: MelBankOpts): MelBand[]
package/index.js ADDED
@@ -0,0 +1,8 @@
1
+ // @audio/auditory — auditory filterbanks umbrella re-exporting every @audio/auditory-* atom.
2
+ // For smaller bundles, depend directly on the individual atom.
3
+
4
+ export { default as barkBank } from '@audio/auditory-bark'
5
+ export { default as erbBank } from '@audio/auditory-erb'
6
+ export { default as melBank } from '@audio/auditory-mel'
7
+ export { default as gammatone } from '@audio/auditory-gammatone'
8
+ export { default as octaveBank } from '@audio/auditory-octave'
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "@audio/auditory",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "sideEffects": false,
6
+ "description": "Auditory filterbanks — umbrella for @audio/auditory-* atoms (bark, ERB, mel, gammatone, octave)",
7
+ "main": "index.js",
8
+ "types": "index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./index.d.ts",
12
+ "default": "./index.js"
13
+ },
14
+ "./package.json": "./package.json"
15
+ },
16
+ "files": [
17
+ "index.js",
18
+ "index.d.ts"
19
+ ],
20
+ "workspaces": [
21
+ "packages/*"
22
+ ],
23
+ "scripts": {
24
+ "test": "node test.js",
25
+ "test:all": "npm test --workspaces --if-present && npm test",
26
+ "publish:all": "npm publish --workspaces && npm publish"
27
+ },
28
+ "dependencies": {
29
+ "@audio/auditory-bark": "^1.0.0",
30
+ "@audio/auditory-erb": "^1.0.0",
31
+ "@audio/auditory-mel": "^1.0.0",
32
+ "@audio/auditory-gammatone": "^1.0.0",
33
+ "@audio/auditory-octave": "^1.0.0"
34
+ },
35
+ "devDependencies": {
36
+ "tst": "^9.4.0"
37
+ },
38
+ "keywords": [
39
+ "audio",
40
+ "dsp",
41
+ "auditory",
42
+ "filterbank",
43
+ "bark",
44
+ "erb",
45
+ "mel",
46
+ "gammatone",
47
+ "octave-band"
48
+ ],
49
+ "license": "MIT",
50
+ "author": "Dmitry Iv. <dfcreative@gmail.com>",
51
+ "engines": {
52
+ "node": ">=18"
53
+ },
54
+ "publishConfig": {
55
+ "access": "public"
56
+ }
57
+ }