Darkice is a utility which lets you capture audio from your desktop and stream it to an Icecast2 server.
On most current Linux distributions such as Ubuntu 20.04, the default configuration does not capture the audio from the sound card properly. Here’s what worked for me and once I knew what to do it was quite easy !
1- In your darkice.cfg file, set the input device to “default” :
[input]
device = default
2- Install the package pavucontrol-qt
sudo apt install pavucontrol-qt
3- Launch pavucontrol-qt and go to the “Recording” tab. You should see controls for a “ALSA plugin [darkice]” device, as in the screenshot below.
If you don’t see these controls, make sure darkice is running.
4- In the “from” dropdown box, select the sound device you want to capture from.
5- And voilĂ ! This should do it and you should now be able to hear your audio on your icecast stream.