Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capture 2 usb analog inputs #151

Open
kurtwerbrouck opened this issue Jan 28, 2020 · 11 comments
Open

Capture 2 usb analog inputs #151

kurtwerbrouck opened this issue Jan 28, 2020 · 11 comments

Comments

@kurtwerbrouck
Copy link

Hi

I am trying to capture 2 usb analog audio inputs via darkice and send them to icecast.
I have made 1 darkice config with [icecast2-0] setting, then i made a duplicate of that file and adjusted the mount name in the [icecast2-0] session.
When running each config file seperate, it seems to be working, if i run the both config files at the same time, i got and hardware error. Is there an example that i can base my config on?

Kurt

@DanielEckl
Copy link
Collaborator

If you really only changed the mountpoint between the config files, then this would mean your input is the same in both files.
In case your input is some sound server like jack or pulseaudio, this might be fine, but if it's the alsa hardware directly, then you will have two darkice processes wanting to connect to the same hardware and only the first wins.

@kurtwerbrouck
Copy link
Author

One has hwplug:1.0, the other has hwplug:2.0.
If the mountpoint has a different name and the port remains 8000, then this should be running?
I will try again this weekend.
As project we want to capture 4 analog stereo signal and transform them into 4 webradio stream coming from icecast.

@DanielEckl
Copy link
Collaborator

DanielEckl commented Jan 30, 2020

For hwplug the separation of device and subdevice is comma, not dot. Please check if you just mistyped here in the comment or also in the config file. This aside, these two input definitions should not cause hw blocking and this should work.

If that doesn't lead to a solution, you might also show us your complete config (redact any passwords and maybe hostnames) and your complete darkice command line and output

@kurtwerbrouck
Copy link
Author

config nr 1

[general]
duration = 0 # duration in s, 0 forever
bufferSecs = 1 # buffer, in seconds
reconnect = yes # reconnect if disconnected
[input]
device = plughw:1,0 # Soundcard device for the audio input
sampleRate = 44100 # sample rate 11025, 22050 or 44100
bitsPerSample = 16 # bits
channel = 1 # 2 = stereo

[icecast2-0]
bitrateMode = cbr # constant bit rate ('cbr' constant, 'abr' average)
#quality = 1.0 # 1.0 is best quality (use only with vbr)
format = mp3 # format. Choose 'vorbis' for OGG Vorbis
bitrate = 320 # bitrate
server = localhost # or IP
port = 8000 # port for IceCast2 access
password = hackme # source password for the IceCast2 server
mountPoint = rapi.mp3 # mount point on the IceCast2 server .mp3 or .ogg
name = Raspberry Pi

Config 2

[general]
duration = 0 # duration in s, 0 forever
bufferSecs = 1 # buffer, in seconds
reconnect = yes # reconnect if disconnected

[input]
device = plughw:2,0 # Soundcard device for the audio input
sampleRate = 44100 # sample rate 11025, 22050 or 44100
bitsPerSample = 16 # bits
channel = 1 # 2 = stereo

[icecast2-0]
bitrateMode = cbr # constant bit rate ('cbr' constant, 'abr' average)
#quality = 1.0 # 1.0 is best quality (use only with vbr)
format = mp3 # format. Choose 'vorbis' for OGG Vorbis
bitrate = 320 # bitrate
server = localhost # or IP
port = 8000 # port for IceCast2 access
password = hackme # source password for the IceCast2 server
mountPoint = rapi2.mp3 # mount point on the IceCast2 server .mp3 or .ogg
name = Raspberry Pi2

i test this first with the next 2 commands

/usr/bin/darkice -v9 -c /home/pi/darkice.cfg &
/usr/bin/darkice -v9 -c /home/pi/darkice2.cfg &

replay from second command
Using config file: /home/pi/darkice2.cfg
06-Jan-2020 22:06:38 Using ALSA DSP input device: plughw:2,0
06-Jan-2020 22:06:38 encoding
06-Jan-2020 22:06:38 scheduler high priority 99
06-Jan-2020 22:06:38 Could not set POSIX real-time scheduling, this may cause recording skips.
Try to run darkice as the super-user.
DarkIce: AlsaDspSource.cpp:195: can't set hardware parameters [0]

it was a type error into this forum, not in the config files

@kurtwerbrouck
Copy link
Author

could it be that the raspberry pi4 usb bus cant handle 2 usb cards?

@DanielEckl
Copy link
Collaborator

"can't set hardware parameters" is a weird error message here. If it would be reproducible all the time I'd say your sound card has some min/max limitations in channels and/or sample rate and you exceeded it. But I understood you that way that each command works when started alone.

I'd lower the sample rate anyway and switch mono/stereo mode forth and back just for try and error.

And you could try to rule out darkice as the culprit. Use two "arecord" processes and try to record from both devices at the same time. If that fails, too, then it's alsa and/or the raspi or your soundcards.

@kurtwerbrouck
Copy link
Author

Today i tried it an a rpi3+b , this was succesfull.
Got both darkice captures running. I used darksnow to make both config filed. Still have to check the sound quality. I will try again on a rpi4 with the same configs.

@kurtwerbrouck
Copy link
Author

we are back, i tried the exact same configs on a rpi4, both capture working perfect alone, but running bith capture on the same time , it doesnt work. seems that the issue is only present on a raspberry 4.
does the rpi4 handle the usb bus in a different way?

@kurtwerbrouck
Copy link
Author

I compiled darkice 1.4 with lame and alsa support.
I can run two darkice config on the same time on a odroid c2- a rpi4 refuses to do so..

@kurtwerbrouck
Copy link
Author

on the odroid -c2 the audio is distorted.... so also not a solution.

@kurtwerbrouck
Copy link
Author

hello

Today i was succesfull of running 3 darkice capture towards icecast. I also installed qjackctl and run before each startup of darkice session an alsa_out -d hw:x (x = card number) command.

Why it works, i have no idee.

When starting the 4 darkice capture, it send me an error after 10 sec:

DarkIce: AlsaDspSource.cpp:265: Input/output error [0]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants