0.0.27 • Published 1 year ago

libopusenc v0.0.27

Weekly downloads
-
License
-
Repository
github
Last release
1 year ago

node-opusenc

Description

Entirely synchronous API to create .ogg files encoded using libopus library. It supports several sample rates (16000,48000 and more.).

Usage

import { Comments, Encoder } from "node-opusenc";

const comments = new Comments();
const enc = new Encoder();
enc.createFile(comments, path.resolve(__dirname, "test1.ogg"), 48000, 1, 0);
const pcm = child_process.spawn("arecord", [
    "-f",
    "FLOAT_LE",
    "-c",
    "1",
    "-r",
    "48000",
    "-d",
    "4",
]);
pcm.stdout.on("data", (chunk) => {
    assert.strict.ok(Buffer.isBuffer(chunk));
    const samples = chunk.byteLength / Float32Array.BYTES_PER_ELEMENT;
    const buf = new Float32Array(samples);
    buf.set(new Float32Array(chunk.buffer, chunk.byteOffset, samples));

    enc.writeFloat(buf, samples);
});
return new Promise<void>((resolve) => {
    pcm.stdout.on("exit", (code) => {
        assert.strict.ok(code === 0);
        enc.drain();
        resolve();
    });
});
0.0.27

1 year ago

0.0.26

1 year ago

0.0.25

1 year ago

0.0.23

1 year ago

0.0.22

1 year ago

0.0.21

1 year ago

0.0.20

1 year ago

0.0.18

1 year ago

0.0.17

1 year ago

0.0.16

1 year ago

0.0.15

1 year ago

0.0.14

1 year ago

0.0.13

1 year ago

0.0.12

1 year ago

0.0.11

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago