Amiga-Programme
aus eigener "Ernte"
     
  Zerius Vocoder
  SelcoCast
elbrus
lwpa
  af_webcam.rexx
  PC-Emulator
jpeg to avi
     
     
     
     
     

http://selco.da.ru

 

SelcoCast - Streaming Solution for Amiga Computers

 
  Download selcocast.lha  
 


26.5.2006:
important Bugfixes for OS3 version
OS4 native version added, can broadcast streams from tunenet

If you like this program please show your appreciation!

 
 

 

Contents:
1 Streaming Live Audion from the Sound Card Input
1.1 Description

1.2 Setup
2 Streaming MP3-files from a Directory
2.1 Description
2.2 Setup
3 Rebroadcast Streams from Other Stations
4 Recording of Streams
5 Special thanks

The following tools enable Amiga computers to stream MP3 audio to the internet such as ShoutCast or IceCast on other platforms do. It's the first shoutcast-compatible streamer solution for Amiga computers as far as I know.

Currently Four Different Scenarios are Addressed:
Streaming live audio from the sound card input
Streaming MP3-files from a directory
Rebroadcast streams from other stations
Recording of streams

The first scenario requires an Amiga that is capable of real-time mp3 encoding, e.g. a PPC equipped one.

The package comprises the following tools:
streamserver The server. Internet clients will connect here
feeder_stdin Reads sound from stdin and sends it via TCP/IP to the server
dirfixbr Reads mp3 files of same bit rate from a directory and sends them in that bit rate to stdout
client_stdout Reads sound from a (shoutcast-) server and writes it to stdout

Their usage will be explained in the following examples.

1. Streaming Live Audio from the Sound Card Input

This was the main goal of the development. It allows you to broadcast live events such as fairs, parties or local radio programs to the world.
Using an external sound mixer, microphone, CD-, record- or cassette player you can setup your very own internet radio station.

Figure 1 describes this case.


Figure 1: Streaming Live Audio from the Sound Card Input

1.1 Description

For MP3 encoding the famous Lame encoder is used. You need an Amiga that is fast enough to do real-time MP3 encoding. Usually this will mean an PPC equipped machine. The lame version must be able to read and write to stdin and stdout. This is important! Lame uses the AHI device as input file and writes its MP3 output to a pipe.
The Feeder_stdin reads this MP3 data from the pipe and sends it to then stream server. The stream server allows multiple clients from the internet to connect and to listen to your sound. The stream server does not necessarily need to be running on the same Amiga, it can be everywhere in the internet.
You could also connect your feeder_stdin to a PC or UNIX shoutcast server. The same is valid for the opposite direction: you could connect the shoutcast-DSP-plugin from a PC to our Amiga stream server. Both connections should however be considered as experimental.

1.2 Setup

1.2.1 Start the Server

First open a new shell and start the streamserver.

24.Work2:Programme/selcocast> selcocast_stream_server 8000 hallo 5

8000 is the port base. On this port the server listens for connection requests from clients. 8000 is the usual port base for shoutcast servers, you can chose however a different port if necessary. "hallo" is the password the server expects from a feeder. Because the server is visible to the whole internet otherwise anybody could use our server and feed its sound in. Feeders that don't send the same password will become rejected by the stream server. 5 is the maximum number of listeners that will be accepted.

The server will start with the following output:

SelcoCast Stream Server
Streaming solution for Amiga computers
version 1.3, 26/05/2006

$Revision 1.20 $
http://selco.da.ru

26.05.2006, 21:08:43 : program started
Portbase 8000, Passw="hallo"
5 listerners permitted.
socket is fd=3
inputsocket is fd=4

1.2.2 Start the Feeder

First open a new shell and start the streamserver.

28.Work2:Programme/selcocast> selcocast_feeder_stdin localhost 8000 hallo <pipe:test.mp3

"localhost" ist the address of the server we want to connect to. As this is usually a server running on the same Amiga "localhost" will be fine. Otherwise use the address of the computer running the actual server.
"8000" is the portbase. This must be the same value we used for the stream_server!
"hallo" is the password. This must match the password required be the stream_server, otherwise the connection will become refused.
The feeder will read data from the pipe:test.mp3. As nothing is written into the pipe at the moment the feeder will wait.

The feeder will start with the following output:

SelcoCast Feeder Stdin
Streaming solution for Amiga computers
version 1.3, 26/05/2006
$Revision: 1.8 $
http://selco.da.ru

servername : localhost
portbase : 8000
password : hallo
26.05.2006, 21:10:47 : socket is fd=3
28.05.2006, 21:10:47 : The server accepted our connection request.


1.2.3 Starting Lame Encoder

First open a new shell and start the Lame encoder.

29.Work2:Programme/selcocast/lame3.12/lame -a -b 32.0 -s 32.0 - - < audio:UNIT/2/B/16/C/2/F/32000/BUF/128000 >pipe:test.mp3

This cryptical command will start the Lame encoder,
force it to automatically create a mono MP3 stream (-a),
set the target bit rate to 32 kbit/s (-b 32.0),
tell the encoder that the audio from the soundcard has been sampled with 32 kHz (-s 32.00),
that it should read from stdin (first "-") and
that it should write its mp3-output to stdout (second "-").

The input will be redirected to the AHI device (< audio:UNIT/2/B/16/C/2/F/32000/BUF/128000) and the output will be redirected to our pipe (>pipe:test.mp3)

Please refer to the AHI documentation for a detailed description of the parameters, here is a short overview of the parameters in the command line above:

