b-fitzpatrick / cpiped

Captures an audio stream and outputs to a pipe with buffering and silence detection
GNU General Public License v3.0
71 stars 13 forks source link

ALSA lib pcm_dsnoop.c:618:(snd_pcm_dsnoop_open) unable to open slave #9

Open GMFalka opened 5 years ago

GMFalka commented 5 years ago

Hello!

Thanks for making this :)

Can i have some help?

if i do /usr/local/bin/cpiped -D /tmp/snapfifo it works for a few hours, but if i use the init.d script, it just says

systemd[1]: Starting LSB: Captures sound card audio and outputs to a pipe...
cpiped[7706]: Starting up.
systemd[1]: Started LSB: Captures sound card audio and outputs to a pipe.
cpiped[7700]: ALSA lib pcm_dsnoop.c:618:(snd_pcm_dsnoop_open) unable to open slave
cpiped[7707]: Unable to open pcm device: No such file or directory
cpiped[7707]: Stopping due to error.

this is the cpiped config file

PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Audio capture to a pipe" # Introduce a short description here
NAME=cpiped                    # Introduce the short server's name here
DAEMON=/usr/local/bin/cpiped   # Introduce the server's location here
DAEMON_ARGS="-D /tmp/snapfifo" # Edit this!
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
maweki commented 5 years ago

Do you run the commands as the same user? The user with which it works might have an .asoundrc file that sets the default device to listen to.

My systemd unit file is also just

[Unit]
Description=cpiped
After=network.target snapserver.service
[Service]
Type=simple
User=root
ExecStart=/root/cpiped/cpiped -s '/root/cpiped-snapcast-ctrl/playing.py chromecast' -e '/root/cpiped-snapcast-ctrl/silence.py chromecast' -t 600 /tmp/snapchromecast
[Install]
WantedBy=multi-user.target

but my root user does have an .asoundrc with the following content:

pcm.!default {
    type hw
    card 1
    device 0
    rate 44100
}
ctl.!default {
    type hw
    card 1
}
GMFalka commented 5 years ago

Im using the init.d file thats provided here (not using any systemd file) and i think im running the two commands with the same user.

b-fitzpatrick commented 5 years ago

@GMFalka, I don't have anything helpful to add. @maweki is likely on the right track.

GMFalka commented 5 years ago

@b-fitzpatrick

Thanks! I think i got past that error, now it just says:

cpiped: pcm.c:1245: snd_pcm_drain: Assertion 'pcm' failed.

I think im naming the wrong hw in the config file. I'm using a PC motherboard with onboard line-in. What should be in my .asoundrc?

arecord -L
null
    Discard all samples (playback) or generate zero samples (capture)
pulse
    PulseAudio Sound Server
sysdefault:CARD=PCH
    HDA Intel PCH, ALC887-VD Analog
    Default Audio Device
front:CARD=PCH,DEV=0
    HDA Intel PCH, ALC887-VD Analog
    Front speakers
dmix:CARD=PCH,DEV=0
    HDA Intel PCH, ALC887-VD Analog
    Direct sample mixing device
dmix:CARD=PCH,DEV=2
    HDA Intel PCH, ALC887-VD Alt Analog
    Direct sample mixing device
dsnoop:CARD=PCH,DEV=0
    HDA Intel PCH, ALC887-VD Analog
    Direct sample snooping device
dsnoop:CARD=PCH,DEV=2
    HDA Intel PCH, ALC887-VD Alt Analog
    Direct sample snooping device
hw:CARD=PCH,DEV=0
    HDA Intel PCH, ALC887-VD Analog
    Direct hardware device without any conversions
hw:CARD=PCH,DEV=2
    HDA Intel PCH, ALC887-VD Alt Analog
    Direct hardware device without any conversions
plughw:CARD=PCH,DEV=0
    HDA Intel PCH, ALC887-VD Analog
    Hardware device with all software conversions
plughw:CARD=PCH,DEV=2
    HDA Intel PCH, ALC887-VD Alt Analog
    Hardware device with all software conversions
maweki commented 5 years ago

I think you were running cpiped in user context before and in user context the user pulseaudio daemon gave you an audio pipe. In root context the server didn't.

What are you trying to do? If you have pulseaudio you don't need cpiped. You can create a filesink using pulseaudio.

GMFalka commented 5 years ago

Thank you! You are right, i can use pulseaudo to do filesink, but it was actually filling up the SSD. I will try that route!

mixographer commented 3 years ago

I am getting this same error message every time I try to start cpiped. It was working yesterday, but I had a power cut and I fear all my alsa device have moved around. if I start cpiped manually, it just returns:

ALSA lib pcm_dsnoop.c:618:(snd_pcm_dsnoop_open) unable to open slave

I'm invoking cpiped with out a -d argument, so I'm hoping to use a default device, simply because I can't figure out what the card are called, or how to declare the name of a device with -d