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

playing new sound will play a already paused/stopped sound prev #3422

Open
littleblack111 opened this issue Sep 29, 2024 · 22 comments
Open

playing new sound will play a already paused/stopped sound prev #3422

littleblack111 opened this issue Sep 29, 2024 · 22 comments

Comments

@littleblack111
Copy link

littleblack111 commented Sep 29, 2024

EasyEffects Version

7.1.8

What package are you using?

Arch (easyeffects)

Distribution

Arch BTW

Describe the bug

currently: #3386

but theres also two anomaly:

  • if i stop spotify, now i play sth like youtube. it would play like the last 0.1s of the spotify again then continue playing youtube
  • rn my temp solution to Crash on hyprland autostart, but work when launched normally (both in bg) #3386 is do a while true loop for autostart.
    • the issue is when it's starting, it would glitch my speaker for a spit second, its some what fine, until... today. i have 2 players on, i just paused spotify(and it crashed) THEN IT JUMPSCARD ME SOO HARD. it just give like a LARGE 5000% sound, like a beep. then it returned to normal...

Expected Behavior

none of above happening

Debug Log

Debug Log
Paste your log here

Additional Information

#3386

in case ur wondering, i dont have any delay effects/options set

@wwmm
Copy link
Owner

wwmm commented Sep 29, 2024

I think we already have a discussion about this somewhere. But I can't remember the issue name. In any case it is a hard to solve this as things are right now on PipeWire's side. There isn't a pipeline management infrastructure like the one provided by GStreamer. Where you can force the pipeline to remain active until the last plugin has received a message sent by the first plugin. PipeWire is in total control of the plugins activation as well as for how long they keep running.

the issue is when it's starting, it would glitch my speaker for a spit second, its some what fine, until... today. i have 2 players on, i just paused spotify(and it crashed) THEN IT JUMPSCARD ME SOO HARD. it just give like a LARGE 5000% sound, like a beep. then it returned to normal...

I wonder if you soundcard drier has the same problem as mine. When my soundcard comes back from the suspended state it does a very annoying crackling. It has nothing to do with EasyEffects. The difference is that depending on the plugins I am using the crackling amplitude can be very high. But it is still there when EasyEffects is not running.

In cases like this the only solution is disabling the soundcard suspension in the server configuration.

@wwmm
Copy link
Owner

wwmm commented Sep 29, 2024

Based on the list of plugins you provided on the other issue EasyEffects pipeline should have almost no data stored inside each plugin. In other words the extra latency displayed in EasyEffects bottom panel should be very small and virtually unnoticeable by ear.

@littleblack111
Copy link
Author

no. but if my volume is around 80-90 and im playing smth loud, it would crack rly hard too...

and idk wats up but my speaker performance VERY different between linux and windows(i dual boot)

in windows, 10% of it is around 80% of it in linux. and in windows it never crack(volume)...

its a eden

@wwmm
Copy link
Owner

wwmm commented Sep 29, 2024

In other words the extra latency displayed in EasyEffects bottom panel should be very small and virtually unnoticeable by ear.

Actually this isn't the case when using the loudness plugin. I tested it now and it adds quite a lot of latency depending on the FFT size. With the default 4096 value the extra pipeline latency jumps to more than 90 milliseconds. Does the glitch changes if you select smaller FFT sizes?

@wwmm
Copy link
Owner

wwmm commented Sep 29, 2024

Forget my last comment. You are using the Bass Loudness and not the loudness plugin...

@wwmm
Copy link
Owner

wwmm commented Sep 29, 2024

With the plugins you are using the extra latency should be close to zero. What means that the amount of data stored in it is negligible. I wonder from where the "last 0.1s sound" you are listening to is coming from.

@littleblack111
Copy link
Author

no idea... but def sth dealing with easyeffects because its nowhere to be seen if i kill easyeffects

@wwmm
Copy link
Owner

wwmm commented Sep 29, 2024

no idea... but def sth dealing with easyeffects because its nowhere to be seen if i kill easyeffects

I wonder if the one storing old buffers is the null-sink... If issue is still there when EE global bypass is enabled or the plugins are removed from the pipeline then the null-sink is the one with the old data.

@ManuVice
Copy link

any news here? I have the same problem with an USB DAC

@wwmm
Copy link
Owner

wwmm commented Jan 11, 2025

any news here? I have the same problem with an USB DAC

The situation is still the same on my side. Somehow on my hardware I can't notice this happening. My guess is that the interaction between pipewire and the soundcard drivers is relevant. When I am listening to something on spotify and then play a youtube video I do not listen a fraction of the paused spotify song like described in the first post.

@ManuVice
Copy link

I do not listen a fraction of the paused spotify song like described in the first post.

Thats exactly my problem. A fraction from the last played media is played.
I will take a look at it. Thank you

@wwmm
Copy link
Owner

wwmm commented Jan 12, 2025

@ManuVice which plugins are you using? What is the quantum and rate values pw-top shows for your soundcard when you playing something?

@ManuVice
Copy link

Iam running 1. multiband-compressor 2. crystalizer 3. equalizer 4. limiter

Spotify playing:
spotify

Spotify closed
spotify closed

Open Youtube frontpage without playing any video it plays a short sound like a "plopp"
open youtube

Playing a Youtube video
playing youtube

Going back from Youtube video to Youtube frontpage
stop youtube video

