Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Dan Motzenbecker, MIT License
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.
ear-pipe relies on the cross-platform audio utility SoX, so make sure that's installed first.
$ npm install --save ear-pipe
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
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.
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.
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);
Kill an ear-pipe instance by calling its kill()
method. If you're interested
in the underlying SoX process, access .process
.
FAQs
Pipe audio streams to your ears.
The npm package ear-pipe receives a total of 0 weekly downloads. As such, ear-pipe popularity was classified as not popular.
We found that ear-pipe demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.