Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
raspberry:audio_stream [2018/10/07 21:37]
admin [Audio Stream]
raspberry:audio_stream [2020/12/14 14:35]
admin [Links]
Line 1: Line 1:
 ===== Audio Stream ===== ===== Audio Stream =====
-Streaming audio over internet using icecast and darkice on RaspbianStretch.\\ +Streaming audio over internet using Icecast and Darkice on a Raspberry Pi 3 and RaspbianStretch.\\ 
-update:+ 
 +---- 
 +==== Soundcard ==== 
 + 
 +check the soundcard: 
 +  $ cat /proc/asound/modules 
 +and  
 +  $ cat /proc/asound/cards 
 +that could look like that: 
 +  0 [ALSA           ]: bcm2835_alsa - bcm2835 ALSA 
 +                      bcm2835 ALSA 
 +  1 [K6             ]: USB-Audio - Komplete Audio 6 
 +                      Native Instruments Komplete Audio 6 at usb-3f980000.usb-1.5, high speed 
 +The ALSA Card ID is 0 and the USB-Audio Card ID is 1\\ 
 + 
 +Identify the Soundcard Chip's Device ID 
 +  $ ls /proc/asound 
 +gives: 
 +  ALSA  card0  card1  cards  devices  hwdep  K6  modules  pcm  seq  timers  version 
 +means there are two sound cards 0 and 1 
 +  $ ls /proc/asound/card1 
 +gives: 
 +  id  midi0  pcm0c  pcm0p  stream0  usbbus  usbid  usbmixer 
 +Identify the device id: 
 +  $ cat /proc/asound/card1/pcm0c/info 
 +give: 
 +  card: 1 
 +  device: 0 
 +  subdevice: 0 
 +  stream: CAPTURE 
 +  id: USB Audio 
 +  name: USB Audio 
 +  subname: subdevice #0 
 +  class: 0 
 +  subclass: 0 
 +  subdevices_count:
 +  subdevices_avail:
 +and: 
 +  $ cat /proc/asound/card1/pcm0p/info 
 +gives: 
 +  card: 1 
 +  device: 0 
 +  subdevice: 0 
 +  stream: PLAYBACK 
 +  id: USB Audio 
 +  name: USB Audio 
 +  subname: subdevice #0 
 +  class: 0 
 +  subclass: 0 
 +  subdevices_count:
 +  subdevices_avail:
 +therefore in both cases the ID is 0.\\ 
 +Install ALSA utilities:
   $ sudo apt-get update   $ sudo apt-get update
-install icecast2 and darkice+  $ sudo apt-get install alsa-utils 
-  $ sudo apt-get install icecast2 darkice +open ALSO mixer: 
-if asked type in hostname and password +  $ alsamixer 
-  hostnamelocalhost +with F6 select the soundcard.\\ 
-  password: ????+Test the Sound Card Output: 
 +  $ speaker-test -Dplughw:1,0 -c2 -tsine 
 +  $ speaker-test -Dplughw:1,0 -c2 -twav 
 + 
 + 
 +---- 
 +==== Darkice ==== 
 +Install Darkice.\\  
 +update
 +  $ sudo apt-get update  
 +get the files and install them: 
 +  $ wget https://github.com/x20mar/darkice-with-mp3-for-raspberry-pi/blob/master/darkice_1.0.1-999~mp3+1_armhf.deb?raw=true 
 + 
 +  $ mv darkice_1.0.1-999~mp3+1_armhf.deb?raw=true darkice_1.0.1-999~mp3+1_armhf.deb 
 + 
 +  $ sudo apt-get install libmp3lame0 libtwolame0 
 + 
 +  $ sudo dpkg -i darkice_1.0.1-999~mp3+1_armhf.deb 
 + 
 + 
 change config: change config:
   $ sudo nano /etc/darkice.cfg   $ sudo nano /etc/darkice.cfg
 to: to:
  
