Flexible live streaming for broadcast audio.
Want to see pretty graphs? Log in now!
npm install streammachine
|1||downloads in the last week|
|5||downloads in the last month|
|Last Published By|
|Version||0.3.2 last updated 3 months ago|
|Keywords||audio, broadcast, shoutcast, icecast|
|Dependencies (27)||coffee-script, express, icecast, nconf, prettydate, redis, socket.io, socket.io-client, strtok, underscore, winston, cube, haml-coffee, mincer, express-api-helper, node-uuid, less, passport, passport-local, passport-http, password-hash, nodemailer, concentrate, dissolve, campfire, pagerduty, temp|
,---. ,--. ,--. ,--. ,--. ,--.
' .-,-' '-,--.--.,---. ,--,--,--,--,--|
.' |,--,--.,---| ,---.--,--,--, ,---.
.-'-. .-| .--| .-. ' ,-. | | |'.'| ' ,-. | .--| .-. ,--| | .-. :
.-' || | | | \ --\ '-' | | | | | | \ '-' \ `--| | | | | || \ --.
`-----' `--' `--' `----'`--`--`--`--`--`--' `--'`--`--'`---`--' `--`--`--''--'`----'
StreamMachine is an open-source streaming audio server aimed at pushing innovation for radio stations that have spent too many years running old technology like Shoutcast and Icecast.
The project has two goals: emulating the traditional streaming experience and building support for new features that push the radio listening experience forward.
The Rewind Buffer
StreamMachine's big idea is keeping a big buffer of audio data in memory, allowing clients to connect to "nearly-live" radio. Because audio data is relatively small, a station can easily keep hours of audio in memory. For instance, a 64k MP3 stream will store 8 hours of audio data in just a little over 200MB of memory.
Using the Rewind Buffer, players can add support for concepts like "Play the current program from its start", or "Play the 9am broadcast." Unlike podcasts, these functions are available immediately and keep the user connected to the station's live stream.
You can read more about the implementation of the RewindBuffer in the wiki.
StreamMachine is a Node.js application. It can run on one server, or in a master-slave configuration for load-balancing. StreamMachine is designed for Node 0.10.
Static configuration can be done via a JSON configuration file. Configuration changes will not be written back to the file.
For a dynamic configuration, StreamMachine can store its stream information on a Redis server.
Two modes are supported for incoming audio:
Icecast Source: The
SourceInmodule emulates the Icecast server's source handling, allowing source clients to connect to a mount point and provide a source password.
ProxyRoommodule can connect to an existing Icecast server and proxy its stream through the StreamMachine infrastructure.
Currently, MP3 and AAC streams are supported.
StreamMachine can operate as a single process or in a master-slave configuration.
Standalone: One process manages both incoming and outgoing audio. For development and small installations.
Master: Master handles source connections and configuration. Provides the admin UI and centralizes logging from slave processes. Handles no client traffic.
Slave: Slave handles all client requests. Stream audio is proxied from the master over a single socket connection.
For more, see the Mode documentation in the wiki.
Shoutcast outputs provide traditional output streams.
Pumper output allows a chunk of audio to be downloaded as quick as
Sockets output creates an audio stream that can seek through the Rewind
Buffer without having to reconnect.
Alerts are intended to provide a heads-up when something's going wrong in the streaming process. A similar alert will fire when the condition is ended. Where logging is intended to signal an event, alerts are about signalling that a condition exists.
Alerts can be sent via email or Pagerduty.
Emits 30 seconds after a monitored stream loses its only source connection.
Emits when a slave has been unable to connect to the master server for more than 30 seconds.
StreamMachine uses nconf to load configuration settings from a JSON file, from environment variables and from the command line.
For more, see the full documentation of configuration options.
StreamMachine isn't the most user-friendly piece of software to install at the moment, but there are two options for quickly getting something running that you can play with:
To run StreamMachine locally with no service dependencies, try the included
config/standalone.json. To do so:
- Install Node.js v0.10
- Download the StreamMachine repository
npm installto install the Node modules that we depend on
./streammachine-cmd --config ./config/standalone.jsonto start the StreamMachine service
Connect to the admin by going to http://localhost:8001/admin and using admin/admin. There is an MP3 stream configured at /test, with the source password "testing". The source input listener is on port 8002, and that is where the broadcast should be pointed.
You can also use the Vagrantfile included in streammachine-cookbook to install a standalone configuration in a virtual machine.