Creates a PCM 16 bit Little Endian Stream from a mp3 file or youtube video
sudo apt-get install libasound2-dev ffmpeg
yarn add create-music-stream
const createMusicStream = require('create-music-stream')
const stream = createMusicStream(source, logger)
const Speaker = require('speaker')
const createMusicStream = require('create-music-stream')
createMusicStream('./track.mp3', console.log)
.pipe(new Speaker())
const Speaker = require('speaker')
const createMusicStream = require('create-music-stream')
createMusicStream('https://www.youtube.com/watch?v=fz4MzJTeL0c', console.log)
.pipe(new Speaker())
- 1.0 - First public version
- 1.1 - Adds tests, Adds standard.js, Enables gh-actions, Upgrades deps
- 1.2 - Upgrades deps
- 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')
- chrvadala (author)
- cihadturhan