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

Audio drops out intermittently #158

Closed
andrewrk opened this issue Jan 26, 2014 · 42 comments
Closed

Audio drops out intermittently #158

andrewrk opened this issue Jan 26, 2014 · 42 comments

Comments

@andrewrk
Copy link
Member

I get glitchy audio sound about half of the times I open LMMS. Usually it goes away and everything sounds normal again after tinkering around for 60 seconds or so. I am not yet able to reliably duplicate the problem or make it stop when it occurs.

@SadaleNet
Copy link
Contributor

I am using ALSA output in LMMS, and using PulseAudio for my system.

It seems that if you have another program that using audio output, the chance of getting glitchy sound is high.

Work around:

  • Closing the program that using audio output
  • Play some notes while changing the system volume.
  • The sound will no longer be glitchy

@andrewrk
Copy link
Member Author

Interesting find. I am also using ALSA output with PulseAudio for my system. I'll have to experiment around with this, thanks for the tip.

@mikobuntu
Copy link
Contributor

it seems in general that pulseaudio is glitchy with most programs. i find if i kill pulseaudio and stop it from respawning LMMS will work fine. the way to do this as a user and not system wide is create a file ~/.pulse/client.conf with contents autospawn = no and killall pulseaudio in the terminal.

@SadaleNet
Copy link
Contributor

@mikobuntu Besides LMMS, I did notice that some programs renders glitchy sounds. However, some program render sounds very well with pulse audio.

I suspect this issue is the problem of ALSA compatibility layer for pulse audio. I am not sure tho.

@SadaleNet
Copy link
Contributor

Surprising finding! It seems that this bug is eliminated with the following setting:
In Edit->Audio Setting->Audio Interface , set the combobox to Pulse Audio (bad latency!)

I wonder why it said bad latency. There is no any observable latency for me. Maybe the text bad latency is outdated.

Again, I guess that it could be a bug of ALSA compatibility layer for pulse audio.
Possibly solution: set Pulse Audio as the default audio interface?

@diizy
Copy link
Contributor

diizy commented Jan 26, 2014

When you select ALSA in the settings, you have to edit the "device" textbox to point directly to your sound device (it is "hw:0,0" for me but may vary between systems and soundcards). There's instructions in the old wiki on how to find out your soundcard designation. Otherwise, PA will intercept the ALSA output (this is the compatibility layer in PA), and even though you select ALSA it will be output via PA.

Unless you do this trick, there isn't likely to be much of a difference between choosing PA or ALSA output. The only downside is, that this hogs the soundcard entirely for LMMS, and no other software can output audio. Note - if you use this method, don't try to view youtube videos while LMMS is open! It will hang your browser.

@SadaleNet
Copy link
Contributor

Unless you do this trick, there isn't likely to be much of a difference between choosing PA or ALSA output.
@diizy Somewhat doubtful. By setting the output to PA, the issue is gone here.

@diizy
Copy link
Contributor

diizy commented Jan 30, 2014

On 01/30/2014 11:09 AM, wongcc966422 wrote:

Unless you do this trick, there isn't likely to be much of a
difference between choosing PA or ALSA output.
@diizy <https://github.com/diizy> Somewhat doubtful. By setting
the output to PA, the issue is gone here.


Reply to this email directly or view it on GitHub
#158 (comment).

How's the latency? For me PA is unusable, it gives a noticeable delay
when you try to play anything...

@eagles051387
Copy link

Wouldnt that be easily fixed by increasing or decreasing buffer size?

On Thursday 30 January 2014 01:42:49 Vesa V wrote:

On 01/30/2014 11:09 AM, wongcc966422 wrote:

Unless you do this trick, there isn't likely to be much of a
difference between choosing PA or ALSA output.
@diizy <https://github.com/diizy> Somewhat doubtful. By setting
the output to PA, the issue is gone here.


Reply to this email directly or view it on GitHub
#158 (comment).

How's the latency? For me PA is unusable, it gives a noticeable delay
when you try to play anything...


Reply to this email directly or view it on GitHub:
#158 (comment)

@diizy
Copy link
Contributor

diizy commented Jan 30, 2014

On 01/30/2014 11:54 AM, eagles051387 wrote:

Wouldnt that be easily fixed by increasing or decreasing buffer size?

