@ai-coustics/aic-sdk 0.6.3
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 +201 -0
- package/LICENSE.AIC-SDK +74 -0
- package/README.md +107 -0
- package/binding.gyp +52 -0
- package/dist/index.d.ts +188 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +264 -0
- package/package.json +60 -0
- package/scripts/download-sdk.js +216 -0
- package/src/binding.cc +469 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2025 ai-coustics GmbH
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/LICENSE.AIC-SDK
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
AIC-SDK BINARY LICENSE AGREEMENT
|
|
2
|
+
Version 1.0 — 30 September 2025
|
|
3
|
+
Copyright © 2025 ai-coustics GmbH. All rights reserved.
|
|
4
|
+
|
|
5
|
+
0. Definitions
|
|
6
|
+
“SDK” means the files distributed inside the `sdk` folder
|
|
7
|
+
sdk/lib/* (e.g. libaic.a, libaic.so, libaic.dylib, aic.dll)
|
|
8
|
+
together with the public C header aic.h.
|
|
9
|
+
“Wrapper” means the source code in this repository that links to
|
|
10
|
+
the SDK. The Wrapper is licensed separately under the
|
|
11
|
+
Apache-2.0 license found in LICENSE.
|
|
12
|
+
“You” means the individual or legal entity exercising rights under
|
|
13
|
+
this Agreement.
|
|
14
|
+
|
|
15
|
+
1. License Grant
|
|
16
|
+
Subject to the terms below, ai-coustics GmbH (“Licensor”) grants You a
|
|
17
|
+
non-exclusive, non-transferable, worldwide, royalty-free right to
|
|
18
|
+
(a) install and use the SDK **in object-code form only** together with
|
|
19
|
+
the Wrapper, in products and services that You develop or operate;
|
|
20
|
+
(b) reproduce and redistribute the unmodified SDK solely when it is
|
|
21
|
+
embedded in an application that **depends on the Wrapper**, provided
|
|
22
|
+
that You
|
|
23
|
+
• include this license file with your distribution, and
|
|
24
|
+
• do not charge a fee specifically for the SDK.
|
|
25
|
+
|
|
26
|
+
2. Restrictions
|
|
27
|
+
You shall not, and shall not allow any third party to:
|
|
28
|
+
• modify, translate, reverse-engineer, decompile, disassemble or
|
|
29
|
+
otherwise attempt to derive the source code of the SDK (except to the
|
|
30
|
+
limited extent such actions are expressly permitted by mandatory law);
|
|
31
|
+
• remove or obscure any proprietary notices;
|
|
32
|
+
• use the SDK to create or train competing speech-enhancement models;
|
|
33
|
+
• redistribute the SDK as a stand-alone product, via package registries
|
|
34
|
+
(PyPI, npm, crates.io, etc.), or in any manner that allows third
|
|
35
|
+
parties to access the SDK separate from Your application.
|
|
36
|
+
|
|
37
|
+
3. Proprietary Rights
|
|
38
|
+
Title to, and all intellectual-property rights in, the SDK remain with
|
|
39
|
+
Licensor and its licensors. No rights are granted to You except as
|
|
40
|
+
expressly set out herein.
|
|
41
|
+
|
|
42
|
+
4. Warranty Disclaimer
|
|
43
|
+
THE SDK IS PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
44
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
45
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
|
46
|
+
|
|
47
|
+
5. Limitation of Liability
|
|
48
|
+
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL
|
|
49
|
+
LICENSOR BE LIABLE FOR ANY INDIRECT, SPECIAL, INCIDENTAL OR
|
|
50
|
+
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
|
51
|
+
SDK, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. LICENSOR’S
|
|
52
|
+
TOTAL CUMULATIVE LIABILITY SHALL NOT EXCEED EUR 500.
|
|
53
|
+
|
|
54
|
+
6. Termination
|
|
55
|
+
This Agreement terminates automatically if You breach any term hereof.
|
|
56
|
+
Upon termination, You must cease all use and destroy all copies of the
|
|
57
|
+
SDK in your possession. Sections 3–7 survive termination.
|
|
58
|
+
|
|
59
|
+
7. Governing Law and Venue
|
|
60
|
+
This Agreement is governed by the laws of Germany. Exclusive venue for
|
|
61
|
+
any dispute shall be the courts of Berlin, Germany.
|
|
62
|
+
|
|
63
|
+
8. Third-Party Code
|
|
64
|
+
The SDK may contain or link to third-party components that are subject
|
|
65
|
+
to separate open-source licenses. Such components remain governed by
|
|
66
|
+
their respective terms.
|
|
67
|
+
|
|
68
|
+
9. Entire Agreement
|
|
69
|
+
This document constitutes the entire agreement between Licensor and You
|
|
70
|
+
regarding the SDK and supersedes all prior oral or written agreements.
|
|
71
|
+
|
|
72
|
+
By installing, copying or otherwise using the SDK You acknowledge that
|
|
73
|
+
You have read this Agreement, understand it, and agree to be bound by its
|
|
74
|
+
terms.
|
package/README.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# ai-coustics Speech Enhancement SDK for Node.js
|
|
2
|
+
|
|
3
|
+
Welcome to the ai-coustics SDK! This repository provides the native JavaScript/TypeScript bindings to run our powerful real-time speech enhancement in your Node.js applications.
|
|
4
|
+
|
|
5
|
+
## What is this SDK?
|
|
6
|
+
|
|
7
|
+
Our Speech Enhancement SDK delivers state-of-the-art speech-enhancement in real-time, enabling you to build applications that remove noise and reverb from speech signals.
|
|
8
|
+
|
|
9
|
+
## Quick Start
|
|
10
|
+
|
|
11
|
+
### Acquire an SDK License Key
|
|
12
|
+
|
|
13
|
+
You need an **SDK license key**. This is distinct from the API license key used for our cloud API services. To obtain an SDK license key, please contact us at [info@ai-coustics.com](mailto:info@ai-coustics.com)
|
|
14
|
+
|
|
15
|
+
### Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @ai-coustics/aic-sdk
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The SDK binaries will be automatically downloaded during installation for your platform.
|
|
22
|
+
|
|
23
|
+
### Supported Platforms
|
|
24
|
+
|
|
25
|
+
- macOS (x64, ARM64)
|
|
26
|
+
- Linux (x64, ARM64)
|
|
27
|
+
- Windows (x64)
|
|
28
|
+
|
|
29
|
+
### Example Code
|
|
30
|
+
|
|
31
|
+
```javascript
|
|
32
|
+
import { Model, ModelType, Parameter, AudioConfig } from '@ai-coustics/aic-sdk';
|
|
33
|
+
|
|
34
|
+
const model = new Model(ModelType.QUAIL_L48, "YOUR_LICENSE_KEY");
|
|
35
|
+
|
|
36
|
+
const config: AudioConfig = {
|
|
37
|
+
sampleRate: model.getOptimalSampleRate(),
|
|
38
|
+
numChannels: 2,
|
|
39
|
+
numFrames: model.getOptimalNumFrames()
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
model.initialize(config);
|
|
43
|
+
|
|
44
|
+
// Adjust parameters
|
|
45
|
+
model.setParameter(Parameter.ENHANCEMENT_LEVEL, 0.9);
|
|
46
|
+
model.setParameter(Parameter.VOICE_GAIN, 1.2);
|
|
47
|
+
|
|
48
|
+
// Planar layout (separate buffers)
|
|
49
|
+
const leftChannel = new Float32Array(480);
|
|
50
|
+
const rightChannel = new Float32Array(480);
|
|
51
|
+
model.processPlanar([leftChannel, rightChannel], 2, 480);
|
|
52
|
+
|
|
53
|
+
// Or interleaved layout
|
|
54
|
+
const interleavedBuffer = new Float32Array(2 * 480);
|
|
55
|
+
model.processInterleaved(interleavedBuffer, 2, 480);
|
|
56
|
+
|
|
57
|
+
model.destroy();
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Support & Resources
|
|
61
|
+
|
|
62
|
+
## Documentation
|
|
63
|
+
|
|
64
|
+
- [JavaScript Example](examples/example.js)
|
|
65
|
+
- [TypeScript Example](examples/example.ts)
|
|
66
|
+
- [Function Reference](src/index.ts)
|
|
67
|
+
- [C-SDK-Reference](https://github.com/ai-coustics/aic-sdk-c/blob/HEAD/sdk-reference.md)
|
|
68
|
+
|
|
69
|
+
### Looking for Other Languages?
|
|
70
|
+
|
|
71
|
+
The ai-coustics Speech Enhancement SDK is available in multiple programming languages to fit your development needs:
|
|
72
|
+
|
|
73
|
+
| Platform | Repository | Description |
|
|
74
|
+
|----------|------------|-------------|
|
|
75
|
+
| **C** | [aic-sdk-c](https://github.com/ai-coustics/aic-sdk-c) | Core C interface and foundation library |
|
|
76
|
+
| **C++** | [`aic-sdk-cpp`](https://github.com/ai-coustics/aic-sdk-cpp) | Modern C++ interface with RAII and type safety |
|
|
77
|
+
| **Python** | [`aic-sdk-py`](https://github.com/ai-coustics/aic-sdk-py) | Idiomatic Python interface |
|
|
78
|
+
| **Rust** | [`aic-sdk-rs`](https://github.com/ai-coustics/aic-sdk-rs) | Safe Rust bindings with zero-cost abstractions |
|
|
79
|
+
| **Web (WASM)** | [`aic-sdk-wasm`](https://github.com/ai-coustics/aic-sdk-wasm) | WebAssembly build for browser applications |
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
## Demo Plugin
|
|
83
|
+
|
|
84
|
+
Experience our speech enhancement models firsthand with our Demo Plugin - a complete audio plugin that showcases all available models while serving as a comprehensive C++ integration example.
|
|
85
|
+
|
|
86
|
+
| Platform | Repository | Description |
|
|
87
|
+
|----------|------------|-------------|
|
|
88
|
+
| **Demo Plugin** | [`aic-sdk-plugin`](https://github.com/ai-coustics/aic-sdk-plugin) | Audio plugin with real-time model comparison and C++ integration reference |
|
|
89
|
+
|
|
90
|
+
### Get Help
|
|
91
|
+
|
|
92
|
+
- Documentation: [docs.ai-coustics.com](https://docs.ai-coustics.com/)
|
|
93
|
+
- Issues: [GitHub Issues](https://github.com/ai-coustics/aic-sdk-node/issues)
|
|
94
|
+
- Email: [info@ai-coustics.com](mailto:info@ai-coustics.com)
|
|
95
|
+
|
|
96
|
+
## License
|
|
97
|
+
|
|
98
|
+
This project uses a dual-license structure:
|
|
99
|
+
|
|
100
|
+
- **Node.js Wrapper Code** (source files in this repository): Licensed under the Apache License 2.0. See [LICENSE](LICENSE) for details.
|
|
101
|
+
- **AIC SDK Binaries** (files in `sdk/lib/*` and `aic.h`): Licensed under the proprietary AIC-SDK Binary License Agreement. See [LICENSE.AIC-SDK](LICENSE.AIC-SDK) for details.
|
|
102
|
+
|
|
103
|
+
When you use this package, both licenses apply to their respective components.
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
Made with ❤️ by the ai-coustics team
|
package/binding.gyp
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"targets": [
|
|
3
|
+
{
|
|
4
|
+
"target_name": "aic_binding",
|
|
5
|
+
"sources": ["src/binding.cc"],
|
|
6
|
+
"include_dirs": [
|
|
7
|
+
"<!@(node -p \"require('node-addon-api').include\")",
|
|
8
|
+
"sdk/include"
|
|
9
|
+
],
|
|
10
|
+
"dependencies": [
|
|
11
|
+
"<!(node -p \"require('node-addon-api').gyp\")"
|
|
12
|
+
],
|
|
13
|
+
"defines": ["NAPI_DISABLE_CPP_EXCEPTIONS"],
|
|
14
|
+
"conditions": [
|
|
15
|
+
["OS=='linux'", {
|
|
16
|
+
"libraries": [
|
|
17
|
+
"<(module_root_dir)/sdk/lib/libaic.so"
|
|
18
|
+
],
|
|
19
|
+
"ldflags": [
|
|
20
|
+
"-Wl,-rpath,<(module_root_dir)/sdk/lib"
|
|
21
|
+
]
|
|
22
|
+
}],
|
|
23
|
+
["OS=='mac'", {
|
|
24
|
+
"libraries": [
|
|
25
|
+
"../sdk/lib/libaic.dylib"
|
|
26
|
+
],
|
|
27
|
+
"xcode_settings": {
|
|
28
|
+
"OTHER_LDFLAGS": [
|
|
29
|
+
"-Wl,-rpath,@loader_path/../../sdk/lib"
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
}],
|
|
33
|
+
["OS=='win'", {
|
|
34
|
+
"libraries": [
|
|
35
|
+
"../sdk/lib/aic.lib",
|
|
36
|
+
"ntdll.lib"
|
|
37
|
+
],
|
|
38
|
+
"copies": [
|
|
39
|
+
{
|
|
40
|
+
"destination": "<(module_root_dir)/build/Release/",
|
|
41
|
+
"files": ["<(module_root_dir)/sdk/lib/aic.dll"]
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
}]
|
|
45
|
+
],
|
|
46
|
+
"cflags!": ["-fno-exceptions"],
|
|
47
|
+
"cflags_cc!": ["-fno-exceptions"],
|
|
48
|
+
"cflags": ["-fPIC"],
|
|
49
|
+
"cflags_cc": ["-fPIC"]
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node.js bindings for ai-coustics speech enhancement SDK
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Error codes returned by the SDK
|
|
7
|
+
*/
|
|
8
|
+
export declare enum ErrorCode {
|
|
9
|
+
/** Operation completed successfully */
|
|
10
|
+
SUCCESS = 0,
|
|
11
|
+
/** Required pointer argument was NULL */
|
|
12
|
+
NULL_POINTER = 1,
|
|
13
|
+
/** License key format is invalid or corrupted */
|
|
14
|
+
LICENSE_INVALID = 2,
|
|
15
|
+
/** License key has expired */
|
|
16
|
+
LICENSE_EXPIRED = 3,
|
|
17
|
+
/** Audio configuration is not supported by the model */
|
|
18
|
+
UNSUPPORTED_AUDIO_CONFIG = 4,
|
|
19
|
+
/** Process was called with a different audio buffer configuration than initialized */
|
|
20
|
+
AUDIO_CONFIG_MISMATCH = 5,
|
|
21
|
+
/** Model must be initialized before this operation */
|
|
22
|
+
NOT_INITIALIZED = 6,
|
|
23
|
+
/** Parameter value is outside acceptable range */
|
|
24
|
+
PARAMETER_OUT_OF_RANGE = 7,
|
|
25
|
+
/** SDK activation failed */
|
|
26
|
+
SDK_ACTIVATION_ERROR = 8
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Available model types for audio enhancement
|
|
30
|
+
*/
|
|
31
|
+
export declare enum ModelType {
|
|
32
|
+
/** Native sample rate: 48 kHz, Native num frames: 480, Processing latency: 30ms */
|
|
33
|
+
QUAIL_L48 = 0,
|
|
34
|
+
/** Native sample rate: 16 kHz, Native num frames: 160, Processing latency: 30ms */
|
|
35
|
+
QUAIL_L16 = 1,
|
|
36
|
+
/** Native sample rate: 8 kHz, Native num frames: 80, Processing latency: 30ms */
|
|
37
|
+
QUAIL_L8 = 2,
|
|
38
|
+
/** Native sample rate: 48 kHz, Native num frames: 480, Processing latency: 30ms */
|
|
39
|
+
QUAIL_S48 = 3,
|
|
40
|
+
/** Native sample rate: 16 kHz, Native num frames: 160, Processing latency: 30ms */
|
|
41
|
+
QUAIL_S16 = 4,
|
|
42
|
+
/** Native sample rate: 8 kHz, Native num frames: 80, Processing latency: 30ms */
|
|
43
|
+
QUAIL_S8 = 5,
|
|
44
|
+
/** Native sample rate: 48 kHz, Native num frames: 480, Processing latency: 10ms */
|
|
45
|
+
QUAIL_XS = 6,
|
|
46
|
+
/** Native sample rate: 48 kHz, Native num frames: 480, Processing latency: 10ms */
|
|
47
|
+
QUAIL_XXS = 7
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Configurable parameters for audio enhancement
|
|
51
|
+
*/
|
|
52
|
+
export declare enum Parameter {
|
|
53
|
+
/**
|
|
54
|
+
* Controls the intensity of speech enhancement processing.
|
|
55
|
+
* Range: 0.0 to 1.0
|
|
56
|
+
* - 0.0: Bypass mode - original signal passes through unchanged
|
|
57
|
+
* - 1.0: Full enhancement - maximum noise reduction
|
|
58
|
+
* Default: 1.0
|
|
59
|
+
*/
|
|
60
|
+
ENHANCEMENT_LEVEL = 0,
|
|
61
|
+
/**
|
|
62
|
+
* Compensates for perceived volume reduction after noise removal.
|
|
63
|
+
* Range: 0.1 to 4.0 (linear amplitude multiplier)
|
|
64
|
+
* - 0.1: Significant volume reduction (-20 dB)
|
|
65
|
+
* - 1.0: No gain change (0 dB, default)
|
|
66
|
+
* - 2.0: Double amplitude (+6 dB)
|
|
67
|
+
* - 4.0: Maximum boost (+12 dB)
|
|
68
|
+
* Default: 1.0
|
|
69
|
+
*/
|
|
70
|
+
VOICE_GAIN = 1,
|
|
71
|
+
/**
|
|
72
|
+
* Enables/disables a noise gate as a post-processing step.
|
|
73
|
+
* Valid values: 0.0 or 1.0
|
|
74
|
+
* - 0.0: Noise gate disabled
|
|
75
|
+
* - 1.0: Noise gate enabled
|
|
76
|
+
* Default: 0.0
|
|
77
|
+
*/
|
|
78
|
+
NOISE_GATE_ENABLE = 2
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Configuration for model initialization
|
|
82
|
+
*/
|
|
83
|
+
export interface AudioConfig {
|
|
84
|
+
/** Audio sample rate in Hz (8000 - 192000) */
|
|
85
|
+
sampleRate: number;
|
|
86
|
+
/** Number of audio channels (1 for mono, 2 for stereo, etc.) */
|
|
87
|
+
numChannels: number;
|
|
88
|
+
/** Number of samples per channel in each process call */
|
|
89
|
+
numFrames: number;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* High-level interface for the ai-coustics speech enhancement model
|
|
93
|
+
*/
|
|
94
|
+
export declare class Model {
|
|
95
|
+
private handle;
|
|
96
|
+
private _isInitialized;
|
|
97
|
+
/**
|
|
98
|
+
* Creates a new audio enhancement model instance
|
|
99
|
+
* @param modelType - The enhancement algorithm variant to use
|
|
100
|
+
* @param licenseKey - Your license key
|
|
101
|
+
* @throws Error if model creation fails
|
|
102
|
+
*/
|
|
103
|
+
constructor(modelType: ModelType, licenseKey: string);
|
|
104
|
+
/**
|
|
105
|
+
* Configures the model for a specific audio format
|
|
106
|
+
* Must be called before processing any audio
|
|
107
|
+
* @param config - Audio configuration parameters
|
|
108
|
+
* @throws Error if initialization fails
|
|
109
|
+
*/
|
|
110
|
+
initialize(config: AudioConfig): void;
|
|
111
|
+
/**
|
|
112
|
+
* Clears all internal state and buffers
|
|
113
|
+
* Call this when the audio stream is interrupted
|
|
114
|
+
* @throws Error if reset fails
|
|
115
|
+
*/
|
|
116
|
+
reset(): void;
|
|
117
|
+
/**
|
|
118
|
+
* Processes audio with interleaved channel data (in-place)
|
|
119
|
+
* @param audio - Float32Array containing interleaved audio data
|
|
120
|
+
* @param numChannels - Number of channels (must match initialization)
|
|
121
|
+
* @param numFrames - Number of frames (must match initialization)
|
|
122
|
+
* @throws Error if processing fails
|
|
123
|
+
*/
|
|
124
|
+
processInterleaved(audio: Float32Array, numChannels: number, numFrames: number): void;
|
|
125
|
+
/**
|
|
126
|
+
* Processes audio with separate buffers for each channel (in-place)
|
|
127
|
+
* Maximum of 16 channels
|
|
128
|
+
* @param audio - Array of Float32Array, one per channel
|
|
129
|
+
* @param numChannels - Number of channels (must match initialization)
|
|
130
|
+
* @param numFrames - Number of frames per channel (must match initialization)
|
|
131
|
+
* @throws Error if processing fails
|
|
132
|
+
*/
|
|
133
|
+
processPlanar(audio: Float32Array[], numChannels: number, numFrames: number): void;
|
|
134
|
+
/**
|
|
135
|
+
* Sets a model parameter
|
|
136
|
+
* @param parameter - The parameter to modify
|
|
137
|
+
* @param value - New parameter value
|
|
138
|
+
* @throws Error if setting parameter fails
|
|
139
|
+
*/
|
|
140
|
+
setParameter(parameter: Parameter, value: number): void;
|
|
141
|
+
/**
|
|
142
|
+
* Gets the current value of a parameter
|
|
143
|
+
* @param parameter - The parameter to query
|
|
144
|
+
* @returns Current parameter value
|
|
145
|
+
* @throws Error if getting parameter fails
|
|
146
|
+
*/
|
|
147
|
+
getParameter(parameter: Parameter): number;
|
|
148
|
+
/**
|
|
149
|
+
* Returns the total output delay in samples for the current audio configuration
|
|
150
|
+
* @returns Delay in samples
|
|
151
|
+
* @throws Error if getting delay fails
|
|
152
|
+
*/
|
|
153
|
+
getOutputDelay(): number;
|
|
154
|
+
/**
|
|
155
|
+
* Gets the native sample rate of the selected model
|
|
156
|
+
* @returns Optimal sample rate in Hz
|
|
157
|
+
* @throws Error if getting sample rate fails
|
|
158
|
+
*/
|
|
159
|
+
getOptimalSampleRate(): number;
|
|
160
|
+
/**
|
|
161
|
+
* Gets the native number of frames for the selected model
|
|
162
|
+
* @returns Optimal frame count
|
|
163
|
+
* @throws Error if getting frame count fails
|
|
164
|
+
*/
|
|
165
|
+
getOptimalNumFrames(): number;
|
|
166
|
+
/**
|
|
167
|
+
* Checks if the model has been initialized
|
|
168
|
+
*/
|
|
169
|
+
get isInitialized(): boolean;
|
|
170
|
+
/**
|
|
171
|
+
* Releases all resources associated with the model
|
|
172
|
+
*/
|
|
173
|
+
destroy(): void;
|
|
174
|
+
private getErrorMessage;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Returns the version of the SDK
|
|
178
|
+
*/
|
|
179
|
+
export declare function getSdkVersion(): string;
|
|
180
|
+
declare const _default: {
|
|
181
|
+
Model: typeof Model;
|
|
182
|
+
ModelType: typeof ModelType;
|
|
183
|
+
Parameter: typeof Parameter;
|
|
184
|
+
ErrorCode: typeof ErrorCode;
|
|
185
|
+
getSdkVersion: typeof getSdkVersion;
|
|
186
|
+
};
|
|
187
|
+
export default _default;
|
|
188
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;GAEG;AACH,oBAAY,SAAS;IACnB,uCAAuC;IACvC,OAAO,IAAI;IACX,yCAAyC;IACzC,YAAY,IAAI;IAChB,iDAAiD;IACjD,eAAe,IAAI;IACnB,8BAA8B;IAC9B,eAAe,IAAI;IACnB,wDAAwD;IACxD,wBAAwB,IAAI;IAC5B,sFAAsF;IACtF,qBAAqB,IAAI;IACzB,sDAAsD;IACtD,eAAe,IAAI;IACnB,kDAAkD;IAClD,sBAAsB,IAAI;IAC1B,4BAA4B;IAC5B,oBAAoB,IAAI;CACzB;AAED;;GAEG;AACH,oBAAY,SAAS;IACnB,mFAAmF;IACnF,SAAS,IAAI;IACb,mFAAmF;IACnF,SAAS,IAAI;IACb,iFAAiF;IACjF,QAAQ,IAAI;IACZ,mFAAmF;IACnF,SAAS,IAAI;IACb,mFAAmF;IACnF,SAAS,IAAI;IACb,iFAAiF;IACjF,QAAQ,IAAI;IACZ,mFAAmF;IACnF,QAAQ,IAAI;IACZ,mFAAmF;IACnF,SAAS,IAAI;CACd;AAED;;GAEG;AACH,oBAAY,SAAS;IACnB;;;;;;OAMG;IACH,iBAAiB,IAAI;IAErB;;;;;;;;OAQG;IACH,UAAU,IAAI;IAEd;;;;;;OAMG;IACH,iBAAiB,IAAI;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,8CAA8C;IAC9C,UAAU,EAAE,MAAM,CAAC;IACnB,gEAAgE;IAChE,WAAW,EAAE,MAAM,CAAC;IACpB,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,qBAAa,KAAK;IAChB,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,cAAc,CAAkB;IAExC;;;;;OAKG;gBACS,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM;IAQpD;;;;;OAKG;IACH,UAAU,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;IAQrC;;;;OAIG;IACH,KAAK,IAAI,IAAI;IAOb;;;;;;OAMG;IACH,kBAAkB,CAAC,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;IAOrF;;;;;;;OAOG;IACH,aAAa,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;IAOlF;;;;;OAKG;IACH,YAAY,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAOvD;;;;;OAKG;IACH,YAAY,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM;IAQ1C;;;;OAIG;IACH,cAAc,IAAI,MAAM;IAQxB;;;;OAIG;IACH,oBAAoB,IAAI,MAAM;IAQ9B;;;;OAIG;IACH,mBAAmB,IAAI,MAAM;IAQ7B;;OAEG;IACH,IAAI,aAAa,IAAI,OAAO,CAE3B;IAED;;OAEG;IACH,OAAO,IAAI,IAAI;IAQf,OAAO,CAAC,eAAe;CAcxB;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAEtC;;;;;;;;AAGD,wBAME"}
|