Git Product home page Git Product logo

php-broadcast-radio's Introduction

PHP-Broadcast-radio

Autonomous streaming audio ,serveronline internet radio is free streaming music for your listening pleasure, as well as news and announcements. Description

Autonomous pseudo streaming audio server. It supports the shoutcast protocol for mainstream players. This will output streaming mpeg for all other players.

The script does not accept a single audio source, but uses lose audio files instead. It employs a trick to keep all the listeners in sync. Through a shuffled playlist with a fixed seed value, the script will always serve the same audio at the same time.

The advantage is low processor usage, because the audio has not to be transcoded on the fly.

Shoutcast protocol

The protocol is a bit of a hack. It's quite simple but there is almost no documentation on the interwebs. The protocol consists of two part: the mpeg audio and the metadata.

Audio stream

The stream is just a simple dump of concatenated MP3 files. To make it a bit more of a 'protocol' the header and the id3 tags are stripped of the file. So only the audiodata of a MP3 file used.

The metadata

Was a bit of a challege to reverse engineer. This was badly documented.

The raw audio stream (without headers and id3-tags) is spliced into chuncks the size of the buffer. The size is specified in the icy-metaint variable in the http header. Then the metadata is inserted at these point in a certain format. The metadata must have this payload:

StreamTitle='Artist - Song';

and has an null-character (0x00) to end the string. The string must be padded to the next 16th position. So the example has 28 character + 1 null-character. Makes: 29 characters. You'll have to append 3 extra null-characters.

Setup

Your audio must be transcoded to MP3 in your transmission bitrate. Please normalize and trim your audio to avoid silent parts. Put the audio in the music folder.

music.db

If the music.db is present it must be deleted after every change. This is a cache-file for the metadata of the audio.

Config

Edit the settings in the index.php

This is an example:

$settings = array( "name" => "Radio Demo", //Name of your radio station. "genre" => "Classic", //Does not have to be a MP3 genre, can be anything. "url" => $_SERVER["SCRIPT_URI"], //URL to the station, this is automatic generated by PHP. "bitrate" => 96, //Bitrate in kbps of the transmission. All audio but be transcoded to this bitrate. "music_directory" => "music/", //Folder where the audio is. "database_file" => "music.db", //Cache filename of the audio metadata. "buffer_size" => 16384, //Buffersize of the icy-data, not really important. Bigger buffer is less updates of the current song name. "max_listen_time" => 14400, //Maximum listen time of a user in seconds. Set to 4 hours. "randomize_seed" => 31337 //The seed of the pseudo random playlist. Must be set to a contant otherwise the clients won't be in sync. );

Usage

Point your audio player to the URL where you have installed this script.

Recommended players:

VLC - http://www.videolan.org/vlc/

iTunes - http://www.apple.nl/itunes/

Winamp - http://www.winamp.com/

Contact

Name: mohamed

Facebook: https://www.facebook.com/mohamedebrahim93

Note

this project is fork from this library

https://github.com/gadgetguru/PHP-Streaming-Audio

php-broadcast-radio's People

Contributors

mohamedebrahim96 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

php-broadcast-radio's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.