Re: samplerate~ race condition?

IOhannes m zmölnig <[email protected]>
Newsgroups gmane.comp.multimedia.puredata.general
Message-ID <[email protected]>
On 10/01/2025 00:13, Peter P. wrote:
> Hi list,
> 
> on Debian Linux with jackd running at 44100 it seems that [samplerate~] when [loadbang]ed will report a rate of
> 48000. But if this loadbang is [delay]ed by 1msec it will report the
> correct rate of 44100.

i can reproduce this. (and btw, a [delay 0] is sufficient to get the 
correct samplerate)

i wouldn't call it a "race condition" though, it's just that Pd 
initializes the audio backend after sending out the loadbangs.

christof's PR will probably fix this.

in general, the audio backend might impose a samplerate different from 
what you (or Pd) expected.
that could lead to a behaviour similar to what you describe, though 
totally expected. e.g. if you have two fixed-samplerate soundcards, one 
of them running at 48k and the other at 44.1k, and you switch from one 
to the other; then [samplerate~] should report different rates depending 
on when you bang it.
in order to work around this, you should probably query [samplerate~] 
when the DSP gets (re)started, rather than with loadbang.


however, the the really weird thing about this is actually that the 
samplerate passed via the preferences (and cmdline-flags) is ignored.
i would expect Pd to honour those settings in the first place 
(defaulting to 48000), and only change it if the audio backend demands 
otherwise.

using your settings-file (which sets 44100) and starting Pd *without* 
sound, but with (or without) an explicit "-r44100" i get:

```
pd -nosound -r 44100
```

i get:
@loadbang: 48000
@loadbang+0: 48000
@loadbang+1: 48000

hecking the audio-settings, i see that Pd claims to still use JACK as 
the backend (though - as expected - there's no sound), even if no JACK 
is actually running¹.


so yes, there are things to be fixed.

gmsadr
IOhannes




¹ all my JACK experiments now are a bit complicated, as i have PipeWire 
running and it's the default JACK implementation. but uisng 
LD_LIBRARY_PATH= to force the "real" JACK onto Pd (and jackd), seems to 
work OK.

---
[email protected] - the Pure Data mailinglist
https://lists.iem.at/hyperkitty/list/[email protected]/message/7NFBTXRWKLGT7HXJZY735VZJ6DVDD246/

To unsubscribe send an email to [email protected] mailing list
UNSUBSCRIBE and account-management -> https://lists.iem.at/
OpenPGP_signature.asc (application/pgp-signature, 840 B)
-----BEGIN PGP SIGNATURE-----

wsF5BAABCAAjFiEEdAXnRVdICXNIABVttlAZxH96NvgFAmeBCG8FAwAAAAAACgkQtlAZxH96Nvih
/g//cjBIs2KHwaerUxs0uVlZ7Hv27FxEgOsAiHZfoAOxuHEr1DJpyqANGZiWDiC4B7NnUoJ/N/As
R7bAMHjSfwbA7Rqo8WxU3fkaPl5u3yPEoy/kO/199H9cEOW4ejKoaOoFVpD4LLRMC6eK+rdEGhfi
ElHBnFD5aE+3NlSfoemUUZ1K8lYyhTxhl8U7sUY5/ixBGl/JI9CTrsjzhYXWe3oQ3IOm+DWm/u1t
66xLcPon9PBXAhcDNMPDvfIg3hzxVORFm92bgHmsQ7Jnz8HneBkr0UfqjCTGglEQnMgAnaiofayF
qTuJ4TE7JRd5YfeyUfq1XldKEH2qSrREUjWIP8KZ1IwnIwgaL9mvAlfoO0JGH3TcTYZodqOhhl5b
oT4fx1Bk9HXX2I3EuDloKK6low4d4ni5SE8sli+s/KTXEfqQkWU4Dw2Vo69yY4+Ff7OFVCxM/aFc
ro+kHdKWVxvSywtlXDtkVj3LtBN77xHUqfQhewkjxNfOCHY3gVk8dQblxYcMq/ms7ldGUBXQ+4f+
I+dnoBMt2E0S/BunZHfAsxhmaLpxLD3mhFXSKsVF81a1Xe2Qh1zheHXd3VR114NszfbCKCT/Y3uW
zq2nhZ1+SlKjpb51SjEsW14hDrfYtD29v8B/BzQUN/YpI3pMezl29QVSHJJjWA5/LHq7Czz2Tnm+
5/I=
=ggPa
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.