https://github.com/ravenstine/ronald-raygun
Experiment with creating a rewind buffer for live audio
https://github.com/ravenstine/ronald-raygun
Last synced: about 2 months ago
JSON representation
Experiment with creating a rewind buffer for live audio
- Host: GitHub
- URL: https://github.com/ravenstine/ronald-raygun
- Owner: Ravenstine
- Created: 2017-05-23T04:37:38.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-01-30T04:41:21.000Z (over 7 years ago)
- Last Synced: 2025-02-10T08:31:54.304Z (4 months ago)
- Language: JavaScript
- Size: 22 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Ronald Raygun
=============This project currently exists as a proof of concept for allowing users to rewind the KPCC live broadcast stream.
## The Rewind Buffer
Ronald Raygun stores a large buffer of audio data in memory. It's simply a doubly-linked list that stores encoded audio frames in groups of seconds, which allows players to support concepts like "Go back 30 seconds" or "Play the current program from its start". Unlike podcasts, these functions are available immediately and keep the user connected to the station's live stream.
## Installation
### Prerequisites
- Node.js >= 7.0.0
### Install dependencies
`npm install`
## Use
Start the server by running `node index.js`. This will run two HTTPS endpoints, one for the MP3 stream and one for AAC.
*MP3*: `https://localhost:3003/stream/mp3`
*AAC*: `https://localhost:3003/stream/aac`
By default, those endpoints stream the broadcast in real time.
To rewind `n` number of seconds, say 30, provide an offset query parameter:
`https://localhost:3003/stream/mp3?offset=30`
Currently, the calculation is approximately to the second, though this is not currently accurate. It's close enough for now. How many encoded frames make up 1 second of audio depends on the codec being used, the bitrate, and the sample rate.