Skip to content

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

License

Notifications You must be signed in to change notification settings

mohamedebrahim96/PHP-Broadcast-radio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

6 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

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 - https://www.videolan.org/vlc/

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

Winamp - https://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

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages