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

Rattling sound from Linux to Android #31

Closed
mfeng9 opened this issue Jan 10, 2024 · 6 comments
Closed

Rattling sound from Linux to Android #31

mfeng9 opened this issue Jan 10, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@mfeng9
Copy link

mfeng9 commented Jan 10, 2024

Describe the bug
Rattling sound when relaying audio from Linux to Android. The audio plays alright, but with clear rattling sound in the background.

To Reproduce
Installed Android APKs and the ran the Linux binary of the same version from Git.

Expected behavior
Clear sound.

Server:

  • OS: Linux Fedora (Silverblue) 6.6.8-200.fc39.x86_64
  • Version: v0.015 and v0.014
  • Pipewire version: 1.00
 $ pipewire --version
 pipewire
Compiled with libpipewire 1.0.0
Linked with libpipewire 1.0.0

Android:

  • Device: Samsung Tab S3 and Samsung Tab S6
  • OS: Android 9 and Android 11
  • Version: v0.015 and v0.014

Additional information
Nothing strange from the terminal output (shown below):

[2024-01-10 02:03:43.523] [info] pipewire header_version: 0.3.48, library_version: 1.0.0
[2024-01-10 02:03:43.526] [info] endpoint_id: 45
[2024-01-10 02:03:43.526] [info] tcp listen success on 10.29.173.44:65530
[2024-01-10 02:03:43.526] [info] udp listen success on 10.29.173.44:65530
[2024-01-10 02:03:43.526] [info] server started
[2024-01-10 02:03:43.526] [info] select audio endpoint: ALC285 Analog
[2024-01-10 02:03:43.552] [info] block_align: 8
[2024-01-10 02:03:43.552] [info] AudioFormat:
format_tag: 3
channels: 2
sample_rate: 48000
bits_per_sample: 32

[2024-01-10 02:04:02.283] [info] accept 10.31.134.170:42828

I saw the same thing from other issues but on Windows, maybe you could apply the same fix for Linux as well?

@mfeng9 mfeng9 added the bug Something isn't working label Jan 10, 2024
@mkckr0
Copy link
Owner

mkckr0 commented Jan 10, 2024

It may be caused by PipeWire itself. Run pw-play -v test.wav to see the delay.

Rocky Linux 9 works well, the delay is 2048 and I can hear a clear sound.

now=2472351168973 rate=1/48000 ticks=43008 delay=2048 queued=0
now=2473075616347 rate=1/48000 ticks=77824 delay=2048 queued=0
now=2474183420970 rate=1/48000 ticks=131072 delay=2048 queued=0
now=2475351964615 rate=1/48000 ticks=186368 delay=2048 queued=0
now=2476069723593 rate=1/48000 ticks=221184 delay=2048 queued=0
now=2477168449525 rate=1/48000 ticks=274432 delay=2048 queued=0
now=2478279790842 rate=1/48000 ticks=327680 delay=2048 queued=0
now=2479399421351 rate=1/48000 ticks=380928 delay=2048 queued=0

I also test on Fedora 39, which delay is 10240 and I can hear noisy sound.

stream time: now:1912175561068 rate:1/48000 ticks:61440 delay:10240 queued:1882 buffered:32 buffers:1 avail:1
stream time: now:1913004872486 rate:1/48000 ticks:94208 delay:10240 queued:1881 buffered:32 buffers:1 avail:1
stream time: now:1913896419255 rate:1/48000 ticks:120832 delay:10240 queued:1882 buffered:32 buffers:1 avail:1
stream time: now:1914859452183 rate:1/48000 ticks:149504 delay:10240 queued:1881 buffered:32 buffers:1 avail:1
stream time: now:1915894128718 rate:1/48000 ticks:180224 delay:10240 queued:1881 buffered:32 buffers:1 avail:1

Maybe changing some config of PipeWire can fix it. But I'm not familiar with it.

@mfeng9
Copy link
Author

mfeng9 commented Jan 10, 2024

I can confirm that with pw-play, I had rattling sound as well. But after following the instructions from https://linuxmusicians.com/viewtopic.php?t=25768, I was able to get clear sound with pw-play. Unfortunately, the remote audio still is noisy even though pw-play is working well.

@mkckr0
Copy link
Owner

mkckr0 commented Jan 11, 2024

I can confirm that with pw-play, I had rattling sound as well. But after following the instructions from https://linuxmusicians.com/viewtopic.php?t=25768, I was able to get clear sound with pw-play. Unfortunately, the remote audio still is noisy even though pw-play is working well.

This post introduce the new config way using pw-metadata -n settings instead of editing the .conf file directly. But the Rokcy Linux 9 and Fedora 39 both have same runtime settings.

[abc@localhost ~]$ pw-metadata -n settings
Found "settings" metadata 30
update: id:0 key:'log.level' value:'2' type:''
update: id:0 key:'clock.rate' value:'48000' type:''
update: id:0 key:'clock.allowed-rates' value:'[ 48000 ]' type:''
update: id:0 key:'clock.quantum' value:'1024' type:''
update: id:0 key:'clock.min-quantum' value:'1024' type:''
update: id:0 key:'clock.max-quantum' value:'2048' type:''
update: id:0 key:'clock.force-quantum' value:'0' type:''
update: id:0 key:'clock.force-rate' value:'0' type:''

@mkckr0
Copy link
Owner

mkckr0 commented Jan 11, 2024

The Rocky 9 and Fedora 39 are both installed in my VirtualBox. I install VBox Guest Additions for Fedora 39 and the sound become clear while the PipeWire settings is untouched.

@mkckr0
Copy link
Owner

mkckr0 commented Jan 15, 2024

I'll close this issue. If you still have problem, you can reopen it.

@mkckr0 mkckr0 closed this as completed Jan 15, 2024
@mfeng9
Copy link
Author

mfeng9 commented Jan 19, 2024

Here is a little tip for other Linux users: there is a flatpak app that relays audio from Linux device without rattling sound but perhaps higher latency: https://flathub.org/apps/de.haeckerfelix.AudioSharing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants