Last active
July 18, 2019 13:01
-
-
Save rollbrettler/83ebb35988df2a99a60a to your computer and use it in GitHub Desktop.
Raspberry PI audio streaming (based on https://stmllr.net/blog/live-mp3-streaming-from-audio-in-with-darkice-and-icecast2-on-raspberry-pi/)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo sh -c "echo 'deb-src http://mirrordirector.raspbian.org/raspbian/ wheezy main contrib non-free rpi' >> /etc/apt/sources.list" | |
| sudo apt-get update | |
| sudo apt-get --no-install-recommends install build-essential devscripts autotools-dev fakeroot dpkg-dev debhelper autotools-dev dh-make quilt ccache libsamplerate0-dev libpulse-dev libaudio-dev lame libjack-jackd2-dev libasound2-dev libtwolame-dev libfaad-dev libflac-dev libmp4v2-dev libshout3-dev libmp3lame-dev | |
| apt-get source darkice | |
| cd $(ls | grep darkice) | |
| # copy rules file to debian/rules | |
| debchange -v 1.0-999~mp3+1 | |
| dpkg-buildpackage -rfakeroot -uc -b | |
| sudo dpkg -i ../darkice_1.0-999~mp3+1_armhf.deb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # this section describes general aspects of the live streaming session | |
| [general] | |
| 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 | |
| [input] | |
| device = hw:0,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 = 2 # 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 | |
| [icecast2-0] | |
| bitrateMode = vbr # variable bit rate | |
| bitrade = 320 # 320 kbit/s | |
| format = mp3 # format of the stream: mp3 | |
| quality = 0.6 # quality of the stream sent to the server | |
| server = raspberrypi.local# host name of the server | |
| port = 8000 # port of the IceCast2 server, usually 8000 | |
| password = hackme # 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://raspberrypi.local # URL related to the stream | |
| genre = turntables # genre of the stream | |
| public = no # advertise this stream? | |
| localDumpFile = recording.mp3 # Record also to a file | |
| chanel = 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh -e | |
| # | |
| # /etc/rc.local | |
| # | |
| # This script is executed at the end of each multiuser runlevel. | |
| # Make sure that the script will "exit 0" on success or any other | |
| # value on error. | |
| # | |
| # In order to enable or disable this script just change the execution | |
| # bits. | |
| # | |
| # By default this script does nothing. | |
| # Print the IP address | |
| _IP=$(hostname -I) || true | |
| if [ "$_IP" ]; then | |
| printf "My IP address is %s\n" "$_IP" | |
| fi | |
| # change audio to headphone jack | |
| amixer cset numid=3 1 | |
| exit 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/make -f | |
| %: | |
| dh $@ | |
| .PHONY: override_dh_auto_configure | |
| override_dh_auto_configure: | |
| ln -s /usr/share/misc/config.guess . | |
| ln -s /usr/share/misc/config.sub . | |
| dh_auto_configure -- --prefix=/usr --sysconfdir=/usr/share/doc/darkice/examples --with-alsa --with-vorbis-prefix=/usr/lib/arm-linux-gnueabihf/ --with-jack-prefix=/usr/lib/arm-linux-gnueabihf/ --with-alsa-prefix=/usr/lib/arm-linux-gnueabihf/ --with-faac-prefix=/usr/lib/arm-linux-gnueabihf/ --with-aacplus-prefix=/usr/lib/arm-linux-gnueabihf/ --with-samplerate-prefix=/usr/lib/arm-linux-gnueabihf/ --with-lame-prefix=/usr/lib/arm-linux-gnueabihf/ CFLAGS='-march=armv6 -mfpu=vfp -mfloat-abi=hard' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment