Setting Up Your Audio Stream On a
The Raspberry Pi software we used was Debian version 11 (bullseye) and theres no need to download and install codecs for MP3 streaming, it just works 'as is' with Darkice on a clean install to the SD card, after you have installed Darkice and Icecast2.
Create an account with an icecast server (or install Icecast2 if streaming only to your home network, or hosting yourself) and note your username down, login and go to these pages and make notes of the server settings and passwords that you will need to input to the darkice.cfg file.
Create an account with an icecast server (or install Icecast2 if streaming only to your home network, or hosting yourself) and note your username down, login and go to these pages and make notes of the server settings and passwords that you will need to input to the darkice.cfg file.
To stream from your Raspberry Pi or your own computer, you can install Icecast2, an audio streaming server.
For Raspberry Pi type (or download icecast for windows, setting a private secure stream is not covered here for Windows)
sudo apt-get install icecast2
Write down your passwords for the different users
Then to edit icecast for the ability to make it private, and to be able to add users for the stream (this step can be skipped if you want a public stream), type the following.
sudo mkdir /etc/icecast2/auth
sudo chown -R icecast2:icecast /etc/icecast2/auth
sudo nano /etc/icecast2/icecast.xml
Then paste the below text into the icecast.xml file under the "<!-- Mountpoints" section
<mount>
<mount-name>/your stream name here</mount-name>
<authentication type="htpasswd">
<option name="filename" value="/etc/icecast2/auth/myauth"/>
<option name="allow_duplicate_users" value="1"/>
</authentication>
</mount>
ctrl + X to exit and press Y to save
restart icecast with the following
sudo systemctl restart icecast2
To install Darkice on a fresh image type:
sudo apt-get install darkice
next, edit your darkce.cfg
sudo nano /etc/darkce.cfg
copy and paste the following into it putting your server settings from the control panel as above in the images for your account
[general]
duration = 0
bufferSecs = 5
reconnect = yes
[input]
device = plughw:1,0 # You may need to change the numbers here for your setup
sampleRate = 48000
bitsPerSample = 16
channel = 2
[icecast2-0]
bitrateMode = cbr
bitrate = 320 # Max bitrate for MP3 is 320 and best for binaural audio
format = mp3
quality = 1.0 # Sets the quality of the stream 1.0 being highest
server = your ip address # This is a free server or you can pay for one
port = 8000 # Your port number from your icecast2 settings
mountPoint = your stream name here # Omit the '/' before 'stream' in Darkice "stream.mp3" for example
password = source password here # Source password from icecast or private paid for server password
name = your stream name # Name of account
description = Live binaural stream for headphones # Stream description
genre = Binaural 3D for headphones
public = yes
Control, X and press Y to save
Then type
sudo nano /home/YOURUSERNAME/darkice.sh
type the following
sudo /usr/bin/darkice -c /etc/darkice.cfg
CTRL X and Y to save
then type:
sudo chmod 777 /home/YOURUSERNAME/darkice.sh
then type:
sudo nano /etc/rc.local
between fi and exit 0 type the following below with your user name on the pi
fi
sleep 20
/home/YOURUSERNAME/darkice.sh
exit 0
CTRL X and Y to save (this should auto start darkice on startup)
type sudo reboot and after a minute see if your audio server is running on the pi by going directly to it's ip address including the port number, 192.168.1.21:8000 for example.
If you have implemented the password feature, you can login as admin and add a user to the database by going to your "ip address:8000/admin" and going to "manage authentication" where you can add or delete users for the protected stream nominated in the icecast.xml file.
If you use a Pi HAT PoE+ control the fan so that it isn't heard by the microphone at normal heat levels
At the command line type:
sudo nano /boot/config.txt
At the end of the file type
# PoE Hat Fan Speeds
dtparam=poe_fan_temp0=60000
dtparam=poe_fan_temp1=70000
dtparam=poe_fan_temp2=80000
dtparam=poe_fan_temp3=90000
control X and Y to save
sudo reboot to take effect.
For Raspberry Pi type (or download icecast for windows, setting a private secure stream is not covered here for Windows)
sudo apt-get install icecast2
Write down your passwords for the different users
Then to edit icecast for the ability to make it private, and to be able to add users for the stream (this step can be skipped if you want a public stream), type the following.
sudo mkdir /etc/icecast2/auth
sudo chown -R icecast2:icecast /etc/icecast2/auth
sudo nano /etc/icecast2/icecast.xml
Then paste the below text into the icecast.xml file under the "<!-- Mountpoints" section
<mount>
<mount-name>/your stream name here</mount-name>
<authentication type="htpasswd">
<option name="filename" value="/etc/icecast2/auth/myauth"/>
<option name="allow_duplicate_users" value="1"/>
</authentication>
</mount>
ctrl + X to exit and press Y to save
restart icecast with the following
sudo systemctl restart icecast2
To install Darkice on a fresh image type:
sudo apt-get install darkice
next, edit your darkce.cfg
sudo nano /etc/darkce.cfg
copy and paste the following into it putting your server settings from the control panel as above in the images for your account
[general]
duration = 0
bufferSecs = 5
reconnect = yes
[input]
device = plughw:1,0 # You may need to change the numbers here for your setup
sampleRate = 48000
bitsPerSample = 16
channel = 2
[icecast2-0]
bitrateMode = cbr
bitrate = 320 # Max bitrate for MP3 is 320 and best for binaural audio
format = mp3
quality = 1.0 # Sets the quality of the stream 1.0 being highest
server = your ip address # This is a free server or you can pay for one
port = 8000 # Your port number from your icecast2 settings
mountPoint = your stream name here # Omit the '/' before 'stream' in Darkice "stream.mp3" for example
password = source password here # Source password from icecast or private paid for server password
name = your stream name # Name of account
description = Live binaural stream for headphones # Stream description
genre = Binaural 3D for headphones
public = yes
Control, X and press Y to save
Then type
sudo nano /home/YOURUSERNAME/darkice.sh
type the following
sudo /usr/bin/darkice -c /etc/darkice.cfg
CTRL X and Y to save
then type:
sudo chmod 777 /home/YOURUSERNAME/darkice.sh
then type:
sudo nano /etc/rc.local
between fi and exit 0 type the following below with your user name on the pi
fi
sleep 20
/home/YOURUSERNAME/darkice.sh
exit 0
CTRL X and Y to save (this should auto start darkice on startup)
type sudo reboot and after a minute see if your audio server is running on the pi by going directly to it's ip address including the port number, 192.168.1.21:8000 for example.
If you have implemented the password feature, you can login as admin and add a user to the database by going to your "ip address:8000/admin" and going to "manage authentication" where you can add or delete users for the protected stream nominated in the icecast.xml file.
If you use a Pi HAT PoE+ control the fan so that it isn't heard by the microphone at normal heat levels
At the command line type:
sudo nano /boot/config.txt
At the end of the file type
# PoE Hat Fan Speeds
dtparam=poe_fan_temp0=60000
dtparam=poe_fan_temp1=70000
dtparam=poe_fan_temp2=80000
dtparam=poe_fan_temp3=90000
control X and Y to save
sudo reboot to take effect.
To reboot your Pi every Friday at 9am automatically:
Step 1: Open Terminal
type this command:
sudo crontab -e
If you haven’t edited anything in the crontab before, select your editor.
Press #1 to choose the nano file editor. Then press the down arrow to scroll to the very bottom.
Step 2: Add Scheduled Reboot Time
Enter this command to schedule a reboot. This command will schedule a weekly reboot at 9am.
0 9 * * FRI /sbin/shutdown -r now
CTRL X and Y to save
To port forward the icecast server for public Internet streaming, you will have to open up the port number you are using for the server. Login to your router and look for port forwarding, and input the IP address of the icecast server and input the port number used, then save.
If you don't have a fixed IP address for your Internet, you can use a free DDNS service like noip.com for a free DDNS account that you can use within your router to update any IP changes. From the DDNS setting menu in your router, if it has one, simply add your username, password and web address you registered with, and the router should update the DNS address when there's a change.
To switch the stream on...
Connect the CAT5 cable into your router.
Then simply plug in the power to your Raspberry Pi to start, and unplug it to switch off the stream.
Perfect for any live events that have Internet access, or you could install a Mobile Internet dongle for mobile 3G/4G/5G connections, though we've not tested any modern dongles, any compatible mobile dongle with Raspberry Pi should be fine.
Any issues? Please email us at awi3@live.com, we can't promise we will be able to resolve all issues, but if you follow the above you should have an audio stream streaming live audio from your SR3D weatherproof USB garden microphone.
Step 1: Open Terminal
type this command:
sudo crontab -e
If you haven’t edited anything in the crontab before, select your editor.
Press #1 to choose the nano file editor. Then press the down arrow to scroll to the very bottom.
Step 2: Add Scheduled Reboot Time
Enter this command to schedule a reboot. This command will schedule a weekly reboot at 9am.
0 9 * * FRI /sbin/shutdown -r now
CTRL X and Y to save
To port forward the icecast server for public Internet streaming, you will have to open up the port number you are using for the server. Login to your router and look for port forwarding, and input the IP address of the icecast server and input the port number used, then save.
If you don't have a fixed IP address for your Internet, you can use a free DDNS service like noip.com for a free DDNS account that you can use within your router to update any IP changes. From the DDNS setting menu in your router, if it has one, simply add your username, password and web address you registered with, and the router should update the DNS address when there's a change.
To switch the stream on...
Connect the CAT5 cable into your router.
Then simply plug in the power to your Raspberry Pi to start, and unplug it to switch off the stream.
Perfect for any live events that have Internet access, or you could install a Mobile Internet dongle for mobile 3G/4G/5G connections, though we've not tested any modern dongles, any compatible mobile dongle with Raspberry Pi should be fine.
Any issues? Please email us at awi3@live.com, we can't promise we will be able to resolve all issues, but if you follow the above you should have an audio stream streaming live audio from your SR3D weatherproof USB garden microphone.