All Projects → ArtskydJ → sox.js

ArtskydJ / sox.js

Licence: other
📢 NodeJS wrapper for the SoX audio tool

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to sox.js

sox-stream
📣 A stream-friendly wrapper around SoX
Stars: ✭ 50 (+177.78%)
Mutual labels:  mp3, sox, wav, flac, ogg, sox-stream
audio-metadata
A library for reading and, in the future, writing audio metadata. https://audio-metadata.readthedocs.io/
Stars: ✭ 41 (+127.78%)
Mutual labels:  mp3, wav, flac, ogg
uos
United Open-libraries of Sound. United procedures for open-source audio libraries. For FPC/Lazarus/fpGUI/MSEgui.
Stars: ✭ 112 (+522.22%)
Mutual labels:  mp3, wav, flac, ogg
java-stream-player
🌌Java Advanced Audio Controller Library (WAV, AU, AIFF, MP3, OGG VORBIS, FLAC, MONKEY's AUDIO and SPEEX audio formats )
Stars: ✭ 112 (+522.22%)
Mutual labels:  mp3, wav, flac, ogg
Atldotnet
Fully managed, portable and easy-to-use C# library to read and edit audio data and metadata (tags) from various audio formats, playlists and CUE sheets
Stars: ✭ 180 (+900%)
Mutual labels:  mp3, wav, flac
Audioplayer
Audio Player for Nextcloud and ownCloud
Stars: ✭ 179 (+894.44%)
Mutual labels:  mp3, wav, flac
Recorder
html5 js 录音 mp3 wav ogg webm amr 格式,支持pc和Android、ios部分浏览器、和Hybrid App(提供Android IOS App源码),微信也是支持的,提供H5版语音通话聊天示例 和DTMF编解码
Stars: ✭ 2,891 (+15961.11%)
Mutual labels:  mp3, wav, ogg
Esp8266audio
Arduino library to play MOD, WAV, FLAC, MIDI, RTTTL, MP3, and AAC files on I2S DACs or with a software emulated delta-sigma DAC on the ESP8266 and ESP32
Stars: ✭ 972 (+5300%)
Mutual labels:  mp3, wav, flac
flutter audio desktop
[WIP] An 🎵 audio playback library for Flutter Desktop. Supports Windows & Linux. Based on miniaudio.
Stars: ✭ 42 (+133.33%)
Mutual labels:  mp3, wav, flac
Libnyquist
🎤 Cross platform C++11 library for decoding audio (mp3, wav, ogg, opus, flac, etc)
Stars: ✭ 311 (+1627.78%)
Mutual labels:  mp3, wav, flac
Flacon
Audio File Encoder. Extracts audio tracks from an audio CD image to separate tracks.
Stars: ✭ 252 (+1300%)
Mutual labels:  mp3, wav, flac
Ni Media
NI Media is a C++ library for reading and writing audio streams.
Stars: ✭ 158 (+777.78%)
Mutual labels:  mp3, wav, flac
Audio Steganography Algorithms
A Library of Audio Steganography & Watermarking Algorithms
Stars: ✭ 146 (+711.11%)
Mutual labels:  mp3, wav, flac
Symphonia
Pure Rust multimedia format demuxing, tag reading, and audio decoding library
Stars: ✭ 191 (+961.11%)
Mutual labels:  mp3, wav, flac
Mediafile
A unified reader of metadata from audio & video files.
Stars: ✭ 138 (+666.67%)
Mutual labels:  mp3, wav, flac
Music Metadata
Stream and file based music metadata parser for node. Supporting a wide range of audio and tag formats.
Stars: ✭ 455 (+2427.78%)
Mutual labels:  mp3, wav, flac
Av Converter
[av-converter.com] Audio and Video Converter, and YouTube downloader. Convert to MP3, MP4, AAC, FLAC, AC3, WAV, etc.
Stars: ✭ 97 (+438.89%)
Mutual labels:  mp3, wav, flac
Youtube-DL-GUI
Graphical User Interace built around youtube-dl CLI
Stars: ✭ 38 (+111.11%)
Mutual labels:  mp3, wav, flac
libwinmedia
[Archived] A cross-platform simple media playback library for C/C++.
Stars: ✭ 35 (+94.44%)
Mutual labels:  mp3, flac, ogg
Format parser
file metadata parsing, done cheap
Stars: ✭ 46 (+155.56%)
Mutual labels:  mp3, wav, flac

sox.js

A wrapper around SoX. Transcode audio files easily!

Build Status

Examples

Simple transcode:

var sox = require('sox.js')
sox({
	inputFile: 'song.wav',
	outputFile: 'song.flac'
})

Lower volume:

var sox = require('sox.js')
sox({
	input: { volume: 0.8 },
	inputFile: 'song.flac',
	outputFile: 'song2.flac'
}, function done(err, outputFilePath) {
	console.log(err) // => null
	console.log(outputFilePath) // => song2.flac
})

Transcode with options and effects:

var sox = require('sox.js')
sox({
	soxPath: 'C:\\Program Files (x86)\\sox-14-4-2\\sox.exe',
	inputFile: 'song.ogg',
	output: {
		bits: 16,
		rate: 44100,
		channels: 2
	},
	outputFile: 'song.wav'
	effects: 'phaser 0.6 0.66 3 0.6 2 −t'
}, function done(err, outputFilePath) {
	console.log(err) // => null
	console.log(outputFilePath) // => song.wav
})

API

var sox = require('sox.js')

sox(options, [cb])

  • options object required - The following parameters are supported:
    • soxPath string optional - The path to SoX. E.g. 'C:\Program Files\Sox\sox.exe'. Defaults to 'sox', which works if the SoX binary is in your path.
    • errOnStderr boolean optional - SoX sometimes logs warnings to stderr. By default, sox.js will call the callback with an error. If you set this to false, then the errors will be passed along to process.stderr, and the callback will not be called with an error. Defaults to true.
    • global object optional - Global SoX options
    • inputFile string required - The file path of the input file
    • outputFile string required - The file path of the output file
    • input object optional - These options will be used to interpret the incoming stream.
    • output object optional - These options will be used to format the outgoing stream. When an output option isn't supplied, the output file will have the same format as the input file where possible.
    • effects string|array of strings/numbers optional
  • cb(err, outputFilePath) function optional - A function that is called when the conversion process is complete. If omitted, errors are thrown. The function is passed the following parameters:
    • err null|Error
    • outputFilePath string|undefined - A string of the outgoing file path, or undefined if an error occurred. E.g. 'song.flac'.

options object

An object of options. Every option is optional except options.inputFile and options.outputFile.

If you want an exhaustive list of each option in depth, take a look at the SoX documentation.

Internally, these options are transformed into the command-line arguments passed to a SoX child process.

options.inputFile / options.outputFile string, required

A file path, like './song.wav'.

options.global object|array of strings/numbers

You can supply an array of strings/numbers, or an object that will be transformed into an array of strings/numbers using hash-to-array.

Currently, sox.js only supports one input file.

Command(s) Functionality
{ buffer: BYTES } Set the size of all processing buffers (default 8192)
{ 'no-dither': true } Don't dither automatically
{ 'effects-file': FILENAME } File containing effects and options
{ guard: true } Use temporary files to guard against clipping
{ 'input-buffer': BYTES } Override the input buffer size (default: same as --buffer; 8192)
{ norm: true } Guard (see --guard) & normalise
{ 'play-rate-arg': ARG } Default rate argument for auto-resample with 'play'
{ plot: 'gnuplot' OR 'octave' } Generate script to plot response of filter effect
{ 'replay-gain': 'track' OR 'album' OR 'off' } Default: 'off' (sox, rec), track (play)
{ R: true } "Repeatable" mode. Uses default random numbers (same on each run of SoX)
{ 'single-threaded': true } Disable parallel effects channels processing
{ temp: DIRECTORY } Specify the directory to use for temporary files
sox({
	global: {
		buffer: 4096,
		norm: true,
		'single-threaded': true
	},
	output: { type: 'ogg' }
}, cb)

options.input / options.output object|array of strings/numbers

You can supply an array of strings/numbers, or an object that will be transformed into an array of strings/numbers using hash-to-array.

Input Output Command(s) Functionality
X { volume: FACTOR } Input file volume adjustment factor (Floating point number between 0 and 1)
X { 'ignore-length': true } Ignore input file length given in header; read to EOF
{ type: FILETYPE } Audio file type. E.g. 'wav', 'ogg'
{ encoding: ENCODING } ENCODING can be 'signed-integer', 'unsigned-integer', 'floating-point', 'mu-law', 'a-law', 'ima-adpcm', 'ms-adpcm', or 'gsm-full-rate'
{ bits: BITS } Encoded sample size in bits, A.K.A. the bit depth. E.g. 16, 24. (Not applicable to complex encodings such as MP3 or GSM.)
{ 'reverse-nibbles': true } Encoded nibble-order
{ 'reverse-bits': true } Encoded bit-order
{ endian: 'little' } Encoded byte-order: Little endian
{ endian: 'big' } Encoded byte-order: Big endian
{ endian: 'swap' } Encoded byte-order: swap means opposite to default
{ channels: CHANNELS } Number of channels of audio data. E.g. 2 for stereo
{ 'no-glob': true } Don't 'glob' wildcard match the following filename
{ rate: RATE } Sample rate of audio. E.g. 44100, 48000
X { compression: FACTOR } Compression factor. See SoX format docs for more information.
X { 'add-comment': TEXT } Append output file comment
X { comment: TEXT } Specify comment text for the output file
X { 'comment-file': FILENAME } File containing comment text for the output file
sox({
	input: [
		[ '--volume', 1.1 ],
		[ '--endian', 'big' ],
		[ '--no-glob' ]
	],
	output: { type: 'ogg' }
}, cb)
// same as
sox({
	input: {
		volume: 1.1,
		endian: 'big',
		'no-glob': true
	],
	output: [
		'--type', 'ogg'
	]
}, cb)
// same as
sox({
	input: '--volume 1.1 --endian big --no-glob',
	output: '--type ogg'
}, cb)

options.effects string|array of strings/numbers/arrays

Please see the SoX Documentation on Effects to see all the options.

You can put strings/numbers into sub-arrays, which will be flattened internally.

Pass them into sox.js like this:

sox({
	input: { type: 'ogg' },
	output: { type: 'wav' },


	effects: 'speed 1.5 swap'
	// same as
	effects: [
		'speed 1.5 swap'
	]
	// same as
	effects: [
		'speed', 1.5,
		'swap'
	]
	// same as
	effects: [
		[ 'speed', '1.5' ],
		'swap'
	]
}, cb)

Install

  • Install SoX. You can download it, or you can do apt-get install sox.
  • Install this package with npm: npm install sox

Test

To run the tests, you must also have SoX in your PATH. Then run: npm test

I run the tests using SoX 14.4.2, but other versions of SoX should work fine.

Codec Support

FLAC

MP3

License

MIT

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].