SoundScapeRenderer / ssr

Main source code repository for the SoundScape Renderer
http://spatialaudio.net/ssr/
GNU General Public License v3.0
134 stars 53 forks source link

Sampling Rate Issue on Ubuntu 22.04 LTS #340

Closed artpelling closed 1 year ago

artpelling commented 1 year ago

Hello all,

I am running Ubuntu 22.04.02 LTS and I get the following error after installing soundscaperenderer with apt:

➜  ~ ssr-binaural
Cannot connect to server socket err = Connection refused
Cannot connect to server request channel
jackdmp 1.9.20
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2016 Grame.
Copyright 2016-2021 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
no message buffer overruns
no message buffer overruns
no message buffer overruns
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|1024|2|44100|0|0|nomon|swmeter|-|32bit
configuring for 44100Hz, period = 1024 frames (23.2 ms), buffer = 2 periods
ALSA: final selected sample format for capture: 24bit little-endian
ALSA: use 2 periods for capture
ALSA: final selected sample format for playback: 24bit little-endian
ALSA: use 2 periods for playback
       ___     
      /  ___   
  ___/  /  ___ 
    ___/  /    SSR (SoundScape Renderer) 0.5.0~dfsg
         /     

Website: <http://spatialaudio.net/ssr/>
Contact: <ssr@spatialaudio.net>

Copyright © 2016 Division of Applied Acoustics, Chalmers University of Technology
Copyright © 2014 Institut für Nachrichtentechnik, Universität Rostock
Copyright © 2012 Quality & Usability Lab, Telekom Innovation Laboratories, TU Berlin

License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
terminate called after throwing an instance of 'std::logic_error'
  what():  Error loading HRIR file: apf::load_sndfile(): "/usr/share/ssr/default_hrirs.wav" has sample rate 44100 instead of 48000!
to fix this you should
 - change your system samplerate to 44100    OR
 - resample the file to 48000

[1]    53391 IOT instruction (core dumped)  ssr-binaural

From what I gather so far, Ubuntu 22.04 uses Pipewire instead of Pulseaudio. I have changed the sampling rate to 44100 in /etc/pulse/daemon.conf as well as in Pipewire with pw-metadata -n settings 0 clock.force-rate 44100. After I changed the Pipewire sampling rate, ssr-binaural now launches jackd with 44100 successfully, which was not the case before. However, ssr-binaural still complains about 48000. Where does it get the sampling rate from? Is this a known issue?

Any help is greatly appreciated!

umlaeute commented 1 year ago

ssr-binaural now launches jackd with 44100 successfully, which was not the case before. However, ssr-binaural still complains about 48000.

i'm not sure i fully understand what you mean.

  1. does ssr-binaural launch a jackd process? even if pipewire is running? doesn't pipewire replace your jackd?
  2. does ssr-binaural launch or does it complain ; or both?
  3. if either both or the former: does it work regardless of the complaint?
  4. so what's the output when you launch ssr-binaural
artpelling commented 1 year ago

ssr-binaural now launches jackd with 44100 successfully, which was not the case before. However, ssr-binaural still complains about 48000.

i'm not sure i fully understand what you mean.

Sorry if I am not being clear enough. My issue is that ssr-binaural does not launch, because it complains about the hrir having 'sample rate 44100 instead of 48000'. However, I have set the sampling rate to 44100 for pulse and jackd.

1. does `ssr-binaural` launch a jackd process? even if pipewire is running? doesn't pipewire replace your jackd?

ssr-binaural launches a jackd process, if there is none. I have also tried launching a jackd process beforehand. In this case, ssr-binaural fails with the same error message (but does not launch jackd). The log messages tell me that jackd is in fact launched with 44100. I have to admit that I do not fully understand what is going on with pipewire. From what I have read online, it is now shipped with Ubuntu 22.04 per default but only partially enabled. So jackd and pulse should not be affected in that regard. What I find peculiar is that ssr-binaural was not able to launch jackd before I changed the pipewire sample rate.

2. does `ssr-binaural` _launch_ or does it _complain_ ; or both?

It complains and does not launch.

3. if either both or the former: does it work regardless of the complaint?

No.

  1. so what's the output when you launch ssr-binaural Please see the error log in my original post.

I am pretty convinced that I have changed the sampling rate to 44100 successfully. jackdtells me that on launch and also pactl info shows 44100. Without diving into the source code, it seems to me that ssr-binaural reads the wrong sampling rate value from some place. Since the calling ssr-binaural was affected by changing pipewires sample rate as well, I wonder what I am missing.

umlaeute commented 1 year ago

most likely it is something as mundane as pipewire having grabbed the soundcard and jackd hacing some other troubles.

in order to run jack applications on top of pipewire, you can either

in any case, afaict you can set the samplerate/blocksize per application with pd-jack (but not with the libjack replacement).

So try something like this:

pw-jack -s 44100 -p 512 ssr-binaural

(for whatever reasons i had to pass the period (-p ) to pw-launch, otherwise ssr-binaural would complain about the wrong samplerates.

artpelling commented 1 year ago

Thanks! Installing pipewire-jack from PPA (there was no installation candidate) has now fixed the issue. So I am closing now. Keep in mind that I used vanilla Ubuntu 22.04 LTS, so this might affect the user experience of others in the future as well.

Since I am pretty new to Linux real-time audio and it seems to be some headache, I wanted to ask, whether you could comment on how to set up a working system somewhat easily (e.g. use Ubuntu Studio/Arch instead, Jack or Pipewire etc.)?

umlaeute commented 1 year ago

it seems like pipewire-jack is only available in vanilla Ubuntu >=22.10. https://packages.ubuntu.com/search?keywords=pipewire-jack&searchon=names&exact=1&suite=all&section=all