Yeh, I am a bit exhausted because I was going to work on more content last week but then one night I decided to lookup “that sound-library” I had considered about a year ago and found Tinysound. Then after only an hour of work I had it pretty much integrated into my game where I can simply switch between using different sound-systems by a configuration-file setting. (I basically wrapped Java Clip in my own Clip interface MClip and have different implementation depending on whether you wrap Tinysound Music, Sound or a Java Clip. It ran fine on Windows.
Anyway that prompted me to seriously go for making my game available on Linux (because the sound problems were what kept me away from it). But originally I wasn’t going to do this now but work on content instead. The build threw up a couple of days worth of it’s own little but time consuming nags (e.g. character encoding stuff (ISO-8859-1 -> UTF-8)), zip files that can’t keep permissions on files so I couldn’t set my main game file to be executable if I publish it as a zip file (which seems to be what’s done on Itch.io), etc., etc.
It was all kind of annoying and time consuming. Every time I thought I was done, something popped up. So then I started to notice this stuff with the sound and tried all kinds of work-arounds and fixes.
So now I’m getting a bit tired of it, having spend 7 days on this thing that I shouldn’t really be working on because it probably will do little for sales and more for bug reports (let alone potentially breaking something for the Windows crowd who already had working sound).
Of course like most of us here probably: I can’t let it go now… So, for some reason whenever I start the game and use Tinysound the first while sound crackles and pops. After a while it goes away. I noticed it does seem to coincide with the delta-time in Tinysound’s UpdateRunner.run() to be larger (e.g. > 4ms). During development I have, in my game, the ‘G’ key invoke “System.gc()”, it’s just for testing things or figuring out roughly where the problem of something lies. So the crackle can go on for quite a while but if I invoke the garbage-collector (by pressing ‘G’) it is always immediately gone.
It can popup later again and seems to coincide with when the game is doing a lot of work. After a lot of thinkering last night I’ve now noticed that if I call flush() on the outLine (in UpdateRunner.run()) whenever outLine.available() returns 0. It does stop the crackle: You will still hear one or two crackles initially but then it stops. Same with it happening in the middle of the game, you hear it a bit but then it quickly stops so it is by far less annoying. I could live with some crackle in the Linux version and I guess Linux users would just have to live with it (I’ll make it clear before they buy the thing that the sound possibly has some crackle sometimes).
Very kind of you @philfrei to offer to help me but I don’t have the energy to make use of your kind offer at the moment. I’ll think about it but probably will just go with what I’ve got. Once I have it up on itch.io I can send you a free key if you want and you can see what it does on your Linux system (I’m on Ubuntu 18.04 myself).
EDIT: If you want I can send you some of the source that pertains to the sound and some of the sound-files (*.wav) I use. Just let me know how to send them.