# @types/node-wav

> TypeScript definitions for node-wav

Latest version **0.0.4** (published 2025-02-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/node-wav
pnpm add @types/node-wav
yarn add @types/node-wav
bun add @types/node-wav
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support; pre 1.0.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2025-02-27 |
| First published | 2021-09-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 6.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51432 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/node-wav
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node-wav
- npm.io page: https://npm.io/package/@types/node-wav

## Dependencies (1)

- [@types/node](https://npm.io/package/@types/node.md) *

## Recent versions

- 0.0.4 (latest) — 2025-02-27
- 0.0.3 (ts4.9) — 2023-11-21
- 0.0.0 (ts3.8) — 2021-09-02
- 0.0.2 — 2023-11-07
- 0.0.1 — 2023-10-18

## README

# Installation
> `npm install --save @types/node-wav`

# Summary
This package contains type definitions for node-wav (https://github.com/andreasgal/node-wav).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node-wav.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node-wav/index.d.ts)
````ts
/// <reference types="node" />

/**
 * Decodes a {@link Buffer} containing a WAVE file into raw sample data.
 * @param buffer The {@link Buffer} containing a WAVE file to decode.
 * @return The decoded WAVE file.
 */
export function decode(buffer: Buffer): {
    /**
     * The sample rate of the decoded WAVE file, in Hertz.
     */
    readonly sampleRate: number;

    /**
     * The raw sample data.
     * When mono, this will be a single {@link Float32Array}.
     * When stereo, this will be two {@link Float32Array}s of equal length.
     */
    readonly channelData: readonly Float32Array[];
};

/**
 * Encodes raw sample data into a {@link Buffer} containing the corresponding WAVE file.
 * @param channelData The raw sample data to encode.  Each {@link ArrayBuffer} must be of equal length.  One {@link ArrayBuffer} represents mono, while two {@link ArrayBuffer}s represent stereo.
 * @param opts Options regarding the WAVE file to encode.
 * @return The encoded {@link Buffer}.
 */
export function encode(
    channelData: readonly ArrayLike<number>[],
    opts: {
        /**
         * The sample rate of the given {@link channelData}.
         * Defaults to 16000 when not given.
         */
        readonly sampleRate?: number;

        /**
         * When true, the WAVE file is encoded in floating point.
         * It is otherwise encoded in fixed point.
         * An alias of {@link floatingPoint}.
         */
        readonly float?: boolean;

        /**
         * When true, the WAVE file is encoded in floating point.
         * It is otherwise encoded in fixed point.
         * An alias of {@link float}.
         */
        readonly floatingPoint?: boolean;

        /**
         * The bit depth of the WAVE file to encode.
         * This is ignored in floating point mode; floating point WAVE files are always 32-bit.
         * Otherwise defaults to 16.
         */
        readonly bitDepth?: number;
    },
): Buffer;

````

### Additional Details
 * Last updated: Thu, 27 Feb 2025 18:37:52 GMT
 * Dependencies: [@types/node](https://npmjs.com/package/@types/node)

# Credits
These definitions were written by [jameswilddev](https://github.com/jameswilddev).

---
_Source: https://npm.io/package/@types/node-wav · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