@wwmm
Copy link
Owner

wwmm commented Jan 12, 2025

A quantum of 2048 combined with a sampling rate of 48000 Hz would lead to a minimum latency of about 2048 / 48000 = 0.043 seconds. This is more or less what is going to happen in the vast majority of users installations. Including mine. It does not seem big enough to be causing this issue.

Open Youtube frontpage without playing any video it plays a short sound like a "plopp"

Is this "plopp" really an audio that is part of what was being played before or just an weird noise? Maybe what is happening is the noise some soundcards do when PipeWire takes them from the suspended state back to the active state. My soundcard does that. EasyEffects effects just make the noise more noticeable.

Another possibility is that you have set the equalizer to a mode that is not FIR. The other ones add a lot of latency. What also means previous audio data stored inside the plugin. This has happened to some users in the past.

@wwmm
Copy link
Owner

wwmm commented Jan 12, 2025

Another possibility is that you have set the equalizer to a mode that is not FIR

Correction. To a mode different than IIR. FIR is among the ones that add a lot of latency if I remember well.

@ManuVice
Copy link

equalizer is set to IIR

Is this "plopp" really an audio that is part of what was being played before or just an weird noise?

90% of the time I hear a small cut from my last played track or a voice from the last played video

I didnt touch my pipewire config. Only things I have changed are:

  • pipewire-pulse.conf -> "resample.quality = 10"
  • /etc/wireplumber/wireplumber.conf.d/50-alsa-config.conf
  • /etc/wireplumber/wireplumber.conf.d/51-disable-suspension.conf

51-disable-suspension.conf:

  • copied from arch linux wiki

in 50-alsa-config.conf:

  • api.alsa.period-size = 256
  • api.alsa.headroom = 0

I played a lot with these two settings (api.alsa.period-size, api.alsa.headroom) and quantum settings in pipewire.conf but nothing changed for me. I rolled back the most settings to default

@DaviDagostin
Copy link

This problem happens to me too. Setting the equalizer to IIR generates an imperceptible peak on resume and practically solves the problem.
Another possibility would be a fade in filter of a few milliseconds every time an audio stream starts.

@wwmm
Copy link
Owner

wwmm commented Jan 14, 2025

Another possibility would be a fade in filter of a few milliseconds every time an audio stream starts.

I wonder if it is possible to do this. We do not have control over the start and stop operation. PipeWire is the one controlling that. It may seem strange but it is the way things are handled. We only link the filters and handle inside each one of them the audio buffers that come. The filter does not know if somewhere far away a stream is starting.

We can separately monitor each stream state and get this information. But as the whole process is asynchronous PipeWire may have already resumed the flow of buffers to each plugin by the time we get to know if it is a new stream the one responsible tor the new buffers.

What I think is odd is that some users had this problem in the past even when we still provided a control that forced the output effects pipeline to remain active for several seconds. In a situation like this one all the old buffers should have already been drained. That is why I suspect that in most cases what is happening is the noise some cards generate when PipeWire brings them back from suspended state.

Setting the equalizer to IIR generates an imperceptible peak on resume and practically solves the problem.

For example let's consider the case of an user that uses only the equalizer. The pipeline would be

player -> null-sink -> equalizer -> spectrum -> output_level -> soundcard

. With the equalizer in the IIR mode the additional latency reported by the plugin is zero. So probably there ise no old data stored inside it. The spectrum and the output level meter work in passthrough mode. So they can not be the ones responsible for old data. So the one left to point the finger to would be the null-sink used to create the virtual device. But this is 100% PipeWire's code. We just ask it to load the virtual device for us.

Maybe the null-sink is storing data. What would be a little unexpected.

@ManuVice
Copy link

Another strange problem here

If I switch the tab in gnome settings I have audio distortion. I wanted to record the whole thing with obs-studio, but if I start obs the problem is gone.. I had to record it with my phone.. If I disable easyeffects or start obs no distortion.
With this mobile phone video you can unfortunately only hear very poorly my bad..

video with easyeffects and distortion

agc-vid-20250115-160926746_hbsCf41b.mp4

video with easyeffects + obs no distortion

agc-vid-20250115-161012966_y7GBcHEm.mp4

@wwmm
Copy link
Owner

wwmm commented Jan 15, 2025

If I switch the tab in gnome settings I have audio distortion. I wanted to record the whole thing with obs-studio, but if I start obs the problem is gone.. I had to record it with my phone.. If I disable easyeffects or start obs no distortion.
With this mobile phone video you can unfortunately only hear very poorly my bad..

For some reason the videos can not be played. But based on what your are describing the issue is probably related to PipeWire's dynamic latency switching. What you are doing on GNOME settings is probably making PipeWire switch to a different quantum value. Try to take a look at pw-top output. Depending on which plugins you have enabled on EasyEffects this can cause noises because some plugins still need to be reset when the latency changes.

The fact that keeping OBS opened fixes it is also understandable for the same reasons. The latency requested by OBS is probably smaller than the one requested by gnome settings. So the switching does not happen while OBS is running.

@ManuVice
Copy link

May I ask which sound card you are using?

@wwmm
Copy link
Owner

wwmm commented Jan 15, 2025

May I ask which sound card you are using?

The one from the motherboard https://rog.asus.com/motherboards/rog-strix/rog-strix-b650e-e-gaming-wifi-model/helpdesk_bios/. I use its optical port output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants