Sound bug under Ubuntu 16.04 (xenial)

• Apr 21, 2016 - 22:58

When playing a piece of music, the sound is crackly.

This used to happen under Ubuntu 15.10 (wily) but used to clear itself after a few seconds.

Under xenial, the crackliness continues and does not appear to clear.

(This is using Musescore 2.0.2). The latest version does not appear to be available under Ubuntu; neither are the repositories available for xenial.

........

After filing this report and loading the programme again, the crackliness seems to have disappeared.

I should appreciate if others could confirm the bug on their machines in order that a solution may be found.


Comments

You can get the latest version directly from this site - click the Download link in the menu at right and scroll down until you see Linux. We use the "AppImage" format that shoudl run on pretty much any distribution, no package / installation required.

The sound issue might be something in your hardware or drivers, or it mght be that you have turned up the volume too high in View / Synthesizer and now it is clipping. Try following the instructions int eh Handbook under "Revert to factory settings" (if using 2.0.3, you can find that command in the Help menu).

In reply to by Marc Sabatella

When the crackling disappears, it does so on the same volume setting. The clipping is therefore not a function of the volume setting. One thing that springs to mind is that the sound output from Musescore may be suffering from the digital equivalent of a DC bias which would cause clipping on one polarity of the sound waveform and not the other. In the days of analogue sound, it was usual to couple the sound signal through a capacitor that removed any DC bias. The digital equivalent of a capacitor is a high-pass filter to remove any frequency components below e.g. 20 Hz. Perhaps such a filter needs to be incorporated in the data path between the output of Musescore and the input to the sound system.

As a way of get rid of the crackling when it does appear, I have found that by displaying the window associated with PulseAudio Volume Control and toggling between the Playback and Output Devices tabs, this seems to remove the crackling.

I am pleased that I am not the only one experiencing this problem!

In reply to by DMChatterton

There was another user on IRC a couple of days ago that reported similar sound-issues and traced them back to PulseAudio.
He could reproduce also with an exported ogg in VLC. Playback included a 'high-pitched noise' but only in the first x minutes after pulse was started, playing the exact same file a few minutes later was all good.

Can you confirm similar behavior?
For that user, the noise restarted each time he ran "pulseaudio -k".

In reply to by jeetee

This bug affects me as well. I'm using a clean install of Ubuntu 16.04 Xenial, and musescore 2.0.3 via AppImage, so this bug is present in the latest version. This bug also was also present in Ubuntu 14.04/Musescore 2.0.2.

The distortion stops by itself after a while. The amount of time it takes varies, I think, but I haven't checked with a stopwatch.

"pulseaudio -k" does not restart the noise for me. It just kills all sound, and forces me to restart audio applications to have them working again.

Here's an mp3 of what the bug sounds like. Here I'm launching musescore while playing music in the background. Musescore is launched at the 7 second mark. https://www.dropbox.com/s/33q24mqsadc84bq/2016-04-27-10%3A39%3A04.mp3?d…

Note that the bug is not creating a persistent noise signal, it's more like it's applying a distortion effect on all sound. If there's no sound output, you won't notice the bug (But you'll of course notice it soon enough, when you start entering notes in musescore).

Edit:
I can't reproduce this (DMChatterton):

As a way of get rid of the crackling when it does appear, I have found that by displaying the window associated with PulseAudio Volume Control and toggling between the Playback and Output Devices tabs, this seems to remove the crackling.

I can't reproduce this either (underquark):

If I go to the system "Sound Settings" and just alter the slider for MuseScore buy even 1% it stops the crackles

I can, however, confirm that the crackling stops when closing the musescore application.

Edit 2:
It seems like this bug gets significantly less severe if all effects in musescores synthesizer window is disabled by default.

In reply to by mathiasho

Unfortunately, I have found that switching between tabs on the PulseAudio panel does not work reliably. The crackling just seems to stop by itself.

Since MuseScore has a Play Panel which incorporates a volume control, this might be the ideal location to incorporate a high pass filter (DC blocker) behind the scenes.

I suspect that, when MuseScore starts, it produces a glitch which accumulates as a DC bias, hence causing the sound to be distorted. Something in MuseScore seems to reset this glitch and remove the distortion but, it seems, at a random moment during playback.

In reply to by DMChatterton

Hi DMChatterton

I agree that the bug sounds like a DC bias, but the offsetting signal is not coming from MuseScore. If that were the case, muting MuseScore in the system sound settings should remove the distortion from other sound applications. It doesn't, at least not on my system. So applying a high-pass filter to MuseScore's sound output wouldn't work either. It would have to be applied system wide.

That being said, I've never experienced any other application ever causing this kind of audio issue, so I'm not implying that MuseScore isn't the culprit. Maybe MuseScore is somehow causing pulse to misbehave? This is far beyond me at this point.

I'm critical to the idea of using a high pass filter even if it could work- it is more of a (hackish) workaround, rather than a bug fix. Also a high pass filter would not be a resource-effective way of solving a problem like this

In reply to by mathiasho

I agree that a high pass filter would not be a bug-fix. I was just thinking of it as a route to identifying the source of the bug.

My own experience with the bug is becoming more diverse the more that I investigate it. When the bug decides to disappear, one way to get it back is to do a reboot and re-launch MuseScore. Other times, just re-launching MuseScore finds the bug absent. I have got the bug to disappear by switching between playing an orchestral piece and a piano solo. However its behaviour is anything but consistent.

Hopefully, those with more experience of the internal workings of MuseScore and its connectivity with the sound system might find the solution.

In reply to by DMChatterton

I've found a workaround!

Source: https://wiki.archlinux.org/index.php/PulseAudio/Troubleshooting#Glitche…
This might also give a hint to the developers as to what causes this bug:

The newer implementation of the PulseAudio sound server uses timer-based audio scheduling instead of the traditional, interrupt-driven approach.
Timer-based scheduling may expose issues in some ALSA drivers. On the other hand, other drivers might be glitchy without it on, so check to see what works on your system.
To turn timer-based scheduling off add tsched=0 in /etc/pulse/default.pa

This is what I did:
Open the terminal, enter: sudo gedit /etc/pulse/default.pa
Find the line saying: load-module module-udev-detect
Add tsched=0 to that line, so it now reads:
load-module module-udev-detect tsched=0
Save and close default.pa, restart pulseaudio:
pulseaudio -k
pulseaudio --start

Note:
-The description of /etc/pulse/default.pa says this:

# This startup script is used only if PulseAudio is started per-user
# (i.e. not in system mode)

I might have misunderstood what this means, but anyway, this workaround works after a reboot. Theres no need to restart pulseaudio after login.
-As mentioned, this workaround might introduce other sound glitches. So this should be considered a workaround, not a fix. MuseScore should be able to play nice with PulseAudio out of the box.

Edit: I've added the recording of what the bug sounds like as a .zip to this post. I'll remove the file from my dropbox, so the link provided earlier won't work anymore.

Attachment Size
2016-04-27-10:39:04.mp3_.zip 311.64 KB

In reply to by mathiasho

I tried modifying default.pa and did not get any glitches on starting MuseScore. Unfortunately, MuseScore did not quit properly (it was shown as running in the System Monitor - Processes window. What it more, Ubuntu did not respond to a Shut Down command, continuing to display the Ubuntu dots on the screen. (It needed to be killed using the Power Button!)

There appears to be a small window in the centre of the MuseScore window displaying Loading... on start up and a progress bar that does not seem to move. I have not noticed this before.

Removing tsched=o from default.pa puts everything back as it was including the crackles on starting MuseScore. These disappear after a random period of time for no apparent reason as before.

The archlinux explanation is very interesting but I leave further experimentation to those with more experience.

The bug still stands!

In reply to by DMChatterton

I have found a practical way of getting rid of the crackly sound. If MuseScore is opened early (before it is needed) and then minimised, by the time one wishes to use it, the crackliness will have invariably disappeared. One does not have to do anything particular to MuseScore but testing the speakers using the Test Sound button on the Sound panel will confirm that the sound quality has returned to normal.

In reply to by DMChatterton

My inner CETa popping in here, but maybe a hidden harmonic interference??? Can cause distortion in audio when capacative and inductive reactances are clashing momentarily causing the periodic pops or crackling. Software is designed to mimic PCB electronics with instrument sound replication. I found a similar issue and I run the daily update for alsa as my laptop is not the newest, but still performs pretty good for being 8 years old. I run Ubuntu 16.04 under XFCE and the issue isn't as often due to the environment being not a resource hog like Unity. Maybe it could be resource allocation. I am still investigating this and I love the application to write and edit music. I'll check further as I may have missed something in the forums in reference to this. Thanks everyone.

In 15.10 I sometimes get crackles just after opening MuseScore. If I go to the system "Sound Settings" and just alter the slider for MuseScore buy even 1% it stops the crackles. I'm using Pulseaudio. It is not consistent and changing back the 1% does not cause it to crackle again. Just the act of fiddling with the slider seems to stop it for good for the session.

In reply to by underquark

When the crackling is present on the sound, the Test Sound button on the Sound Settings panel seems to produce crackly sound for the Front Left and Front Right annunciations. The crackliness on the test button does not necessarily disappear if the sound playback from Musescore is paused. However, quitting Musescore will remove the crackliness. This seems to point to Musescore sending a DC bias to the sound system when it is running.

If this is a problem with PulseAudio then why not pick a different sound server in MuseScore's settings? I'd recommend using ALSA since it is installed on Ubuntu by default and seems to have better MIDI support. You can switch to ALSA by going to Edit -> Preferences and clicking on the I/O tab, or see this video.

I am definitely having this problem too, and it's only a problem in musescore so it's not my speakers. Everything works great except whenever I try to play something from either the website or the program. Even when I'm on my phone playing music from this website, it works fine. But the second I hop on my computer, the sound gets crackly only when I'm in musescore.

Having upgraded to Ubuntu 16.04 and MuseScore to the latest version, the crackling is still present but seems to go away by itself after a short period of time. If I start MuseScore early and minimise it until I am ready to use it, it then runs without crackling. Not a perfect solution but a practical one!

In reply to by DMChatterton

Is the crackling constant or does it only happen on particularly loud notes or when lots of instruments are playing? If it's one of those things then you need to lower the volume in the Play Panel or Mixer. If that makes it too quiet then you should increase your system volume because this won't cause crackling.

Do you still have an unanswered question? Please log in first to post your question.