OP25-Darkice. Can't open connector.

Status
Not open for further replies.

ben89g

Member
Feed Provider
Joined
Dec 19, 2019
Messages
5
Location
Casula, NSW
Hi All,
I have been working on getting my stream online but having worked my way through many issues already, I have been stuck on the final stage for 2 days. I am running an RTL-SDR with a Raspberry Pi 4 with raspbian (the latest - Buster I think). OP25 is decoding my trunked local radio frequencies brilliantly out of my speakers but when I transition to piping the audio through loop0 to darkice I get the following message:

Using config file: /etc/darkice-stream0.cfg
Using ALSA DSP input device: loop0
Using POSIX real-time scheduling, priority 98
ALSA lib pcm_direct.c:1824:(_snd_pcm_direct_get_slave_ipc_offset) Invalid value for card
DarkIce: DarkIce.cpp:1187: can't open connector [0]

Here is my /etc/darkice-stream0.cfg file:

[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 = loop0 # OSS DSP soundcard device for the audio input
sampleRate = 22050 # sample rate in Hz. 22050 is the RR Standard
bitsPerSample = 16 # bits per sample. 16 for mono feeds, 32 for stereo feeds
channel = 1 # channels. 1 = mono, 2 = stereo

[icecast2-0]

format = mp3
sampleRate = 22050 # sample rate in Hz. 22050 is the RR Standard
bitrateMode = cbr
bitrate = 16
quality = 0.1
channel = 1
lowpass = 4000
server =audio1.broadcastify.com
port =80 # port of the IceCast server, usually 8000
password =(Password removed for security)
mountPoint = (Mountpoint here with forward slash removed)
name = NSW RFS Macarthur Zone eG032 GRN

My /etc/modprobe.d/bcm2835.conf file:

softdep snd-bcm2835 post: snd-aloop
options snd-aloop enable=1 index=1 pcm_substreams=2


My /etc/asound.conf file:

# output device
pcm.loopout0 {
type plug
slave.pcm "hw:Loopback,0,0"
}

# input device
pcm.loopin0 {
type dsnoop
ipc_key 686592
slave.pcm "hw:Loopback,1,0"
}

# duplex plug device
pcm.loop0 {
type plug
slave {
pcm {
type asym
playback.pcm "loopout0"
capture.pcm "loopin0"
}
}
}

# output device
pcm.loopout1 {
type plug
slave.pcm "hw:Loopback,0,1"
}

# input device
pcm.loopin1 {
type dsnoop
ipc_key 686593
slave.pcm "hw:Loopback,1,1"
}

# duplex plug device
pcm.loop1 {
type plug
slave {
pcm {
type asym
playback.pcm "loopout1"
capture.pcm "loopin1"
}
}
}

My op25.sh file:
./rx.py --nocrypt --args 'rtl' --gains 'lna:36' -S 250000 -q 0 -v 1 -O loop0 -T trunk.tsv -V -2 -U 2> stderr-stream0.2


Alsamixer is set to put audio out the built in headphone jack. When I run the op25.sh file with '-O loop0' removed I get audio out of my speakers fine. I need to get darkice running to get my stream up and I'd also like the audio to be coming out of my speakers concurrently.

Thank you for your help and please let me know if there is any other information I can provide to help!!
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,338
Location
Talbot Co, MD
Did you load the "snd-aloop" kernel module? If not, the 'loop0' alsa device won't be created and darkice will fail.

For many reasons I no longer recommend using darkice and the loopback driver to stream op25. Reliability is far better with liquidsoap and you don't have to mess with kernel modules or get ALSA involved in any way.
 

ben89g

Member
Feed Provider
Joined
Dec 19, 2019
Messages
5
Location
Casula, NSW
On research it appears I have created the file:
/etc/modprobe.d/bcm2835.conf
"softdep snd-bcm2835 post: snd-aloop
options snd-aloop enable=1 index=1 pcm_substreams=2"

but have not loaded the kernel. I am looking into how to do that now.

I am new to Linux and reliability is greatly desired so I may have to give up on Darkice soon and try Liquidsoap instead!

Should the loopback device be showing up here?

pi@raspberrypi:~ $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: b1 [bcm2835 HDMI 1], device 0: bcm2835 HDMI 1 [bcm2835 HDMI 1]
Subdevices: 4/4
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
card 1: b2 [bcm2835 HDMI 2], device 0: bcm2835 HDMI 2 [bcm2835 HDMI 2]
Subdevices: 2/2
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
card 2: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
Subdevices: 2/2
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
pi@raspberrypi:~ $
 
Last edited:

a417

Active Member
Joined
Mar 14, 2004
Messages
4,669
but have not loaded the kernel. I am looking into how to do that now.
The kernel is running, it is the core of the operating system. If the kernel is not running, you have nothing to work with. What boatbod is asking is if (and I don't think you did, no fault of your own tho ;)) you told the kernel to load a module (a particular bit of code) to enable a functionality. In this case, he is asking if you have loaded the "snd-aloop" kernel module which enables a loop device in the sound subsystem.

If you are insistent on using darkice against boatbod's recommendation
For many reasons I no longer recommend using darkice and the loopback driver to stream op25. Reliability is far better with liquidsoap and you don't have to mess with kernel modules or get ALSA involved in any way.
we need to see if you are in-fact missing the snd-aloop module in the current running environment.

Please post the output of lsmod | grep snd, which will give us the currently loaded modules.
 

ben89g

Member
Feed Provider
Joined
Dec 19, 2019
Messages
5
Location
Casula, NSW
Thank you for your reply. I am only trying to preserve the last 2 days spent trying to get Darkice working, in the hopes that 'just one more thing' will get it working. I am happy to use liquidsoap if required but it just means my learning curve starts again with a new program :)

pi@raspberrypi:~ $ sudo modprobe snd-aloop
modprobe: ERROR: could not insert 'snd_aloop': No such device
pi@raspberrypi:~ $ find /lib/modules -name 'snd*loop*'
/lib/modules/5.4.51-v7l+/kernel/sound/drivers/snd-aloop.ko
/lib/modules/5.4.51-v8+/kernel/sound/drivers/snd-aloop.ko
/lib/modules/5.4.51-v7+/kernel/sound/drivers/snd-aloop.ko
/lib/modules/5.4.51+/kernel/sound/drivers/snd-aloop.ko
pi@raspberrypi:~ $ lsmod | grep 'snd' | column -t
snd_soc_core 200704 1 vc4
snd_bcm2835 24576 4
snd_compress 20480 1 snd_soc_core
snd_pcm_dmaengine 16384 1 snd_soc_core
snd_pcm 98304 4 vc4,snd_pcm_dmaengine,snd_bcm2835,snd_soc_core
snd_timer 32768 1 snd_pcm
snd 73728 13 snd_compress,snd_timer,snd_bcm2835,snd_soc_core,snd_pcm
 

a417

Active Member
Joined
Mar 14, 2004
Messages
4,669
I would say give liquidsoap a go. I understand your desire to "preserve the last 2 days", but @boatbod recommends liquidsoap for a reason, maybe this is your sign? (y)
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,338
Location
Talbot Co, MD
If you have the modprobe bcm2385.conf file set up, you should just have to reboot to make it active.
"aplay -L" should list the devices including loopback.
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,338
Location
Talbot Co, MD
I would say give liquidsoap a go. I understand your desire to "preserve the last 2 days", but @boatbod recommends liquidsoap for a reason, maybe this is your sign? (y)
On the RPi3 we found that snd-aloop had a nasty habit of falling asleep, causing your feed to go silent for no apparent reason.
Liquidsoap eliminates the need for snd-aloop because it can extract the pcm stream from op25 without involving ALSA. It also has way more flexibility for adding in DSP processing such as voice compression/agc and stream mixing, splitting etc.
 

ben89g

Member
Feed Provider
Joined
Dec 19, 2019
Messages
5
Location
Casula, NSW
I've got Liquidsoap up and running - super easy thank you! My feed (33989) is now active and working brilliantly. I had some trouble with crashing when I uncommented the local sound output to Alsa in the .liq file but I can work on this tomorrow, it's 4am in Australia :)
Thank you for your advice and all the effort you guys put in to make things easier for us!
 

a417

Active Member
Joined
Mar 14, 2004
Messages
4,669
I've got Liquidsoap up and running - super easy thank you! My feed (33989) is now active and working brilliantly. I had some trouble with crashing when I uncommented the local sound output to Alsa in the .liq file but I can work on this tomorrow, it's 4am in Australia :)
Thank you for your advice and all the effort you guys put in to make things easier for us!
Yeah, when in doubt follow the instructions of the software dev. (y)

cheers, mate.
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,338
Location
Talbot Co, MD
On a RPi4 there can be permissions issues with local sound when using Pulse Audio. It seems to be more of an issue with headless RPi4's from what I can tell. ALSA should work ok, but you may need to "apt-get uninstall pulseaudio" to get it to work properly.
 

ben89g

Member
Feed Provider
Joined
Dec 19, 2019
Messages
5
Location
Casula, NSW
All working now. I've managed to keep pulseaudio as I'd like to get the feed to chromecast to the loungeroom also at some point. The tinkering never ends!!
Thank you!
 
Status
Not open for further replies.
Top