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 🙏

© 2024 – Pkg Stats / Ryan Hefner

wx-voice

v0.2.1

Published

Convert audio files between Tencent apps (Weixin / Wechat, QQ) and Silk codec with other general format such as MP3 and M4A

Downloads

57

Readme

wx-voice

Convert audio files between Tencent apps (Weixin / Wechat, QQ) and Silk codec with other general formats such as MP3 and M4A
(中文版可在 Github 找到)

Install

$ npm install wx-voice --save
$ npm install wx-voice -g
$ wx-voice compile

Prerequisites

  • Ffmpeg
  • Build tools
    (Installation steps can be found in Github repo)

CLI Usage

wx-voice <command> <options>

Example:
$ wx-voice decode -i input.silk -o output.mp3 -f mp3
$ wx-voice encode -i input.mp3 -o output.silk -f silk

CLI

Command:
  decode    decode to general audio format
  encode    encode from general audio format
  compile   compile wx-voice library
  clean     remove compiled library

Options:
  -i <input>    input file path
  -o <output>   output file path
  -f <format>   format of the output file
  --bitrate     bitrate of the output file
  --frequency   frequency of the output file
  --channels    channels of the output file

API Usage

// Initialize
const WxVoice = require('wx-voice');
var voice = new WxVoice();

// Error handler
voice.on("error", (err) => console.log(err));

// Decode silk to MP3
voice.decode(
    "input.silk", "output.mp3", { format: "mp3" },
    (file) => console.log(file));

// Output: "/path/to/output.mp3"

API

new WxVoice([tempFolder, [ffmpegPath]])

Initialize wxVoice object

| Parameter | Description | | ---------- | ----------- | | tempFolder | Folder of temporary files, default to system temporary | | ffmpegPath | Custom path to ffmpeg executables, default using $PATH |

decode(input, output, [options, [callback]])

Decode the audio to general formats

encode(input, output, [options, [callback]])

Encode the audio to silk/webm format

| Parameter | Description | | --------- | ------------------ | | input | Input audio path | | output | Output audio path | | options | Output options (JS Object), see Options | | callback | Callback with output as parameter when decode success, undefined otherwise |

voice.encode(
    "input.mp3", "output.silk", { format: "silk" },
    (file) => console.log(file));

// Output: "/path/to/output.silk"

duration(filePath, [callback])

Get the duration of the audio file
(Decode to general audio format before calling this method)

| Parameter | Description | | --------- | ---------------------- | | filePath | File path to the audio | | callback | Callback with duration of the audio in second as parameter when decode success, 0 otherwise |

voice.encode("output.mp3", (dur) => console.log(dur));
// Output: "10.290"

Options

Javascript Object to set options for the output file

| Parameter | Description | | --------- | ----------- | | format | Format to be encoded/decoded (silk, webm, mp3, m4a...), default parse from output | | bitrate | Bitrate of the output, bps unit | | frequency | Frequency of the output, Hz unit | | channels | Channels of the output, default to 1 |

File types

Decode: Tested on mp3, m4a, wav, pcm
Encode: Tested on silk, silk_amr, webm

License

MIT © Ang YC