Skip to content

Commit d53eea8

Browse files
committed
Make workspace
1 parent 36772df commit d53eea8

38 files changed

Lines changed: 1639 additions & 67 deletions

package-lock.json

Lines changed: 87 additions & 66 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@
1818
"audio-encode.d.ts",
1919
"LICENSE"
2020
],
21+
"workspaces": [
22+
"packages/*"
23+
],
2124
"scripts": {
22-
"test": "node test.js"
25+
"test": "node test.js",
26+
"test:all": "npm test --workspaces && npm test"
2327
},
2428
"repository": {
2529
"type": "git",

packages/aiff-encode/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Dmitry Iv.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

packages/aiff-encode/README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# @audio/aiff-encode
2+
3+
Encode PCM audio samples to AIFF format.<br>
4+
Pure JS — no WASM, no native bindings, works in both node and browser.
5+
6+
[![npm install @audio/aiff-encode](https://nodei.co/npm/@audio/aiff-encode.png?mini=true)](https://npmjs.org/package/@audio/aiff-encode/)
7+
8+
```js
9+
import aiff from '@audio/aiff-encode';
10+
11+
const encoder = await aiff({ sampleRate: 44100 });
12+
encoder.encode(channelData); // buffer PCM
13+
const buffer = encoder.flush(); // → complete AIFF file as Uint8Array
14+
```
15+
16+
### Options
17+
18+
| Option | Default | Description |
19+
|--------|---------|-------------|
20+
| `sampleRate` || Sample rate (required) |
21+
| `bitDepth` | `16` | `16` or `24` |
22+
23+
### Streaming
24+
25+
```js
26+
const encoder = await aiff({ sampleRate: 48000, bitDepth: 24 });
27+
encoder.encode(chunk1);
28+
encoder.encode(chunk2);
29+
const file = encoder.flush(); // → Uint8Array (complete AIFF)
30+
encoder.free();
31+
```
32+
33+
Input is `Float32Array[]` — one array per channel. Big-endian interleaving handled automatically.
34+
35+
## License
36+
37+
[MIT](LICENSE)
38+
39+
<a href="https://github.com/krishnized/license/">ॐ</a>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export interface AiffEncodeOptions {
2+
sampleRate: number;
3+
bitDepth?: 16 | 24;
4+
}
5+
6+
export interface StreamEncoder {
7+
encode(channels: Float32Array[]): Uint8Array;
8+
flush(): Uint8Array;
9+
free(): void;
10+
}
11+
12+
export default function aiff(opts: AiffEncodeOptions): Promise<StreamEncoder>;

0 commit comments

Comments
 (0)