Skip to content

Creates a PCM 16 bit Little Endian Stream from a mp3 file or youtube video

License

Notifications You must be signed in to change notification settings

chrvadala/create-music-stream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

create-music-stream

Creates a PCM 16 bit Little Endian Stream from a mp3 file or youtube video

chrvadala Test Coverage Status npm Downloads Donate

Usage

1. Install native dependencies

sudo apt-get install libasound2-dev ffmpeg

2. Install package

yarn add create-music-stream

3. Get music stream

const createMusicStream = require('create-music-stream')
const stream = createMusicStream(source, logger)

Examples

Stream local MP3 file

const Speaker = require('speaker')
const createMusicStream = require('create-music-stream')

createMusicStream('./track.mp3', console.log)
  .pipe(new Speaker())

Stream Youtube audio

const Speaker = require('speaker')
const createMusicStream = require('create-music-stream')

createMusicStream('https://www.youtube.com/watch?v=fz4MzJTeL0c', console.log)
  .pipe(new Speaker())

Changelog

  • 1.0 - First public version
  • 1.1 - Adds tests, Adds standard.js, Enables gh-actions, Upgrades deps
  • 1.2 - Upgrades deps

FAQ

  • If the YouTube player doesn't work read this article What if it stops working?
  • If speaker dependency is unable to build read this doc Audio Backend Selection
  • If you want to force ffmpeg binary path you can force it with the following code snippet
require('fluent-ffmpeg')
  .setFfmpegPath('/your/path/to/ffmpeg')

Contributors

About

Creates a PCM 16 bit Little Endian Stream from a mp3 file or youtube video

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project