{"_id":"@binsee/wx-voice","_rev":"3-a047229c179d32b7c367d18989f4eb8d","name":"@binsee/wx-voice","dist-tags":{"latest":"0.3.2"},"versions":{"0.3.0":{"name":"@binsee/wx-voice","version":"0.3.0","keywords":["wechat","weixin","mini","program","silk","slk","convert","converter","decode","decoder","encode","encoder"],"author":{"url":"https://angyc.com/","name":"AngYC","email":"me@angyc.com"},"license":"MIT","_id":"@binsee/wx-voice@0.3.0","maintainers":[{"name":"binsee","email":"binsee.li+npm@gmail.com"}],"homepage":"https://github.com/binsee/wx-voice","bugs":{"url":"https://github.com/binsee/wx-voice/issues"},"bin":{"wx-voice":"dist/bin.js"},"dist":{"shasum":"1fa7e28c36af706c3131a0b9be0f42924de54f96","tarball":"https://registry.npmjs.org/@binsee/wx-voice/-/wx-voice-0.3.0.tgz","fileCount":10,"integrity":"sha512-dAJ5oTcRa1XGubPmx1v603zaD0fc4vj4GyI/nolpTvyQPgW+xP4XvBgOOA8JTSdBz51tQCK0rY3juXk5PucIkA==","signatures":[{"sig":"MEYCIQC/k0TZ10T6us2QXLXmTpwxcOSh4SNH+54vxoJDeqJP4QIhAOhCifyXUcDZmNYIuwBM8avMdwICBt+Ul2pVu8tq9fHS","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":38271},"jest":{"preset":"ts-jest","testMatch":["**/tests/**/*.test.ts"],"transform":{"^.+.tsx?$":["ts-jest",{"tsconfig":"tsconfig.test.json"}]},"testEnvironment":"node"},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"dd41dead287c2d309cd04857902081abc3af1926","scripts":{"test":"jest --runInBand","build":"tsc","prepare":"tsc","build:silk":"make -C silk"},"_npmUser":{"name":"binsee","email":"binsee.li+npm@gmail.com"},"repository":{"url":"git+https://github.com/binsee/wx-voice.git","type":"git"},"_npmVersion":"10.8.2","description":"Convert audio files between Tencent apps (Weixin / Wechat, QQ) and Silk codec with other general format such as MP3 and M4A","directories":{},"_nodeVersion":"20.20.2","dependencies":{"randomatic":"^1.1.7","read-chunk":"^2.1.0","cli-spinner":"^0.2.6","strong-data-uri":"^1.0.4","command-line-args":"^4.0.7","@ffmpeg-installer/ffmpeg":"1.1.0","@ffprobe-installer/ffprobe":"2.1.2"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.3.0","ts-jest":"^29.4.9","ts-node":"^10.9.2","typescript":"^6.0.3","@types/jest":"^30.0.0","@types/node":"^25.6.0","@types/randomatic":"^3.1.5","@types/command-line-args":"^5.2.3"},"optionalDependencies":{"@binsee/wx-voice-silk-linux-x64":"0.3.0","@binsee/wx-voice-silk-win32-x64":"0.3.0","@binsee/wx-voice-silk-darwin-x64":"0.3.0","@binsee/wx-voice-silk-linux-arm64":"0.3.0","@binsee/wx-voice-silk-win32-arm64":"0.3.0","@binsee/wx-voice-silk-darwin-arm64":"0.3.0"},"_npmOperationalInternal":{"tmp":"tmp/wx-voice_0.3.0_1777389833004_0.8054452527627269","host":"s3://npm-registry-packages-npm-production"}},"0.3.1":{"name":"@binsee/wx-voice","version":"0.3.1","keywords":["wechat","weixin","mini","program","silk","slk","convert","converter","decode","decoder","encode","encoder"],"author":{"url":"https://angyc.com/","name":"AngYC","email":"me@angyc.com"},"license":"MIT","_id":"@binsee/wx-voice@0.3.1","maintainers":[{"name":"binsee","email":"binsee.li+npm@gmail.com"}],"homepage":"https://github.com/binsee/wx-voice","bugs":{"url":"https://github.com/binsee/wx-voice/issues"},"bin":{"wx-voice":"dist/bin.js"},"dist":{"shasum":"7b1f8b27c21c67b04ef2252bdd6240a3cd0ded65","tarball":"https://registry.npmjs.org/@binsee/wx-voice/-/wx-voice-0.3.1.tgz","fileCount":10,"integrity":"sha512-cWUl7Bb8rR4wT+N5b/75tgdD1vXQb6KfC7Jrer7Ms5FToABtXiULy1gKGy31RJLy6qFCtt45ejPw2AvSifDxQQ==","signatures":[{"sig":"MEYCIQCKLMqXqOB4P41EP32iwROrhybA/8PPRMWRr6w+TSXVAgIhAK8Q9mvWwjvLUOe4YaeHWFdOIMgDciCGWwyjsOB61b6m","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":38271},"jest":{"preset":"ts-jest","testMatch":["**/tests/**/*.test.ts"],"transform":{"^.+.tsx?$":["ts-jest",{"tsconfig":"tsconfig.test.json"}]},"testEnvironment":"node"},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"e1c00da8a3324d9e9c55b86894b317c30edd13cf","scripts":{"test":"jest --runInBand","build":"tsc","prepare":"tsc","build:silk":"make -C silk"},"_npmUser":{"name":"binsee","email":"binsee.li+npm@gmail.com"},"repository":{"url":"git+https://github.com/binsee/wx-voice.git","type":"git"},"_npmVersion":"10.8.2","description":"Convert audio files between Tencent apps (Weixin / Wechat, QQ) and Silk codec with other general format such as MP3 and M4A","directories":{},"_nodeVersion":"20.20.2","dependencies":{"randomatic":"^1.1.7","read-chunk":"^2.1.0","cli-spinner":"^0.2.6","strong-data-uri":"^1.0.4","command-line-args":"^4.0.7","@ffmpeg-installer/ffmpeg":"1.1.0","@ffprobe-installer/ffprobe":"2.1.2"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.3.0","ts-jest":"^29.4.9","ts-node":"^10.9.2","typescript":"^6.0.3","@types/jest":"^30.0.0","@types/node":"^25.6.0","@types/randomatic":"^3.1.5","@types/command-line-args":"^5.2.3"},"optionalDependencies":{"@binsee/wx-voice-silk-linux-x64":"0.3.1","@binsee/wx-voice-silk-win32-x64":"0.3.1","@binsee/wx-voice-silk-darwin-x64":"0.3.1","@binsee/wx-voice-silk-linux-arm64":"0.3.1","@binsee/wx-voice-silk-win32-arm64":"0.3.1","@binsee/wx-voice-silk-darwin-arm64":"0.3.1"},"_npmOperationalInternal":{"tmp":"tmp/wx-voice_0.3.1_1779193948847_0.04123260961791675","host":"s3://npm-registry-packages-npm-production"}},"0.3.2":{"name":"@binsee/wx-voice","version":"0.3.2","description":"Convert audio files between Tencent apps (Weixin / Wechat, QQ) and Silk codec with other general format such as MP3 and M4A","keywords":["wechat","weixin","mini","program","silk","slk","convert","converter","decode","decoder","encode","encoder"],"main":"dist/index.js","types":"dist/index.d.ts","homepage":"https://github.com/binsee/wx-voice","license":"MIT","author":{"name":"AngYC","email":"me@angyc.com","url":"https://angyc.com/"},"bin":{"wx-voice":"dist/bin.js"},"scripts":{"build":"tsc","build:silk":"make -C silk","prepare":"tsc","test":"jest --runInBand"},"repository":{"type":"git","url":"git+https://github.com/binsee/wx-voice.git"},"dependencies":{"@ffmpeg-installer/ffmpeg":"1.1.0","@ffprobe-installer/ffprobe":"2.1.2","cli-spinner":"^0.2.6","command-line-args":"^4.0.7","randomatic":"^1.1.7","read-chunk":"^2.1.0","strong-data-uri":"^1.0.4"},"devDependencies":{"@types/command-line-args":"^5.2.3","@types/jest":"^30.0.0","@types/node":"^25.6.0","@types/randomatic":"^3.1.5","jest":"^30.3.0","ts-jest":"^29.4.9","ts-node":"^10.9.2","typescript":"^6.0.3"},"jest":{"preset":"ts-jest","testEnvironment":"node","testMatch":["**/tests/**/*.test.ts"],"transform":{"^.+.tsx?$":["ts-jest",{"tsconfig":"tsconfig.test.json"}]}},"optionalDependencies":{"@binsee/wx-voice-silk-linux-x64":"0.3.2","@binsee/wx-voice-silk-linux-arm64":"0.3.2","@binsee/wx-voice-silk-darwin-x64":"0.3.2","@binsee/wx-voice-silk-darwin-arm64":"0.3.2","@binsee/wx-voice-silk-win32-x64":"0.3.2","@binsee/wx-voice-silk-win32-arm64":"0.3.2"},"_id":"@binsee/wx-voice@0.3.2","gitHead":"bcc86b0942ea1c71006478802267f7da335774a8","bugs":{"url":"https://github.com/binsee/wx-voice/issues"},"_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-N21+Cxck47JuNLNdQj27VPmEbEOBL7TbWfSi/AJc7P+0Nj8T08+qJ5VfMSXr1bXIz9jYvsZsSFqmocciM2S+kQ==","shasum":"f38726c4cef7a72feb382d400e3aaca18f640c0e","tarball":"https://registry.npmjs.org/@binsee/wx-voice/-/wx-voice-0.3.2.tgz","fileCount":10,"unpackedSize":38271,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQD40fmJMnFvd+iiWlMIkRtaJSX1+tGte/Z0K8XDfzJXNAIgKIzbC6oMPGGcT2diPy9vEFe9DKSqYhYhWARw64ZEZSI="}]},"_npmUser":{"name":"binsee","email":"binsee.li+npm@gmail.com"},"directories":{},"maintainers":[{"name":"binsee","email":"binsee.li+npm@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/wx-voice_0.3.2_1779196984951_0.030417298080481325"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-28T15:23:52.615Z","modified":"2026-05-19T13:23:05.240Z","0.3.0":"2026-04-28T15:23:53.148Z","0.3.1":"2026-05-19T12:32:29.051Z","0.3.2":"2026-05-19T13:23:05.127Z"},"bugs":{"url":"https://github.com/binsee/wx-voice/issues"},"author":{"name":"AngYC","email":"me@angyc.com","url":"https://angyc.com/"},"license":"MIT","homepage":"https://github.com/binsee/wx-voice","keywords":["wechat","weixin","mini","program","silk","slk","convert","converter","decode","decoder","encode","encoder"],"repository":{"type":"git","url":"git+https://github.com/binsee/wx-voice.git"},"description":"Convert audio files between Tencent apps (Weixin / Wechat, QQ) and Silk codec with other general format such as MP3 and M4A","maintainers":[{"name":"binsee","email":"binsee.li+npm@gmail.com"}],"readme":"# wx-voice [![npm](https://img.shields.io/npm/v/wx-voice.svg?colorB=4c1)](https://www.npmjs.com/package/wx-voice)\n\nConvert audio files between Tencent apps (Weixin / WeChat, QQ) and Silk codec with other general formats such as MP3 and M4A.\n\n[中文版](README.cn.md)\n\n> This project is a maintained fork of [Ang-YC/wx-voice](https://github.com/Ang-YC/wx-voice) by [AngYC](https://angyc.com/). Many thanks to the original author for the foundational work.\n\n---\n\n## Install\n\n```\nnpm install wx-voice --save\n```\n\nNo additional compilation step required. Pre-compiled Silk SDK binaries are automatically installed for your platform.\n\n### Supported Platforms\n\n| Platform | Architecture |\n|----------|-------------|\n| Linux    | x64, arm64  |\n| macOS    | x64, arm64  |\n| Windows  | x64, arm64  |\n\n> **Unsupported platform?** Clone the repository and run `make -C silk`. The library will automatically detect and use the locally compiled binaries.\n\n---\n\n## Prerequisites\n\nFFmpeg is bundled automatically via [`@ffmpeg-installer/ffmpeg`](https://www.npmjs.com/package/@ffmpeg-installer/ffmpeg) and [`@ffprobe-installer/ffprobe`](https://www.npmjs.com/package/@ffprobe-installer/ffprobe). No manual FFmpeg installation is required.\n\n---\n\n## CLI Usage\n\n```\nwx-voice <command> <options>\n```\n\n```\nExample:\n$ wx-voice decode -i input.silk -o output.mp3 -f mp3\n$ wx-voice encode -i input.mp3 -o output.silk -f silk\n```\n\n### Commands\n\n```\nCommand:\n  decode    decode to general audio format\n  encode    encode from general audio format\n  duration  get duration of audio file\n\nOptions:\n  -i <input>    input file path\n  -o <output>   output file path\n  -f <format>   format of the output file\n  --bitrate     bitrate of the output file\n  --frequency   frequency of the output file\n  --channels    channels of the output file\n```\n\n---\n\n## API Usage\n\n```js\nconst WxVoice = require('wx-voice');\nconst voice = new WxVoice();\n\n// Error handler\nvoice.on('error', (err) => console.log(err));\n\n// Decode silk to MP3\nvoice.decode('input.silk', 'output.mp3', { format: 'mp3' })\n    .then((file) => console.log(file));\n// Output: \"/path/to/output.mp3\"\n\n// Encode MP3 to silk\nvoice.encode('input.mp3', 'output.silk', { format: 'silk' })\n    .then((file) => console.log(file));\n// Output: \"/path/to/output.silk\"\n\n// Get duration of a silk file\nvoice.duration('input.silk')\n    .then((seconds) => console.log(seconds));\n// Output: 10.24\n```\n\n## API\n\n### new WxVoice([tempFolder])\n\n| Parameter  | Description |\n| ---------- | ----------- |\n| tempFolder | Folder for temporary files, defaults to system temp |\n\nThrows if Silk SDK binaries are not found (unsupported platform without local build).\n\n### decode(input, output, [options])\n\nDecode a Silk/WebM audio file to a general format (mp3, m4a, wav, pcm, etc.).\n\nReturns `Promise<string>` — resolves with the output file path on success.\n\n```js\nvoice.decode('input.silk', 'output.mp3')\nvoice.decode('input.silk', 'output.pcm', { format: 'pcm', frequency: 16000 })\n```\n\n### encode(input, output, [options])\n\nEncode a general audio file to Silk or WebM format.\n\nReturns `Promise<string>` — resolves with the output file path on success.\n\n```js\nvoice.encode('input.mp3', 'output.silk', { format: 'silk' })\nvoice.encode('input.mp3', 'output.silk', { format: 'silk_amr' })  // AMR-compatible header\nvoice.encode('input.mp3', 'output.webm', { format: 'webm' })      // base64 data URI\n```\n\n### duration(filePath)\n\nGet the duration of an audio file in seconds.\n\n- For Silk files: parsed directly from the binary frame structure (no FFmpeg needed)\n- For other formats: uses FFprobe\n\nReturns `Promise<number>` — resolves with `0` if the file cannot be read.\n\n```js\nvoice.duration('input.silk').then((s) => console.log(s + 's'))\n```\n\n### Options\n\n| Parameter | Description |\n| --------- | ----------- |\n| format    | Output format (`silk`, `silk_amr`, `webm`, `mp3`, `m4a`, `wav`, `pcm`...), default parsed from output file extension |\n| bitrate   | Bitrate in kbps |\n| frequency | Sample rate in Hz (e.g. `16000`, `24000`, `44100`) |\n| channels  | Number of channels, default `1` |\n\n---\n\n## File types\n\n**Decode:** Tested on `mp3`, `m4a`, `wav`, `pcm`\n**Encode:** Tested on `silk`, `silk_amr`, `webm`\n\n---\n\n## Unsupported platform\n\nIf your platform is not in the supported list, you can build the Silk SDK locally:\n\n```bash\ngit clone https://github.com/binsee/wx-voice.git\ncd wx-voice\nnpm install\nnpm run build:silk\n```\n\nThe library will automatically detect and use the locally compiled binaries at `silk/encoder` and `silk/decoder`.\n\n---\n\n## License\n\nMIT © [binsee](https://github.com/binsee)\n\nOriginal work MIT © [Ang YC](https://angyc.com)\n","readmeFilename":"README.md"}