So you want to livestream audio from your Pi to the web? Take a look at these two packages: Darkice, and IceCast. Darkice lets you select a sound input to encode and stream to an IceCast server. The server will wrap the audio stream with a nice web-appropriate display to make selecting and playing content easily.
DarkIce: Audio Encoding software
First, take a look at this link describing how to compile DarkIce with mp3 support which is likely what you’re going to want.
# see the darkice.cfg man page for details
# this section describes general aspects of the live streaming session
duration = 0 # duration of encoding, in seconds. 0 means forever
bufferSecs = 5 # size of internal slip buffer, in seconds
reconnect = yes # reconnect to the server(s) if disconnected
# this section describes the audio input that will be streamed
device = hw:1,0 # Alsa soundcard device for the audio input
sampleRate = 44100 # sample rate in Hz. try 11025, 22050 or 44100
bitsPerSample = 16 # bits per sample. try 16
channel = 1 # channels. 1 = mono, 2 = stereo
# this section describes a streaming connection to an IceCast2 server
# there may be up to 8 of these sections, named [icecast2-0] ... [icecast2-7]
# these can be mixed with [icecast-x] and [shoutcast-x] sections
bitrateMode = vbr # variable bit rate
format = mp3 # format of the stream: mp3
quality = 0.6 # quality of the stream sent to the server
server = localhost # host name of the server
port = 8000 # port of the IceCast2 server, usually 8000
password = SOURCE_PASSWORD # source password to the IceCast2 server
mountPoint = raspi # mount point of this stream on the IceCast2 server
name = RasPi # name of the stream
description = DarkIce on RasPi # description of the stream
url = http://localhost # URL related to the stream
genre = my genre # genre of the stream
public = no # advertise this stream?
localDumpFile = recording.mp3 # Record also to a file
The key element here is the [input] section. Here we specify the Alsa device from which to source audio for capturing and encoding.
The other element in the config file that you need to configure is the [icecast-2]. Set the address (server and port) as well as the password to the icecast-2 server. Note that the default configuration for the icecast-2 server is only two (2) streams. Be sure to increase that if you’re attempting to stream more than that to the server.
If you want to encode more than one stream on your Pi, you can run multiple instances of DarkIce and use the -c flag to specify a unique configuration file for each instance.
To configure Icecast, start here. The Docs are also a good starting point too. For the impatient you can just use apt-get.