npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

silk-wasm

v3.7.1

Published

Tencent silk encoder for Node.js and browser

Readme

silk-wasm

npm

QQ/微信语音编解码

API

interface EncodeResult {
    data: Uint8Array
    duration: number
}

interface DecodeResult {
    data: Uint8Array
    duration: number
}

/**
 * 编码为 SILK
 * @param input WAV 或单声道 pcm_s16le 文件
 * @param sampleRate `input` 的采样率,可为 8000/12000/16000/24000/32000/44100/48000,当 `input` 为 WAV 时可填入 0
 * @returns SILK
 */
function encode(input: ArrayBufferView | ArrayBuffer, sampleRate: number): Promise<EncodeResult>

/**
 * 将 SILK 解码为 PCM
 * @param input SILK 文件
 * @param sampleRate `input` 的采样率
 * @returns pcm_s16le
 */
function decode(input: ArrayBufferView | ArrayBuffer, sampleRate: number): Promise<DecodeResult>

/**
 * 获取 SILK 音频时长
 * @param data SILK 文件
 * @param frameMs SILK 的 frameMs,可为 20/40/60/80/100,默认为 20
 * @returns 单位为毫秒的时长
 */
function getDuration(data: ArrayBufferView | ArrayBuffer, frameMs?: number): number

/**
 * 检测是否为 WAV 文件
 * @param data 任意文件
 */
function isWav(data: ArrayBufferView | ArrayBuffer): boolean

/**
 * 获取 WAV 文件的信息
 * @param data WAV 文件
 * @returns metadata
 */
function getWavFileInfo(data: ArrayBufferView | ArrayBuffer): WavFileInfo

/**
 * 检测是否为 SILK 文件
 * @param data 任意文件
 */
function isSilk(data: ArrayBufferView | ArrayBuffer): boolean

Example

ffmpeg -i canon.mp3 -ar 24000 -ac 1 -f s16le canon.pcm
import { encode } from './lib/index.mjs'  // use `silk-wasm` instead
import { readFile, writeFile } from 'fs/promises'

const pcm = await readFile('./testdata/canon.pcm')
const silk = await encode(pcm, 24000)
await writeFile('./test.silk', silk.data)

Build wasm

cd binding
emcmake cmake .
emmake ninja