UNIT/2 AHI unit to use. Unit 2 in my case, you might have set up your AHI differently
B/16 sample data have 16 bit (this was a must for the lame version I used
C/2 2 channels, i.e. stereo (this was a must for the lame version I used)
F/32000 Sampling rate is 32000, not every sampling rate was supported by the lame version I used
BUF/128000 buffer size, a too small buffer size might cause audio drop outs

You don't need to enter that complicated command line again and again, a small script is provided for that case. Edit it according to your needs and start it with

Execute audio2lame2pipe

Lame will start with the following output:

LAME version 3.12 (beta 5) (www.sulaco.org/mp3)
Assuming raw pcm input file
Autoconverting from stereo to mono. Setting encoding to mono mode.
Encoding stdin to stdout
Encoding as 32.0 kHz 32 kbps single-ch MPEG-1 LayerIII file
using GPSYCHO: GPL'd psycho-acoustic model -b 32.0 -s 32.0 -

Your internet radio station is now transmitting the audio from your soundcard input. The server shows the number of bytes it gets from the feeder. This number will permanently increase. Clients can now connect to your IP address, your port (8000 if you followed the example) and listen what you send them.

2 Streaming MP3-files from a Directory

I consider this scenario quite useless (who wants to listen to my mp3 collection?) but anyway, here is how it works:


Figure 2: Streaming MP3-files from a Directory

2.1 Description

The stream server and feeder_stdin work as described in the chapter "Streaming MP3-files from a directory". The new part is the tool dirfxbr which reads soundfiles from a given directory.

2.2 Setup

2.2.1 Creating MP3 Directory

Put some MP3-Files into a directory. The directory can contain other files as well, only files ending with ".mp3" will be considered. All MP3-Files must have the same bit rate. (And they will be streamed out with that bit rate). If you have for instance a TDSL connection with 128 kbit/s upstream bandwidth, a MP3-bitrate of 32 kbit/s would allow 3 clients to listen (total 96 kbit/s) and you still have 32 kbit/s left for your own purposes. As Figure 2 shows there is no MP3 encoding performed, this application will therefore work with Non-PPC Amigas too.

2.2.2 Start Stream Server and Feeder

Setup the stream server and feeder_stdin as described in the first scenario.

2.2.3 Starting dirfixbr

Open a new shell and start dirfixbr.

29.Work2:Programme/selcocast> selcocast_dirfixbr work3:selcocast_mp3/playdir_32 32 >pipe:test.mp3

Parameters of the example:
work3:selcocast_mp3/playdir_32 Directory with MP3 Files of same bit rate
32 Bit rate of the files
>pipe:test.mp3 output to the pipe the feeder is reading from

The program will start with the following output:

SelcoCast_dirfixbr
Streaming solution for Amiga computers
streaming of .mp3 files with same bitrate from a directory
version 1.3, 26/05/2006
$Revision: 1.6 $

http://selco.da.ru

Bitrate is 32 kBit/s (i.e. 4 KByte/s)

Currently streaming: work3:selcocast_mp3/playdir_32/davon.mp3

The program will read one MP3-file after the other and stream it out with the given bit rate. When all files have been streamed out it will start over again.

3 Rebroadcast Streams from Other Stations

It is also easily possible to re-broadcast the sound of another shoutcast station. We just need a different source of sound data. Figure 3 shows the scenario:


Figure 3: Rebroadcast Streams from Other Stations

The new component is the tool client_stdout. This program can connect to a (shoutcast) stream server and writes the sound data to stdout.

3.1 Start Stream Server and Feeder

Setup the stream server and feeder_stdin as described in the first scenario.

3.2 Starting client_stdout

Open a new shell and start the client_stdout program:

29.Work2:Programme/selcocast> selcocast_client_stdout 128.243.106.145 8000 0 >pipe:test.mp3

The program will display the following initial output:

SelcoCast Client Stdout
Streaming solution for Amiga computers
version 1.3, 26/05/2006
$Revision: 1.12 $
http://selco.da.ru

Address: 128.243.106.145
Port : 8000
socket is fd=3
received bytes: 392192

Parameters:
Address The Internet address of the foreign (shoutcast) server
Port The port number that server is listening for client requests, usually 8000
0 is the time in minutes the client_stdout should stay connected. The special value "0" means "for ever".
>pipe:test.mp3 The output is redirected into the pipe where out feeder_stdin is waiting
for data.

4 Recording of Streams

The program client_stdout can also be used to record or "rip" streams. I need it to record my own soundcard-streams. The usage is easy as Figure 4 shows:


Figure 4:
Recording of Streams

Setup
Open a new shell and start the program:

30.Work2:Programme/selcocast> selcocast_client_stdout localhost 8000 5 >five_minutes.mp3

The program will start with the following initial output:

SelcoCast Client Stdout
Streaming solution for Amiga computers
version 1.3, 26/05/2006
$Revision: 1.12 $
http://selco.da.ru

Address: localhost
Port : 8000
program will automatically stop after 5 minutes
socket is fd=3
received bytes: 79872

The parameters have already been explained in the chapter above. The difference is that we write the output to a file (five_minutes.mp3 in the example) The program closes after 5 minutes. (Parameter "5"). "Localhost" refers to our own local stream server, any other server far away in the internet will be fine, too. And finally the "8000" is the port base again.

5 Special thanks

Thanks go to Pavel Fedin for pointing me to serious bug in the stream server,
to Krister "Kicko" Skrtic for reporting problems under OS4 and some testing and
especially to George "walkero" Sokianos for very patiently betatesting the OS4 binaries.

 
   
selco@t-online.de
 
© Greifswald 2001
Webmaster: Babette Fritsch
Last Modification: 26.05.2006