That doesn't work very well on PA. Causes glitches if you set the buffer
too low. Sound stutters. When you set it high enough, the latency gets
too high for audio work...

That's been my experience at least.

@tobydox
Copy link
Member

tobydox commented Jan 30, 2014

PA is not made for realtime audio, that's it. When I developed the PA backend in LMMS a few years ago I tried everything to mitigate the latency problem but failed, as AFAIR PA dictates the buffer size. So all we can recommend is to continue using ALSA which works best in most cases.

@tobydox tobydox closed this as completed Jan 30, 2014
@diizy
Copy link
Contributor

diizy commented Jan 30, 2014

On 01/30/2014 01:40 PM, Tobias Doerffel wrote:

PA is not made for realtime audio, that's it. When I developed the PA
backend in LMMS a few years ago I tried everything to mitigate the
latency problem but failed, as AFAIR PA dictates the buffer size. So
all we can recommend is to continue using ALSA which works best in
most cases.

One thing that I'd like to suggest for making it easier to the user to
use ALSA: make the "device" setting a drop-down menu instead of a
textbox, kind of like it is in audacity. Autodetect all audio devices,
and let the user select it easily from a dropdown. This would make it
much easier to use pure ALSA, not having to look up device names in the
terminal and then input them in manually...

@tobydox
Copy link
Member

tobydox commented Jan 30, 2014

This is implemented in the new setup dialog from the old master branch which is going to be backported for one of the next releases.

@eagles051387
Copy link

I cna confirm this issue still exists for me. but ironically when i switched from alsa to pulse audio the issue went away all together.

@eagles051387 eagles051387 reopened this Jan 31, 2014
@diizy
Copy link
Contributor

diizy commented Jan 31, 2014

On 02/01/2014 01:24 AM, eagles051387 wrote:

I cna confirm this issue still exists for me. but ironically when i
switched from alsa to pulse audio the issue went away all together.

Did you have the ALSA device setting pointed directly to your hardware
device, to prevent PulseAudio from intercepting the ALSA output?

@eagles051387
Copy link

I used the default settings that lmms had set

On Friday, January 31, 2014 03:28:31 PM Vesa V wrote:

On 02/01/2014 01:24 AM, eagles051387 wrote:

I cna confirm this issue still exists for me. but ironically when i
switched from alsa to pulse audio the issue went away all together.

Did you have the ALSA device setting pointed directly to your hardware
device, to prevent PulseAudio from intercepting the ALSA output?


Reply to this email directly or view it on GitHub:
#158 (comment)

@diizy
Copy link
Contributor

diizy commented Feb 1, 2014

On 02/01/2014 02:23 AM, eagles051387 wrote:

I used the default settings that lmms had set

In that case your ALSA output was probably intercepted by PA which
caused the glitchy audio.

Try this:

http://lmms.sourceforge.net/wiki/index.php/Troubleshooting#I_get_lots_of_latency_.28lag.29_when_playing_instruments_in_LMMS

Follow the instructions there to find out your device designation and
set it in the "device" text box. This lets you use ALSA directly,
without interference from PA. I've found LMMS to work best this way.

@mikobuntu
Copy link
Contributor

guys dont forget you can also change your sound server (ubuntu , and probably linux variants) by using "gstreamer-properties" in the terminal :)

@ztangent
Copy link

ztangent commented Mar 3, 2014

I think this is the same bug that in Pulseaudio 4.0 that is now also affecting Skype. The Pulseaudio devs seem to have written about it here, and provided a fix/workaround as well:
http://arunraghavan.net/2013/08/pulseaudio-4-0-and-skype/

Basically you have to run:
env PULSE_LATENCY_MSEC=60
before running LMMS. It seems to fix the problem for me.

@diizy
Copy link
Contributor

diizy commented Mar 4, 2014

60ms is way too much latency. You can easily get to 10ms latency with ALSA/Jack on almost any hardware.

@Umcaruje
Copy link
Member

Is this still an issue? I've been using lmms with alsa for over 2 years now and I never encountered this. Can someone still reproduce?

@tresf
Copy link
Member

tresf commented Jun 25, 2015

Yes, this is still relevant for me and I can confirm that Apple has these identically described issues. 60 seconds is a bit extreme though. Pausing and playing again after about 5 second fixes it every time.

