All times are UTC+01:00




Post new topic  Reply to topic  [ 60 posts ]  Go to page 1 2 3 4 5 6 Next
Author Message
PostPosted: Mon Apr 25, 2022 11:42 pm 

Joined: Mon Apr 25, 2022 11:19 pm
Posts: 92
Hello kind folks!

I have assembled the system as per the subject line and I'm really struggling to get it to work the way I'd like it to.

So at the moment, I can run ST 9.90, have analogue audio going into the RCA jacks and I can hear the processed sound coming out of the output from the HiFiBerry card. So that part works great.

What I am trying to do, is have the processed audio out of ST transmitted as streaming audio which any internet radio on the LAN can connect to (for now - it can go external at a later stage) - this could be icecast running on the RPi 4. Ideally, I'd like to encode AAC/MP3 at 320K or even FLAC to ensure the highest quality output. I would prefer to have the RPi 4 do all this as it's fairly powerful and does have some processing capacity available.

Now, I have looked at many guides online about Alsa, Pulseaudio, Jack, Icecast, Ices2, Darkice, and nothing works, either the software installed failed for icecast2 for some reason, or Jack wouldn't play, or Ices2 would grab control of the HifiBerry card and not allow it to be used by the OS or ST!

So I'm looking for pointers and ideas as to how I can make this work. I have managed to get this kind of set up work OK on the Apple Mac but it seems a complete struggle with the RPi! I recall using something similar to Jack to grab the output of ST and then piping it into another tool which provided the web streams on the same box.

I'm hoping to end up with a hardware solution which can simply take in the audio 24/7 and constantly transmit it as a web stream as well as being listenable directly from the outputs too for monitoring purposes.

I would really appreciate any help with this and thank you in advance!


Top
   
PostPosted: Tue Apr 26, 2022 8:23 pm 

Joined: Thu Jan 15, 2015 11:19 am
Posts: 193
Two pointers, which may lead you to some useful resource on the internet.

You can either
- use the ALSA version of Stereotool and run it on the Hifiberry card. Add an ALSA loopback device to your system (snd-aloop) and play one of the two outputs of ST (either FM or normal) to it. If you're not creating an FM multiplex, FM output sounds just fine. Then use some ALSA icecast client and record from the ALSA Loopback device.
- use the JACK version of Stereotool and let Jack run on the Hifiberry card using ALSA. Then run Stereotool and route the signals through Jack. (Patchage is a friend, aj-snapshot even more). Then use Darkice and connect it to Jack as well

My favourite would be the latter.

Both options require an Icecast server somewhere, can be locally.

I don't know if the internal Icecast client of Stereotool is available in Linux. If it is, you might still need to install VLC to have the libs.


Top
   
PostPosted: Wed Apr 27, 2022 10:40 pm 

Joined: Mon Apr 25, 2022 11:19 pm
Posts: 92
Thanks for this, it's very helpful!

So I decided to go down the Jack route, and sadly, ST didn't want to play ball. Does it only work with certain versions of Jack?

This is what happens when I start up Jack:
pi@raspberrypi:~ $ jackd -d alsa -p 4096 -n 4
jackdmp 1.9.12
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2016 Grame.
Copyright 2016-2017 Filipe Coelho.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
JACK server starting in realtime mode with priority 10
self-connect-mode is "Don't restrict self connect requests"
audio_reservation_init
Acquire audio card Audio0
creating alsa driver ... hw:0|hw:0|4096|4|48000|0|0|nomon|swmeter|-|32bit
configuring for 48000Hz, period = 4096 frames (85.3 ms), buffer = 4 periods
ALSA: final selected sample format for capture: 32bit integer little-endian
ALSA: use 4 periods for capture
ALSA: final selected sample format for playback: 32bit integer little-endian
ALSA: use 4 periods for playback

So far, seems OK...

Then this is what happens when I try to run the Jack version of ST:
pi@raspberrypi:~/Downloads $ sudo ./stereo_tool_gui_jack_pi2
Thimeo Stereo Tool 9.90 (for Linux with Jack) (C) Thimeo Audio Technology, 2001-2022
jack_client_new: deprecated
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackIO: Error: Cannot open JACK client, is jackd running?
Segmentation fault


Top
   
PostPosted: Wed Apr 27, 2022 10:55 pm 

Joined: Thu Jan 15, 2015 11:19 am
Posts: 193
Short hint: you launch jack as normal user, but start Stereotool using sudo. This won't work as jack sessions are bound to the user.
Try to omit sudo when starting Stereotool.


Top
   
PostPosted: Fri Apr 29, 2022 10:31 pm 

Joined: Mon Apr 25, 2022 11:19 pm
Posts: 92
That didn't seem to make a difference :-(

