Skip to content

Instantly share code, notes, and snippets.

@JamesHarrison
Created February 26, 2012 09:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JamesHarrison/1915661 to your computer and use it in GitHub Desktop.
Save JamesHarrison/1915661 to your computer and use it in GitHub Desktop.
# Audio monitoring
# Watch and automatically restart:
# * jackd
# * rotter
# * darkice
God.pid_file_directory = "/var/run/god"
God.watch do |w|
w.name = "jackd"
w.group = "audio"
w.interval = 15.seconds
w.start = "jackd -d alsa -d hw:1 -s -p 512 -z s -n 4"
w.log = "/var/log/god/jackd.log"
w.start_if do |start|
start.condition(:process_running) do |c|
c.interval = 2.seconds
c.running = false
end
end
end
God.watch do |w|
w.name = "darkice"
w.group = "audio"
w.interval = 2.seconds
w.start = "darkice"
w.log = "/var/log/god/darkice.log"
w.start_if do |start|
start.condition(:process_running) do |c|
c.interval = 2.seconds
c.running = false
end
end
w.restart_if do |restart|
restart.condition(:cpu_usage) do |c|
c.above = 90.percent
c.times = 3
end
end
end
God.watch do |w|
w.name = "rotter"
w.group = "audio"
w.interval = 15.seconds
w.start = "rotter -j -f mp3 -a -b 192 -n rotter -d 2500 -L dailydir /srv/logs/"
w.log = "/var/log/god/rotter.log"
w.start_if do |start|
start.condition(:process_running) do |c|
c.interval = 2.seconds
c.running = false
end
end
end
# sample DarkIce configuration file, edit for your needs before using
# see the darkice.cfg man page for details
# this section describes general aspects of the live streaming session
[general]
duration = 0 # duration of encoding, in seconds. 0 means forever
bufferSecs = 8 # 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
[input]
device = jack_auto # OSS DSP soundcard device for the audio input
sampleRate = 48000 # sample rate in Hz. try 11025, 22050 or 44100
bitsPerSample = 16 # bits per sample. try 16
channel = 2 # channels. 1 = mono, 2 = stereo
jackClientName = darkice
# this section describes a streaming connection to an IceCast server
# there may be up to 8 of these sections, named [icecast-0] ... [icecast-7]
# these can be mixed with [icecast2-x] and [shoutcast-x] sections
[icecast2-0]
bitrateMode = cbr # constant bit rate
bitrate = 192 # bitrate of the mp3 stream sent to the server
quality = 0.9 # encoding quality
format = mp3
server = live.insanityradio.com
# host name of the server
port = 8000 # port of the IceCast server, usually 8000
password = somepassword # source password to the IceCast server
mountPoint = live-192.mp3 # mount point of this stream on the IceCast server
name = Insanity Radio 1287AM
# name of the stream
description = Across the campus on air, across the world online
# description of the stream
url = http://www.insanityradio.com
# URL related to the stream
genre = Student Radio # genre of the stream
public = yes # advertise this stream?
[icecast2-1]
bitrateMode = cbr # constant bit rate
bitrate = 96 # bitrate of the mp3 stream sent to the server
quality = 0.9 # encoding quality
format = mp3
server = live.insanityradio.com
# host name of the server
port = 8000 # port of the IceCast server, usually 8000
password = somepassword # source password to the IceCast server
mountPoint = live-96.mp3 # mount point of this stream on the IceCast server
name = Insanity Radio 1287AM
# name of the stream
description = Across the campus on air, across the world online
# description of the stream
url = http://www.insanityradio.com
# URL related to the stream
genre = Student Radio # genre of the stream
public = yes # advertise this stream?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment