ODR-DabEnc crashes on Alsa Input.

80 views
Skip to first unread message

Raphael Huber

unread,
Apr 30, 2023, 11:25:00 AM4/30/23
to mmbtools
I posted this on git too, but maybe this is the better place?
Sorry for any faux-pas

I have setup audioenc - dabmux - dabmod and all works with an audio stream from an url.

This: odr-audioenc -v "https://eatv.radioca.st/stream" -r 48000 -c 2 -o "tcp://localhost:9003" -l -b 192

Will result in proper encoding.

This: odr-audioenc -d hw:0,0 -r 48000 -c 2 -o "tcp://localhost:9003“ -l -b 192
or this: odr-audioenc --device=hw:0,0 -r 48000 -c 2 -o "tcp://localhost:9003“ -l -b 192
or this: odr-audioenc  --device=sndrpihifiberry -r 48000 -c 2 -o "tcp://localhost:9003“ -l -b 192
or this: odr-audioenc  --device= snd_rpi_hifiberry_dacplusadcpro -r 48000 -c 2 -o "tcp://localhost:9003“ -l -b 192
or this: odr-audioenc  -d snd_rpi_hifiberry_dacplusadcpro -r 48000 -c 2 -o "tcp://localhost:9003“ -l -b 192

Will all result in a hanging prompt.

My aplay -l looks like this:
```
**** List of PLAYBACK Hardware Devices ****
card 0: sndrpihifiberry [snd_rpi_hifiberry_dacplusadcpro], device 0: HiFiBerry DAC+ADC Pro HiFi multicodec-0 [HiFiBerry DAC+ADC Pro HiFi multicodec-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
```


Any ideas?


I tried a workaround with the same result:

jackd -d alsa --device hw:0,0 --capture -n MyJackInput
odr-audioenc -j MyJackInput -r 48000 -c 2 -o "tcp://localhost:9003“ -l -b 192

Also, I tried recording audio to a wav with "gnome recorder" this also worked. So the audio interface works.

Raphael Huber

unread,
Apr 30, 2023, 2:47:00 PM4/30/23
to mmbtools
I have tried another workaround. Even this did not work:

gst-launch-1.0 alsasrc device=hw:1,0 ! audioconvert ! audioresample ! lamemp3enc target=1 bitrate=192 cbr=true ! tcpserversink host=localhost port=9002


odr-audioenc -v "http://localhost:9002“ -r 48000 -c 2 -o "tcp://localhost:9003" -l -b 192


Also, I have tried another audio interface. Also this didn't work.


My System: Linux raspberrypi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr  3 17:24:16 BST 2023 aarch64 GNU/Linux


Matthias Brändli

unread,
Apr 30, 2023, 2:53:52 PM4/30/23
to crc-mm...@googlegroups.com
Hi Raphael,

have you tried --device=default ?

Are you running pulseaudio or pipewire on your system?

Cheers
mpb
> --
> You received this message because you are subscribed to the Google
> Groups "mmbtools" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to crc-mmbtools...@googlegroups.com
> <mailto:crc-mmbtools...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/crc-mmbtools/b23ef1bb-fe39-4799-8af5-8e2c46ff993cn%40googlegroups.com <https://groups.google.com/d/msgid/crc-mmbtools/b23ef1bb-fe39-4799-8af5-8e2c46ff993cn%40googlegroups.com?utm_medium=email&utm_source=footer>.

Raphael Huber

unread,
May 1, 2023, 1:08:38 AM5/1/23
to mmbtools
Dear Matthias
Thank you very much for your time! I appreciate it!

Both pulse audio and pipewire are installed on my system. I have now removed them both and rebooted. 
Then I have tried:

odr-audioenc -d hw:0,0 -r 48000 -c 2 -o "tcp://localhost:9003“ -l -b 192


and


odr-audioenc --device=default -r 48000 -c 2 -o "tcp://localhost:9003“ -l -b 192


Both led to a hanging prompt, no log at all, same as before.


Raphael Huber

unread,
May 7, 2023, 9:52:02 AM5/7/23
to mmbtools
I installed it all again on Ubuntu on a windows laptop. Same problem.
Finally found a workaround which works on both raspbian and ubuntu:

odr-audioenc -d plughw:1,0 -r 48000 -c 2 -o "tcp://localhost:9001" -l -b 128


the "plughw" does the trick. Works with edi too.

Raphael Huber

unread,
May 7, 2023, 11:54:50 AM5/7/23
to mmbtools
By the way. on ubuntu there is indeed an error message, not just a hanging prompt:

odr-audioenc -d hw:2,0 -r 48000 -c 2 -o "tcp://localhost:9001" -l -b 128

Welcome to ODR-AudioEnc v3.3.1, compiled at May  7 2023, 12:44:47

  http://opendigitalradio.org


2023-05-07Z15:51:48       Initialising default TAI Bulletin URLs

2023-05-07Z15:51:48       TAI Bulletin URL: 'https://www.ietf.org/timezones/data/leap-seconds.list'

2023-05-07Z15:51:48       TAI Bulletin URL: 'https://raw.githubusercontent.com/eggert/tz/master/leap-seconds.list'

PAD disabled because neither PAD length nor PAD identifier given

Using 16 subchannels. AAC type: AAC-LC. channels=2, sample_rate=48000

AAC bitrate set to: 128000

Bandwidth is 15500

DAB+ Encoding: framelen=960 (3840B)

Initialising ALSA...

Initialising input triggered exception: cannot set sample format (Invalid argument)


I have tried to set the sample format of the audio interface in asound.conf to s16le and such stuff, but there was no change.

Only above solution worked because with plughw alsa does the converting. 


On Monday, 1 May 2023 at 07:08:38 UTC+2 Raphael Huber wrote:

Matthias Brändli

unread,
May 18, 2023, 8:08:24 AM5/18/23
to crc-mm...@googlegroups.com
Hi Raphael,

> Both pulse audio and pipewire are installed on my system.

I suspect having both active simultaneously isn't possible. pipewire
offers pulseaudio-compatible interfaces, maybe that's what you observed.

> I have now
> removed them both and rebooted.
> Then I have tried:
>
> odr-audioenc -d hw:0,0 -r 48000 -c 2 -o "tcp://localhost:9003“ -l -b 192
>
>
> and
>
>
> odr-audioenc --device=default -r 48000 -c 2 -o "tcp://localhost:9003“ -l
> -b 192


I don't know what the best approach is, but ensuring all combinations of
sound frameworks and options work is too much effort. Maybe we ought to
simplify scenarios a bit:

1. Your audio source is a stream:
- Use GStreamer, or alternatively VLC
2. Your audio source is a sound card:
a. You run a desktop enviroment that expects an audio server
- use pipewire with JACK interface with `odr-audioenc -j`
- use qpwgraph to connect the source to odr-audioenc
b. You do a dedicated audio-encoding applicance without graphical
environment
- don't install an audio server, use ALSA directly with
`odr-audioenc -d`


I've quickly tried JACK and ALSA with --device=default on my desktop
which runs pipewire, and both work.

If you agree, I'd like to continue the discussion here and close the
odr-audioenc issue
https://github.com/Opendigitalradio/ODR-AudioEnc/issues/24

mpb
Reply all
Reply to author
Forward
0 new messages