@Umcaruje Umcaruje added the core label Jun 25, 2015
@iraklisg
Copy link

iraklisg commented Sep 7, 2015

I have the problem with "glitchy" sounds from time to time when I run LMMS with ALSA in linux mint 17 cinnamon 64bit. The "quick" workaround I have found is to reboot my pc.
Additionally I cannot figure out how to use LMMS with pulseaudio (the pulseaudio package is installed in my system but I cannot find "pulse" in Settings-> Audio interfaces...)

@YvesPaultre
Copy link

This issue only exists for me when I have additional programs open; but the problem is that I want to livestream my work. I need Firefox open to view stream chat, and OBS to actually stream it, but every time I make a major change to the project, the sound goes kaput. When I open Sound Settings to check, the alsa-plugin for LMMS is rapidly appearing and disappearing from the Applications tab.

Also, the issue is not always present when I have multiple programs open. Sometimes when the issue does present itself, it fixes itself after a while. This does not happen often, though.

@andrewrk
Copy link
Member Author

@CtrlFreak1337 in addition to PulseAudio you can try using JACK to livestream your work.

AFAIK there are 2 ways to use the JACK backend - directly or via the libsoundio backend. You can try both.

@YvesPaultre
Copy link

@andrewrk Thanks. I've recently reinstalled LMMS, and the issue doesn't seem to be resurfacing. If it does, though, I'll be sure to look at those alternatives.

@trekkers2208
Copy link

I'm having this same issue. Using Mint 17 Cinnamon, LMMS will work fine for a while, then all of a sudden while previewing instruments, the sound goes distorted. I suspected having the browser open at the same time as LMMS caused the issue so i quit doing that. Even when LMMS is the only program open it still does it. Audio settings are set to use the OS card and my speakers selected as the device.

@jasp00
Copy link
Member

jasp00 commented Apr 25, 2016

I am unable to get any sound from PulseAudio. Is this still an issue with PulseAudio 8.0?

@jasp00
Copy link
Member

jasp00 commented Apr 25, 2016

Yes, it is. The PULSE_LATENCY_MSEC=60 workaround does not work. The glitch mode is triggered by high CPU usage and it may last indefinitely.
The solution would be:

  1. Detect the likely interception (ALSA device set to default and the presence of /usr/share/alsa/alsa.conf.d/pulse.conf).
  2. Switch to the PulseAudio back end.

Would this be OK?

@tresf tresf changed the title intermittent: all audio sounds glitchy (pulseaudio/alsa issue?) Audio drops out intermittently Mar 11, 2019
@enp2s0
Copy link
Contributor

enp2s0 commented Oct 6, 2019

Old but I may still have this issue on 1.2.0. The sound is incredibly distorted and glitchy (lots of high freq. noise, almost like you took a reverb on master and bitcrushed it), but it always goes away if I adjust the audio volume on my system (arch linux, kde + pulseaudio, sdl as LMMS backend)

@enp2s0
Copy link
Contributor

enp2s0 commented Nov 5, 2019

Also when this issue occurs it affects all system sounds, not just LMMS.

@stevphie
Copy link

stevphie commented Nov 5, 2019

This very easy to trigger, pick one of the default samples/presets available (by hold and click) while playing your track

@SadaleNet
Copy link
Contributor

Now that I come to think of it, I suspect that it could be caused by CPU issue. If the CPU is at 100%, this may happen.

Anyway I'm not going to verify this theory any time soon. I haven't used LMMS for quite a while.

@dan-giddins
Copy link

dan-giddins commented Jan 31, 2021

This very easy to trigger, pick one of the default samples/presets available (by hold and click) while playing your track

I can't recreate this issue on 1.3.0-alpha on windows. What's being described sounds a lot like issues with the selected audio driver, not LMMS. Can we close this for now, as I'm not sure what we can do to fix this... @tresf is this still an issue for you?

@tresf
Copy link
Member

tresf commented Jan 31, 2021

I don't use Linux for audio production, but I doubt this was fixed. I believe it's an underrun problem. I patched this to the best of my ability on Windows by setting the lmms.exe process priority from normal to high. I haven't done a similar patch to the Mac or Linux versions, so the QThread priorities are the best we have currently.

