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

Difference in output of .ds files- 1.2 vs 1.3 #6335

Open
Tracked by #6376
Monospace-V opened this issue Mar 19, 2022 · 12 comments
Open
Tracked by #6376

Difference in output of .ds files- 1.2 vs 1.3 #6335

Monospace-V opened this issue Mar 19, 2022 · 12 comments
Labels

Comments

@Monospace-V
Copy link
Contributor

Bug Summary

Playing the same project back in 1.2.0 and 1.3 alpha, there is an audible difference in the output. This difference translates to exports too. The difference is apparent in .ds samples (to be more specific, it is most apparent in the TR909Clap.ds sample), but my ears cannot tell the difference on most others. I believe this issue is limited to .ds files.

Steps to reproduce

  1. Download project file from https://drive.google.com/file/d/1y6NeRq3Af7EZxFmGUl-KGL9QQSWuEfyG/view?usp=sharing
  2. Play back in 1.2.0 vs playing back in 1.3 alpha
  3. Audible mild difference.
  4. Export
  5. Audible mild difference.

For anyone who cannot export from both, etc:
https://drive.google.com/file/d/10prICuiS2nxaD-fqeS6dwk343-ttSQkd/view?usp=sharing (1.2.0)
https://drive.google.com/file/d/1AOR54ikabHOV8U_2CjM4lYNwBwDboNAy/view?usp=sharing (1.3 alpha)
Above are the reference WAVs.
If you cannot hear the difference, it is more apparent in the following set of links:
https://drive.google.com/file/d/1aceADoxwerhCMki5eVjCJzP_p_cA8iii/view?usp=sharing (1.2.0), https://drive.google.com/file/d/11cuVR5OvYEwQXyA_h21wtAJiMkPQC_pO/view?usp=sharing (1.3)
These are exports of a different project.

Expected behavior

They should sound the same.

Actual behavior

They sound different

Screenshot

image
image
image

Affected LMMS versions

1.2(.0), 1.3 alpha.

@PhysSong
Copy link
Member

Have you tried 1.2.2? There was a change in .ds decoding between 1.2.1 and 1.2.2.

@Monospace-V
Copy link
Contributor Author

I'm having trouble reproducing this again. Could be a product of my settings? Will try to re-reproduce. I'm comparing with older files.

@Monospace-V
Copy link
Contributor Author

Monospace-V commented Mar 24, 2022

image
(I see a mild difference on 1.2.2 that isn't visible on 1.2.0 or 1.3 alpha. But I see no other differences.)

image
Again, I see a very mild difference, but it's between all three of them, and nothing on the apparent magnitude of the ones I could earlier.
In other words, this is proving deceptively hard to reproduce again.

@zonkmachine
Copy link
Member

.ds related issued (#6087 and #6314) was fixed in #6610 by @sakertooth
Perhaps this issue was affected too?

@zonkmachine
Copy link
Member

I've tested ClapBug.mmpz, the first download in the report, and I do see a difference between the runs. It's hard to tell if there's any difference between different versions as it contains noise that is randomized so all you need to do to change the sound is to reopen the project once more. It's different between runs on the same version.

Again, I see a very mild difference, but it's between all three of them, and nothing on the apparent magnitude of the ones I could earlier.
In other words, this is proving deceptively hard to reproduce again.

This is what I see too. Sometimes it will sound pretty much the same on whatever versions you're at and sometimes it sound different between two runs on the same version. I think it's just the randomness of the noise at play here.

@softrabbit
Copy link
Member

Having dived into DrumSynth at some point, I'll stick my spoon in this soup:

The randomness has to be eliminated to be able to analyze this.

Here's one of many .ds files that don't use any noise, more can be dug up (look under the Noise and Noiseband headers in the file): https://github.com/LMMS/lmms/blob/master/data/samples/drumsynth/electro/Hi-q_2.ds

If a project using those shows a difference between LMMS versions, this might be worth looking into (and looking at the lineage of the code, I think nothing significant changed in DrumSynth between 1.2 and 1.3, so any bug might be elsewhere).

@zonkmachine
Copy link
Member

Here's one of many .ds files that don't use any noise, more can be dug up (look under the Noise and Noiseband headers in the file): https://github.com/LMMS/lmms/blob/master/data/samples/drumsynth/electro/Hi-q_2.ds

If a project using those shows a difference between LMMS versions, this might be worth looking into (and looking at the lineage of the code, I think nothing significant changed in DrumSynth between 1.2 and 1.3, so any bug might be elsewhere).

Here is a spectrogram comparison of Hi-q_2.ds exported on lmms-1.2 (top) and master. They look pretty similar.
spectrogram

@zonkmachine
Copy link
Member

https://blue2digital.com/apps/compare-audios.html claim a 100% similarity between the two files.

@michaelgregorius
Copy link
Contributor

Another test would be to export the project with both versions. Then import both files into an audio editor, e.g. Audacity, and flip the phase on one of them, i.e. invert it. Then sum them both. If they are the same you will get perfect silence.

@messmerd
Copy link
Member

If you reload the project, the .ds file will sound a bit different every time, regardless of whether you're on master, 1.2.0, or 1.2.2.

I think this is because of the use of rand() in src/core/DrumSynth.cpp for generating noise.

This is definitely a problem for anyone wanting to have consistent, reproducible renders of their project.

One potential solution is to use a specific seed for the DrumSynth RNG and store that seed in the project file. That way the project always sounds the same when reloading it, and power users can change the seed by modifying the project file.

@messmerd
Copy link
Member

Pinging @sakertooth since the solution I outlined above would probably involve the resource manager system and sample caching, because a DrumSynth sample's seed would need to be associated with the .ds file's UUID in order to work properly.

@Capewearer
Copy link

If you reload the project, the .ds file will sound a bit different every time, regardless of whether you're on master, 1.2.0, or 1.2.2.

I think this is because of the use of rand() in src/core/DrumSynth.cpp for generating noise.

This is definitely a problem for anyone wanting to have consistent, reproducible renders of their project.

One potential solution is to use a specific seed for the DrumSynth RNG and store that seed in the project file. That way the project always sounds the same when reloading it, and power users can change the seed by modifying the project file.

That's not the only reason. I've seen another, hard to reproducible bug: DrumSynth preset may lose the volume. Usually it happens after you will export the track. Then you'll have to reload the OS to "delete" that broken LMMS state, because simple relaunch of software may not help.

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

No branches or pull requests

7 participants