New audio config files (for new streaming solution)

This commit is contained in:
Pecusx
2017-05-05 23:27:20 +02:00
committed by GitHub
parent 5c308109fd
commit 2d88e31427
6 changed files with 285 additions and 7 deletions
+154
View File
@@ -0,0 +1,154 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: darkice
# Required-Start: $remote_fs $syslog $network $named $time alsa-utils
# Required-Stop: $remote_fs $syslog $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: darkice audio streamer
# Description: Darkice will take an ALSA audio input and send it to
# a streaming server.
### END INIT INFO
# or try
# Required-Start: $all
# in above header
# Author: <glyman3@gmail.com>
# Based on skelton script installed with "Raspbian", A community-created
# port of Debian wheezy, optimised for the Raspberry Pi
# This is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.#
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="darkice"
NAME=darkice
DAEMON=/usr/bin/$NAME
DAEMON_ARGS="-c /etc/darkice.cfg"
SCRIPTNAME=/etc/init.d/$NAME
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Read deafult configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Overide VERBOSE variable so that results are displayed
VERBOSE=yes
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
# and status_of_proc is working.
. /lib/lsb/init-functions
#
# Function that starts the daemon/service
#
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
start-stop-daemon --start --quiet --background --exec $DAEMON --test > /dev/null \
|| return 1
start-stop-daemon --start --quiet --background --exec $DAEMON -- $DAEMON_ARGS \
|| return 2
# Add code here, if necessary, that waits for the process to be ready
# to handle requests from services started subsequently which depend
# on this one. As a last resort, sleep for some time.
# # If radioplay script exists & can be run then initalize it when darkice starts recording:
# [ -x "/usr/local/bin/radioplay" ] && /usr/local/bin/radioplay init
}
#
# Function that stops the daemon/service
#
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --name $NAME
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
# Wait for children to finish too if this is a daemon that forks
# and if the daemon is only ever run from this initscript.
# If the above conditions are not satisfied then add some other code
# that waits for the process to drop all resources that could be
# needed by services started subsequently. A last resort is to
# sleep for some time.
# WAS ACTIVE:
#start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
[ "$?" = 2 ] && return 2
return "$RETVAL"
}
#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
#
# If the daemon can reload its configuration without
# restarting (for example, when it is sent a SIGHUP),
# then implement that here.
#
start-stop-daemon --stop --signal 1 --quiet --name $NAME
return 0
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
reload|force-reload)
log_daemon_msg "Reloading $DESC" "$NAME"
do_reload
log_end_msg $?
;;
restart)
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac
+24
View File
@@ -0,0 +1,24 @@
# /etc/
[general]
duration = 0 # duration of encoding, in seconds. 0 means forever
bufferSecs = 1 # size of internal slip buffer, in seconds
reconnect = yes # reconnect to the server(s) if disconnected
[input]
device = hw:Loopback,1
sampleRate = 44100 # sample rate in Hz. try 11025, 22050 or 44100
bitsPerSample = 16 # bits per sample. try 16
channel = 2 # channels. 1 = mono, 2 = stereo
[icecast2-0]
bitrateMode = cbr # variable bit rate (cbr for constant)
quality = 0.5 # 1.0 is best quality
format = mp3
bitrate = 256 # bitrate
server = localhost # or IP
port = 8001 # port for IceCast2 access
password = mympd # source password to the IceCast2 server
mountPoint = mpd # mount point on the IceCast2 server or any namename = mystream
+7 -6
View File
@@ -7,18 +7,19 @@
# prevent unusual drivers from appearing as the first sound device ###########
options snd-pcsp index=-2
# disable for USB audio default
options snd-usb-audio index=-2
options snd-bcm2835 index=-2
# options snd-usb-audio index=-2
# options snd-bcm2835 index=-2
options cx88_alsa index=-2
options snd-atiixp-modem index=-2
options snd-intel8x0m index=-2
options snd-via82xx-modem index=-2
# options for USB audio default
#options snd-usb-audio index=0
#options snd-bcm2835 index=1
#options snd slots=snd-usb-audio,snd-bcm2835
# options for internal audio default
options snd-bcm2835 index=0
options snd-usb-audio index=1
options snd-aloop index=2
options snd slots=snd-bcm2835,snd-usb-audio,snd-aloop
# work around other kernel issues ############################################
# The EHCI driver should be loaded before the ones for low speed controllers
+5
View File
@@ -0,0 +1,5 @@
# /etc/
default_driver=alsa
dev=LoopAndReal
quiet
+93
View File
@@ -0,0 +1,93 @@
# Files and directories #######################################################
#
music_directory "/var/lib/mpd/music"
playlist_directory "/var/lib/mpd/playlists"
db_file "/var/lib/mpd/tag_cache"
log_file "/var/log/mpd/mpd.log"
pid_file "/run/mpd/pid"
state_file "/var/lib/mpd/state"
sticker_file "/var/lib/mpd/sticker.sql"
#
###############################################################################
# General music daemon options ################################################
#
user "mpd"
#group "nogroup"
#
# For network
bind_to_address "any"
###############################################################################
# Zeroconf / Avahi Service Discovery ##########################################
#
zeroconf_enabled "no"
#zeroconf_name "Music Player"
#
###############################################################################
# Input #######################################################################
#
input {
plugin "curl"
# proxy "proxy.isp.com:8080"
# proxy_user "user"
# proxy_password "password"
}
#
###############################################################################
# Audio Output ################################################################
#
audio_output {
type "alsa"
name "Main Alsa"
format "41000:16:2"
device "hw:0,0" # optional
# mixer_type "software" # optional
# mixer_device "default" # optional
mixer_control "PCM"
# mixer_index "0" # optional
}
# Kopia na Loopback
audio_output {
type "alsa"
name "Loopback"
format "41000:16:2"
device "hw:Loopback,0" # optional
}
#
###############################################################################
# Character Encoding ##########################################################
#
filesystem_charset "UTF-8"
id3v1_encoding "UTF-8"
#
###############################################################################
# Original file stored as /etc/mpd.conf.orig
# MPD Radio Stream
#audio_output {
# type "shout"
# name "PI Radio MPD Stream"
# description "MPD stream on Raspberry Pi Radio"
# host "localhost"
# port "8001"
# mount "/mpd"
# password "mympd"
# bitrate "256"
# format "44100:16:2"
# encoding "mp3"
#}
+2 -1
View File
@@ -18,7 +18,8 @@ options snd-via82xx-modem index=-2
# options for USB audio default
options snd-usb-audio index=0
options snd-bcm2835 index=1
options snd slots=snd-usb-audio,snd-bcm2835
options snd-aloop index=2
options snd slots=snd-usb-audio,snd-bcm2835,snd-aloop
# work around other kernel issues ############################################
# The EHCI driver should be loaded before the ones for low speed controllers