pi@raspberrypi:~/Downloads $ jackd -d alsa -p 4096 -n 4
jackdmp 1.9.12
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2016 Grame.
Copyright 2016-2017 Filipe Coelho.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
JACK server starting in realtime mode with priority 10
self-connect-mode is "Don't restrict self connect requests"
audio_reservation_init
Acquire audio card Audio0
creating alsa driver ... hw:0|hw:0|4096|4|48000|0|0|nomon|swmeter|-|32bit
configuring for 48000Hz, period = 4096 frames (85.3 ms), buffer = 4 periods
ALSA: final selected sample format for capture: 32bit integer little-endian
ALSA: use 4 periods for capture
ALSA: final selected sample format for playback: 32bit integer little-endian
ALSA: use 4 periods for playback

then....

pi@raspberrypi:~/Downloads $ ./stereo_tool_gui_jack_pi2
Thimeo Stereo Tool 9.90 (for Linux with Jack) (C) Thimeo Audio Technology, 2001-2022
jack_client_new: deprecated
Segmentation fault


Top
   
PostPosted: Sat Apr 30, 2022 1:04 am 

Joined: Mon Apr 25, 2022 11:19 pm
Posts: 92
I seem to have more luck with your first option:

- use the ALSA version of Stereotool and run it on the Hifiberry card. Add an ALSA loopback device to your system (snd-aloop) and play one of the two outputs of ST (either FM or normal) to it. If you're not creating an FM multiplex, FM output sounds just fine. Then use some ALSA icecast client and record from the ALSA Loopback device.


I have the ALSA loopback devices installed, darkice and icecast2 are both working fine - but I just get silence!

On ST for testing purposes I have set the normal output to Loopback: PCM (hw:1,0) (ALSA)

Darkice was configured to record from ALSA DSP input device: hw:1,0 but nothing was heard, even on hw:1,1 - so I'm not sure why it's not picking up any sound from ST, even though I can see ST is processing fine.


Top
   
PostPosted: Sat Apr 30, 2022 11:31 pm 

Joined: Mon Apr 25, 2022 11:19 pm
Posts: 92
Looks like I've solved it.

So I've had to use the direct input from HifiBerry into ST

The normal output goes into Default (Alsa)

Darkice picks it up via hw:1,1 (Alsa Loopback) then sends it to Icecast2.

I happened to be playing around with ST's output when the working stream suddenly kicked into life!

I just need to iron out some of the issues when it occasionally stutters, I have stepped down the CPU profile to pi3 on ST in case it helps. It's working too hard I think.

I can hear this on my home LAN now on my internet radios.

Any tips to help it work better are welcome :-)


Top
   
PostPosted: Sun May 01, 2022 9:52 am 

Joined: Mon Apr 25, 2022 11:19 pm
Posts: 92
It looks like the stuttering is caused by ALSA buffer underruns so I need to figure out a way to increase the buffer size or something. This is reported by ST in the terminal box where I ran it from.

Also it seems impossible to have a monitoring output working from HiFiBerry without killing the feed to darkice/icecast. It's not the end of the world but a nice to have.

May need to play around a bit more, but this is a huge step forward so far!


Top
   
PostPosted: Sun May 01, 2022 1:00 pm 

Joined: Mon Apr 25, 2022 11:19 pm
Posts: 92
ALSA lib pcm.c:8424:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8424:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8424:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8424:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8424:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8424:(snd_pcm_recover) underrun occurred


This is what ST is reporting in the command line at the moment and I believe is linked to the audio stuttering. If this issue was solved, the solution would be perfect!

I'd also like to improve on the 320K MP3 output by perhaps doing 320K AAC or even FLAC etc... my internet radios can support these codecs too. Liquid soap is something I heard as a possible solution to offer better quality streams.


Top
   
PostPosted: Sun May 01, 2022 1:54 pm 

Joined: Mon Apr 25, 2022 11:19 pm
Posts: 92
My suspicions are with pulseaudio in terms of the stuttering audio.

It seems the recommendation is that pulseaudio shouldn't be used with Raspberry Pi these days, but if I remove it, the set up stops working. So I've had to have it back in.

Tweaking daemon.conf for pulseaudio didn't seem to help - in fact it made things worse. There were some settings that were supposed to improve buffering if increased but the sound went completely wrong, even worse than just stuttering.

default-fragments = 5
default-fragment-size-msec = 2

So back to the defaults again.

So if there are any Alsa and Pulseaudio experts using them with ST on Raspberry Pi, I'd appreciate any advice about how they can be made to work more smoothly, getting rid of the buffer underruns and the stuttering audio.

When it works, it's a superior way to distribute audio and compensates for the huge variances in audio levels coming out of the source which is currently Apple Music. It really does make music sound a lot better from the internet radio sets!

I hope to get this issue resolved so it works as intended :-)


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 60 posts ]  Go to page 1 2 3 4 5 6 Next

All times are UTC+01:00


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Limited