All Projects → dmotz → ear-pipe

dmotz / ear-pipe

Licence: MIT License
Pipe audio streams to your ears

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to ear-pipe

sox-stream
📣 A stream-friendly wrapper around SoX
Stars: ✭ 50 (+194.12%)
Mutual labels:  stream, sox
WebRTCCTV
WebRTCCTV is a signaling server & webapp able to stream from RTSP cameras using WebRTC
Stars: ✭ 32 (+88.24%)
Mutual labels:  stream
simple-concat
Super-minimalist version of `concat-stream`. Less than 15 lines!
Stars: ✭ 21 (+23.53%)
Mutual labels:  stream
prox
A Scala library for working with system processes
Stars: ✭ 93 (+447.06%)
Mutual labels:  stream
twitchpipe
Pipe your favorite Twitch streams to the media player of your choice, or a file to save them for later. Supports low-latency playback.
Stars: ✭ 28 (+64.71%)
Mutual labels:  stream
scte35-threefive
threefive is the highest rated SCTE35 parser, ever. maybe.
Stars: ✭ 75 (+341.18%)
Mutual labels:  stream
pv
Unix Pipe Viewer (pv) utility in Node.js
Stars: ✭ 20 (+17.65%)
Mutual labels:  stream
MwK-Musics
A Telegram Bot to Play Audio in Voice Chats With Youtube and Deezer support. Supports Live streaming from youtube Supports Mega Radio Fm Streamings
Stars: ✭ 38 (+123.53%)
Mutual labels:  stream
playercast
Cast to media player and control playback remotely.
Stars: ✭ 46 (+170.59%)
Mutual labels:  stream
php-bpm-detect
php class for bpm detection
Stars: ✭ 22 (+29.41%)
Mutual labels:  sox
gnip
Connect to Gnip streaming API and manage rules
Stars: ✭ 28 (+64.71%)
Mutual labels:  stream
ngx stream upstream check module
nginx health checker (tcp/udp/http) for stream upstream servers.
Stars: ✭ 18 (+5.88%)
Mutual labels:  stream
sms
rtmp server and super media server whith golang.
Stars: ✭ 65 (+282.35%)
Mutual labels:  stream
firebase
Firebase Go REST SDK
Stars: ✭ 22 (+29.41%)
Mutual labels:  stream
vidi
<video> playback simplified
Stars: ✭ 31 (+82.35%)
Mutual labels:  stream
parallel stream
A parallelized stream implementation for Elixir
Stars: ✭ 86 (+405.88%)
Mutual labels:  stream
secure-webrtc-swarm
💢 Create a swarm of p2p connections with invited peers using WebRTC.
Stars: ✭ 23 (+35.29%)
Mutual labels:  stream
kinetic
High-Performance AWS Kinesis Client for Go
Stars: ✭ 20 (+17.65%)
Mutual labels:  stream
TLightFileStream
Implements a lightweight, high-performance, non-allocating advanced-record-based wrapper around the SysUtils file handling routines as an alternative to Classes.TFileStream.
Stars: ✭ 21 (+23.53%)
Mutual labels:  stream
pcap-processor
Read and process pcap files using this nifty tool
Stars: ✭ 36 (+111.76%)
Mutual labels:  stream

ear-pipe

Pipe audio streams to your ears

Dan Motzenbecker, MIT License

@dcmotz

Concept

ear-pipe is a duplex stream that allows you to pipe any streaming audio data to your ears (by default), handling any decoding automatically for most formats. You can also leverage this built-in decoding by specifying an output encoding and pipe the output stream somewhere else.

Installation

ear-pipe relies on the cross-platform audio utility SoX, so make sure that's installed first.

$ npm install --save ear-pipe

Usage

var EarPipe = require('ear-pipe'),
    ep      = new EarPipe(/* <type>, <bitrate>, <transcode-type> */);

When arguments are omitted (e.g. ep = new EarPipe;), the type defaults to 'mp3', the bitrate defaults to 16, and the third argument is null indicating that the pipe destination is your ears rather than a transcoded stream.

If your input encoding isn't mp3, make sure you set it to one of the formats supported by SoX:

8svx aif aifc aiff aiffc al amb au avr cdda cdr cvs cvsd cvu dat dvms f32 f4 f64
f8 fssd gsm gsrt hcom htk ima ircam la lpc lpc10 lu maud mp2 mp3 nist prc raw s1
s16 s2 s24 s3 s32 s4 s8 sb sf sl sln smp snd sndr sndt sou sox sph sw txw u1 u16
u2 u24 u3 u32 u4 u8 ub ul uw vms voc vox wav wavpcm wve xa

Examples

HTTP Stream

Let's pipe some number station audio to our ears right as it comes off the wire:

http.get(
  'http://ia700500.us.archive.org/12/items/ird059/tcp_d1_06_the_lincolnshire_poacher_mi5_irdial.mp3',
  function(res) { res.pipe(new EarPipe) });

If your connection and speakers work, you should hear it as it downloads.

Nondeterministic DJ Set

Let's send multiple audio streams to the same ear-pipe:

var ep      = new EarPipe,
    telstar = fs.createReadStream('./telstar.mp3'),
    cream   = fs.createReadStream('./cream.mp3');

http.get('http://127.0.0.1/sirens.mp3', function(res) { res.pipe(ep) });
telstar.pipe(ep);
cream.pipe(ep);

Since only one chunk passes through at a time, this DJ set should have plenty of cuts.

Transcode

Since we're decoding the audio on the fly, we can specify that we'd like to use that output for another destination besides our ears:

// null arguments mean defaults, true implies default output encoding (wav)
var ep    = new EarPipe(null, null, true),
    hotel = fs.createReadStream('./hotel.mp3');

hotel.pipe(ep).pipe(fs.createWriteStream('./hotel.wav'));

Or pipe to another process:

var ep      = new EarPipe('wav'),
    epTrans = new EarPipe(null, null, true),
    audio   = someStreamingNetworkData();

audio.pipe(epTrans).pipe(ep);
epTrans.pipe(anotherStreamingAudioConsumer);

Killing

Kill an ear-pipe instance by calling its kill() method. If you're interested in the underlying SoX process, access an instance's .process property.

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