All Projects → rochars → alawmulaw

rochars / alawmulaw

Licence: MIT License
A-Law and mu-Law codecs in JavaScript.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to alawmulaw

StringConvert
A simple C++11 based helper for converting string between a various charset
Stars: ✭ 16 (-27.27%)
Mutual labels:  encode, decode
time decode
A timestamp and date decoder written for python 3
Stars: ✭ 24 (+9.09%)
Mutual labels:  encode, decode
Silk V3 Decoder
kn007's blog
Stars: ✭ 1,832 (+8227.27%)
Mutual labels:  encode, decode
He
A robust HTML entity encoder/decoder written in JavaScript.
Stars: ✭ 2,973 (+13413.64%)
Mutual labels:  encode, decode
morse
Morse Code Library in Go
Stars: ✭ 75 (+240.91%)
Mutual labels:  encode, decode
Androidcamera
🔥🔥🔥自定义Android相机(仿抖音 TikTok),其中功能包括视频人脸识别贴纸,美颜,分段录制,视频裁剪,视频帧处理,获取视频关键帧,视频旋转,添加滤镜,添加水印,合成Gif到视频,文字转视频,图片转视频,音视频合成,音频变声处理,SoundTouch,Fmod音频处理。 Android camera(imitation Tik Tok), which includes video editor,audio editor,video face recognition stickers, segment recording,video cropping, video frame processing, get the first video frame, key frame, v…
Stars: ✭ 2,112 (+9500%)
Mutual labels:  encode, decode
libutf8
A whatwg compliant UTF8 encoding and decoding library
Stars: ✭ 32 (+45.45%)
Mutual labels:  encode, decode
fastproto
FastProto is a binary data processing tool written in Java.
Stars: ✭ 65 (+195.45%)
Mutual labels:  encode, decode
record-encode-audio-from-browser
Record/Encode Audio on Browser using the WebAudio API and "ported" libraries.
Stars: ✭ 55 (+150%)
Mutual labels:  encode, codec
janus-gateway-live
RTMP edge speed with janus-gateway
Stars: ✭ 38 (+72.73%)
Mutual labels:  encode, decode
crypthash-net
CryptHash.NET is a .NET multi-target library to encrypt/decrypt/hash/encode/decode strings and files, with an optional .NET Core multiplatform console utility.
Stars: ✭ 33 (+50%)
Mutual labels:  encode, decode
FireSnapshot
A useful Firebase-Cloud-Firestore Wrapper with Codable.
Stars: ✭ 56 (+154.55%)
Mutual labels:  encode, decode
node-lei-proto
简单的Buffer编码/解析模块
Stars: ✭ 14 (-36.36%)
Mutual labels:  encode, decode
player-ffmpeg
Up to date tutorial of ffmpeg
Stars: ✭ 17 (-22.73%)
Mutual labels:  codec
android-opus-codec
Implementation of Opus encoder and decoder in C++ for android with JNI
Stars: ✭ 44 (+100%)
Mutual labels:  codec
bcg729-deb
(obsolete) Debian/Ubuntu package for the Bcg729 G.729 codec library
Stars: ✭ 14 (-36.36%)
Mutual labels:  codec
binary
Clojure API for binary format I/O using java's stream apis
Stars: ✭ 67 (+204.55%)
Mutual labels:  codec
neural-imaging
[CVPR'19, ICLR'20] A Python toolbox for modeling and optimization of photo acquisition & distribution pipelines (camera ISP, compression, forensics, manipulation detection)
Stars: ✭ 109 (+395.45%)
Mutual labels:  codec
qrcode-parser
A pure javascript QR code decoding library, accept PNG File object, PNG image url, image base64.
Stars: ✭ 44 (+100%)
Mutual labels:  decode
mr.boilerplate
Online app to generate Scala boilerplate
Stars: ✭ 32 (+45.45%)
Mutual labels:  codec

alawmulaw

Copyright (c) 2018-2019 Rafael da Silva Rocha.
https://github.com/rochars/alawmulaw

NPM version Docs Tests
Codecov Unix Build Windows Build Scrutinizer

A-Law and mu-Law codecs in JavaScript.

Install

npm install alawmulaw

Use

Browser

Use the alawmulaw.js file in the /dist folder:

<script src="alawmulaw.js"></script>
<script>
    // A-Law
    samples = alawmulaw.alaw.encode(samples);
    samples = alawmulaw.alaw.decode(samples);
    sample = alawmulaw.alaw.encodeSample(sample);
    sample = alawmulaw.alaw.decodeSample(sample);

    // mu-Law
    samples = alawmulaw.mulaw.encode(samples);
    samples = alawmulaw.mulaw.decode(samples);
    sample = alawmulaw.mulaw.encodeSample(sample);
    sample = alawmulaw.mulaw.decodeSample(sample);
</script>

Or get it from the jsDelivr CDN:

<script src="https://cdn.jsdelivr.net/npm/alawmulaw"></script>

Or get it from unpkg:

<script src="https://unpkg.com/alawmulaw"></script>

Node

Require from 'alawmulaw'

const alawmulaw = require('alawmulaw');

// Encode all the samples in a file
// Only 16-bit samples are supported
let aLawSamples = alawmulaw.alaw.encode(pcmSamples);

API

alawmulaw.alaw

/**
 * Encode a 16-bit linear PCM sample as 8-bit A-Law.
 * @param {number} sample A 16-bit PCM sample
 * @return {number}
 */
export function encodeSample(sample) {}

/**
 * Decode a 8-bit A-Law sample as 16-bit PCM.
 * @param {number} aLawSample The 8-bit A-Law sample
 * @return {number}
 */
export function decodeSample(aLawSample) {}

/**
 * Encode 16-bit linear PCM samples as 8-bit A-Law samples.
 * @param {!Int16Array} samples A array of 16-bit PCM samples.
 * @return {!Uint8Array}
 */
export function encode(samples) {}

/**
 * Decode 8-bit A-Law samples into 16-bit linear PCM samples.
 * @param {!Uint8Array} samples A array of 8-bit A-Law samples.
 * @return {!Int16Array}
 */
export function decode(samples) {}

alawmulaw.mulaw

/**
 * Encode a 16-bit linear PCM sample as 8-bit mu-Law.
 * @param {number} sample A 16-bit PCM sample
 * @return {number}
 */
export function encodeSample(sample) {}

/**
 * Decode a 8-bit mu-Law sample as 16-bit PCM.
 * @param {number} muLawSample The 8-bit mu-Law sample
 * @return {number}
 */
export function decodeSample(muLawSample) {}

/**
 * Encode 16-bit linear PCM samples into 8-bit mu-Law samples.
 * @param {!Int16Array} samples A array of 16-bit PCM samples.
 * @return {!Uint8Array}
 */
export function encode(samples) {}

/**
 * Decode 8-bit mu-Law samples into 16-bit PCM samples.
 * @param {!Uint8Array} samples A array of 8-bit mu-Law samples.
 * @return {!Int16Array}
 */
export function decode(samples) {}

References

https://github.com/torvalds/linux/blob/master/sound/core/oss/mulaw.c
https://github.com/deftio/companders
http://dystopiancode.blogspot.com.br/2012/02/pcm-law-and-u-law-companding-algorithms.html

LICENSE

Copyright (c) 2018-2019 Rafael da Silva Rocha.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].