LMMS / lmms

Cross-platform music production software
https://lmms.io
GNU General Public License v2.0
8.07k stars 1k forks source link

FreeBoy creating noise #3824

Open Fighter19 opened 7 years ago

Fighter19 commented 7 years ago

I was going to post a bug report when I found that it might be related to this issue: Version 1.1.3 (Ubuntu @17.04) Also with the newest build from master.

When changing notes, FreeBoy often emits a noise, even though all channels except for Channel 2 are muted.

noise

The picture above shows, how it should look like (approx.) and how it looks by lmms. (The upper picture was taken with gbsplay by playing the "nearly" same file, with all other tracks muted as well.)

I don't know if this is intended, but not hearing this with VLC which also uses Game Music Emu (granted, I can't mute the other channels so I can't be 100% sure), I guess this is an issue.

EDIT: Also tested by using pasuspender and switching to alsa.

The following is the same wave as above, rendered with the current version of lmms creates even more noise. I've noticed even a small noise is audible when releasing a note. (37f6032b4da23b712f4fbc76e930936c08986493)

image

musikBear commented 7 years ago

I believe its because channel 2 is FOR adding noise, so channel 2 simply ned to be muted, if noise is unwanted

Fighter19 commented 7 years ago

Channel 4 is for noise.

Fighter19 commented 7 years ago

I've also experimented a bit, by disabling the setting of the bass. (Uncommenting the line that uses the bass_freq function of the library) It seems like the waves start with a lower potential than they should, then they get compensated towards the center. Then when a new wave starts, it interferes with the old wave, instead of replacing it.

zonkmachine commented 6 years ago

This issue could be from upstream. We recently updated the source to fix a long standing noise issue.

I don't know if this is intended, but not hearing this with VLC which also uses Game Music Emu (granted, I can't mute the other channels so I can't be 100% sure), I guess this is an issue.

We probably use different versions of GBE.

It looks like we're missing an initialization here. According to this, channel 3 volume could be acting up a bit but I don't see any of that. Another problem could be that the registers in general gets the wrong positions because they are moved into place by a shift maneuver. In which case the bug is ours. I'll try and poke that code a bit...

No. That was sweep oriented and channel 3 has none of that so it's good.

zonkmachine commented 6 years ago

I don't know if this is intended, but not hearing this with VLC which also uses Game Music Emu (granted, I can't mute the other channels so I can't be 100% sure), I guess this is an issue.

Do you think you could find out what version of Game Music Emu VLC is using? Can you upload a zipped mmp project file that demonstrates the issue?

tresf commented 6 years ago

Do you think you could find out what version oof Game Music Emu VLC is using?

0.6.0 according to their master branch. Which version do we ship with?

https://github.com/videolan/vlc/blob/master/contrib/src/gme/rules.mak#L3

zonkmachine commented 6 years ago

Which version do we ship with?

0.6.1 : https://github.com/LMMS/lmms/pull/3618

Fighter19 commented 6 years ago

I can provide a project file. However this issue is easily reproducible. It occurs on every note change, when another note is still audible. Instead of simply terminating the old sample it plays on for a while, then it interferes with the new sample.

Let's assume we play a C. The C wave is generated, now we switch from C to D, the D wave is generated, but instead of simply stopping the C wave before the D wave is played, both start to overlap for a small period of time generating noise.

It occurs on Windows as well as on Linux. I think the NES plugin has this issue as well.

Fighter19 commented 6 years ago

Here is an example project: https://puu.sh/yg81f/1497dbc1e9.mmpz

zonkmachine commented 6 years ago

freeboyglitchcompare

Here is the project above in a comparison between 1.1.3 and 1.2.0-RC4. It's been greatly improved by the update to 0.6.1 but there's still glitches in there. I think this has a high probability of being an issue in game-music-emu aka upstream.

zonkmachine commented 6 years ago

One of the noise shots up close. The wave is shifted down for ~770 samples. It's shifted down about the same level the whole wave would need to be shifted up in order to have no DC component. freeboyglitchlevelorig

Faulty part nudged upward. freeboyglitchlevel

zonkmachine commented 6 years ago

Edit: What happens here is that the waves are displaced and when they overlap that displacement is added up.

zonkmachine commented 6 years ago

@karmux Game Music Emu 0.6.2 has been released. Do you think you could look into updating FreeBoy again?

tresf commented 6 years ago

It's a submodule now, since #3946.

zonkmachine commented 6 years ago

So it needs testing in master.

RiedleroD commented 2 years ago

still a problem in current master, it's very annoying to work around (althought it occurs more frequently when sampling rate and/or oversampling is increased, it's barely noticable at 48kHz and below)

zonkmachine commented 2 years ago

@RiedleroD It looks like we no longer have a demo project for this issue as the one submitted further up on this page has been deleted. Can you provide a minimal project (one track, ~two bars), that demonstrates the issue? Preferably generated on lmms-1.2.2?

RiedleroD commented 2 years ago

@zonkmachine here you go: https://lmms.io/lsp/?action=show&file=19394 just export with 96000Hz or higher (or with 2x or more oversampling) and the output has crackling in it

messmerd commented 1 year ago

@RiedleroD When I export that as wav on the master branch at a 192,000 Hz sampling rate, LMMS freezes, but it's fine at 96,000 Hz... Maybe this is a new bug

EDIT: This freeze doesn't just happen with wav... It happens with mp3 using multiple different bitrates, and probably when using other formats as well.

EDIT 2: I tried again a few hours later, and I'm unable to reproduce this freeze issue. Very strange