This should be closed by someone who actually uses Linux for production, and preferably a developer that does so on a slower machine.

Alternately we can close and tell users to request a reopen as needed, but I don't think this bug has been addressed in newer versions so I would credit faster machines for the fix, not any code changes.

@tresf
Copy link
Member

tresf commented Jan 31, 2021

Furthermore the patch proposed by @jasp00 has a link to a Debian mailing list, but no cross-reference to the ALSA list which would have needed to implement his patch.

So at time of writing this, even our own internal patch seems as if may have been merged prematurely. @jasp00 would know more, but searching for the "don't intercept" PUSLE_AUDIO_HOOK_CONF introduced by #2292 in Google yields exactly two results, both mailing list archives between @jasp00 and the Debian mailing list.

https://www.mail-archive.com/pkg-pulseaudio-devel@lists.alioth.debian.org/msg05363.html

Regardless, in my testing, PulseAudio isn't the issue, just makes it worse. I have a detailed write-up about this in another bug report, happy to locate and cross-link if needed.

@dan-giddins
Copy link

@tresf if no one is able to reproduce a bug, does it exsit...
or rather is it even a bug with LMMS?

I suspect this issue is the problem of ALSA compatibility layer for pulse audio. I am not sure tho.

combined with

Now that I come to think of it, I suspect that it could be caused by CPU issue.

and the fact that you solved it by changing the process priority to high implies that this is an issue with how the OS is handling the audio workload. What can we actually do about this for Mac or Linux?

@dan-giddins
Copy link

dan-giddins commented Jan 31, 2021

I have a detailed write-up about this in another bug report, happy to locate and cross-link if needed.

That might be a good idea, in case this issue appears again in the future.
Github really needs an 'On-Hold' state for issues that can be neither reproduced by active developers, nor confirmed to be fixed...
If you are one of the people in this thread who is having this problem, I think its worth testing again to see if this still an issue.

@tresf
Copy link
Member

tresf commented Jan 31, 2021

Personally, I produce solely with Mac, and a very fast machine, so hard to guage the impact on that platform, but what I had discovered when I last investigated this is there are some potential instances where our UI theading is incorrectly set as the same priority as the mixer, so something as simple as dragging a Window can make the underrun start and never recover.

I'm no expert on realtime DSP scheduling, nor a C++ coder, but I'll find and link my detailed findings last I looked into this...

@tresf
Copy link
Member

tresf commented Jan 31, 2021

@dan-giddins here's the thread: #1600
Here's a relevant patch for the very-specific-issue found in that thread: #1932

#1600 is a very good discussion because -- like this thread -- has a lot of mixed results.

My testing was performed here: #1600 (comment)

Github really needs an 'On-Hold' state for issues that can be neither reproduced by active developers, nor confirmed to be fixed...

I started a similar cleanup effort here: #4877, but people keep making bug reports faster than we can clean them up.

Because this is a pretty major bug, I see no reason to even suggest closing this until someone's fired up an old machine and done some testing. This task only takes a few minutes.

What's important to understand is fast hardware as well as faster UI draw routines can mask stuff. As a Java developer, I can state with certainty that Linux often exposes bad code that was working just fine on Windows. It doesn't mean the the bug is specific to Linux, but rather often it's simply less likely to occur due to platform differences.

@RiedleroD
Copy link
Contributor

I'm using a pentium-based Acer Travelmate B117M (low-powered enough?) as my main driver. My setup is Arch Linux 5.11.7 with wayland/sway and LMMS 1.2.2. I was compiling LMMS from the main branch to increase CPU load while testing this. The problem only occurs with the pulseaudio driver, not with ALSA, SDL or sndio. I tested all of them at least twice to make sure nothing weird is going on, since SDL uses pulseaudio afaik. I can also confirm that LMMS is the only program I use that has weird audio output on pulseaudio.

It does go away after a bit of tinkering. The first time, it was after dragging in the sf2 player, the second time after loading a vst. It seems long loading times like to stop the issue? Not sure, since, so far, I only managed to stop it twice.

@Rossmaxx
Copy link
Contributor

This issue seems to have a few unrelated reasons but none of them directly point to LMMS, so i assume this is not our bug. If this issue needs to be open, feel free to reopen. I'm closing for now.

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

No branches or pull requests