-# this section describes general aspects of the live streaming session [general] +  # this section describes general aspects of the live streaming session 
-duration      = 0                # duration of encoding, in seconds. 0 means forever bufferSecs    = 2                 # size of internal slip buffer, in seconds  +  [general] 
-reconnect     = yes              # reconnect to the server(s) if disconnected   +  duration      = 0                # duration of encoding, in seconds. 0 means forever 
-# this section describes the audio input that will be streamed  +  bufferSecs    = 2                # size of internal slip buffer, in seconds 
-[input]  +  reconnect     = yes              # reconnect to the server(s) if disconnected 
-device        = hw:1,0           # Alsa soundcard device for the audio input  +  # this section describes the audio input that will be streamed 
-sampleRate    = 48000            # sample rate in Hz. try 48000, 96000 or 192000  +  [input] 
-bitsPerSample = 16               # bits per sample. try 16  +  device        = plughw:1,0       # Alsa soundcard device for the audio input 
-channel       = 2                # channels. 1 = mono, 2 = stereo.   +  sampleRate    = 48000            # sample rate in Hz. try 48000, 96000 or 192000 
-                                 # Only stereo mode is supported by pisound.   +  bitsPerSample = 16               # bits per sample. try 16 
-# this section describes a streaming connection to an IceCast2 server  +  channel       = 2                # channels. 1 = mono, 2 = stereo. 
-# there may be up to 8 of these sections, named [icecast2-0] ... [icecast2-7]  +                                   # Only stereo mode is supported by pisound. 
-# these can be mixed with [icecast-x] and [shoutcast-x] sections [icecast2-0]  +  # this section describes a streaming connection to an IceCast2 server 
-bitrateMode   = cbr              # variable bit rate  +  # there may be up to 8 of these sections, named [icecast2-0] ... [icecast2-7] 
-bitrate       = 128  +  # these can be mixed with [icecast-x] and [shoutcast-x] sections  
-format        = mp3              # format of the stream: mp3  +  [icecast2-0] 
-quality       = 0.8              # quality of the stream sent to the server  +  bitrateMode   = cbr              # constant bit rate ('vbr' variable 'abr' average) 
-server        = localhost        # host name of the server  +  bitrate       = 128 
-port          = 8000             # port of the IceCast2 server, usually 8000 password      = hackme           # source password to the IceCast2 server  +  format        = mp3              # format of the stream: mp3 ('vorbis' for OGG) 
-mountPoint    = pisound          # mount point of this stream on the IceCast2 server  +  quality       = 0.8              # quality of the stream sent to the server (1.0 ist best) 
-name          = pisound          # name of the stream  +  server        = localhost        # host name of the server 
-description   = DarkIce on pisound # description of the stream  +  port          = 8000             # port of the IceCast2 server, usually 8000 
-url           = http://localhost # URL related to the stream  +  password      = ????????         # source password to the IceCast2 server 
-genre         my genre         # genre of the stream  +  mountPoint    = pisound.mp3      # mount point of this stream on the IceCast2 server 
-public        = no               # advertise this stream?  +  name          = pisound          # name of the stream 
-#localDumpFile = recording.mp3   # Record also to a file+  description   = DarkIce on pisound # description of the stream 
 +  url           = http://localhost # URL related to the stream 
 +  genre         hits             # genre of the stream 
 +  public        = no               # advertise this stream? 
 +  #localDumpFile = recording.mp3   # Record also to a file
  
 +----
 +==== Icecast ====
 +Install Icecast.\\
 +update:
 +  $ sudo apt-get update
 +install icecast2:
 +  $ sudo apt-get install icecast2
 +if asked type in hostname and password
 +  hostname: localhost
 +  password: ????
 +start icecast2:
 +  $ sudo service icecast2 start
  
 +----
 +==== Stream ====
 +just run:
 +  $ darkice 
 +and then open in your browser:
 +  http://192.168.178.112:8000/pisound.mp3
 +Icecast2 Status one will find here:
 +  http://192.168.178.112:8000
  
 ---- ----
-[general+==== Links ==== 
-duration        = 0      # duration in s, 0 forever +[[https://www.instructables.com/id/Test-Sound-Card-and-Speakers-in-Raspberry-Pi/]]\\ 
-bufferSecs      = 1      # buffer, in seconds +[[https://www.hackster.io/pranciskus/internet-radio-station-f0bdc1]]\\ 
-reconnect       = yes    # reconnect if disconnected+[[https://technicalustad.com/live-streaming-of-mp3-using-darkice-and-icecast2-on-raspberry-pi/]]\\ 
 +[[https://w7apk.com/streaming-radio]]\\ 
 +[[http://rabarar.github.io/blog/2015/07/02/darkice-and-icecast/]]\\
  
-[input] +---- 
-device          plughw:1,0 # or `pulse' for Pulseaudio +==== License ====
-sampleRate      22050   # sample rate 11025, 22050 or 44100 +
-bitsPerSample   16      # bits +
-channel         1       # 2 stereo+
  
-[icecast2-0] +This manuals is made by **Wolfgang Spahn** 2018-20.\\ 
-bitrateMode     = vbr       # variable bit rate (`cbr' constant, `abr' average) +Except where otherwise noted, content on this wiki is licensed under the following license: [[http://creativecommons.org/licenses/by-nc-sa/4.0/"|Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License]].\\
-quality         = 1.0       # 1.0 is best quality +
-format          = mp3       # format. Choose `vorbis' for OGG Vorbis +
-bitrate         = 128       # bitrate +
-server          = 10.10.10.11 # IP address of the IceCast server +
-port            = 8000      # port for IceCast2 access +
-password        = ******    # source password to the IceCast2 server +
-mountPoint      = radio.mp3 # mount point on the IceCast2 server .mp3 or .ogg +
-name            = radio +
-   +
-   +
-run: +
-  $ darkice  +
  
----- +<html> 
-==== Link ==== +<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png" /></a>  
-[[https://www.hackster.io/pranciskus/internet-radio-station-f0bdc1]]+</html>
  
 ---- ----