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

Sf2 MIDI base velocity incorrect after export #1233

Closed
gligeti opened this issue Oct 22, 2014 · 28 comments
Closed

Sf2 MIDI base velocity incorrect after export #1233

gligeti opened this issue Oct 22, 2014 · 28 comments
Labels
Milestone

Comments

@gligeti
Copy link

gligeti commented Oct 22, 2014

Edited 2014-10-22 @tresf to add findings
I think I found what gets reset. The MIDI base velocity seems to be messed up or changed somehow with the change. This instrument has different sounds at different velocities, that's why it makes a huge difference.

Win 8.1 64 bit LMMS 1.0.3

Using Fluid R3 GM soundfont (http://www.musescore.org/download/fluid-soundfont.tar.gz) on Windows using default settings, select Calliope Lead. Add notes. Play. Notice how it plays in a low volume. Now use export and export the project to a wav file. Now the volume changes to a much higher volume (settings seemingly unchanged) both in the exported wav file, and in LMMS after the export.

@tresf
Copy link
Member

tresf commented Oct 22, 2014

Is there a chance it's grabbing the wrong bank in export? (Is there a bank which matches the volume level you are experiencing?) Also, is there a chance the export settings are contributing to the bug? I've used soundfonts heavily in 1.0.x versions without any major volume discrepancies so this bug may be specific to the soundfont you are using.

@gligeti
Copy link
Author

gligeti commented Oct 22, 2014

I tried it with the default export settings as well as with oversampling. The weird thing is that after the export the volume is also changed when played inside LMMS not just in the wav (note that I suspect that in fact the original low volume is wrong, it is way too low, and somehow it gets corrected with/after the export). It may be some setting that gets reset that I am missing, but I don't see anything changed.

The issue is easily reproduced as I wrote it. It may be a bad font, but then I'd like to report it to them, although even then LMMS should behave deterministically.

@gligeti
Copy link
Author

gligeti commented Oct 22, 2014

I think I found what gets reset. The MIDI base velocity seems to be messed up or changed somehow with the change. This instrument has different sounds at different velocities, that's why it makes a huge difference.

@tresf tresf changed the title Sf2 Sound volume changes after wav export Sf2 MIDI base velocity incorrect after export Oct 22, 2014
@tresf tresf added the bug label Oct 22, 2014
@tresf tresf added this to the 1.2.0 milestone Oct 22, 2014
@diizy
Copy link
Contributor

diizy commented Oct 22, 2014

No one has asked the most important question yet:

Can anyone reproduce this on 1.1?

@Sti2nd
Copy link
Contributor

Sti2nd commented Oct 22, 2014

I have had that bug before! HEY, that is the same sf2 file, then it is likely to be the sf2. It happened because I wanted to replicate a piece I made in Musescore, and so I downloaded the sf2 Musescore used. This was with 0.4.13

@tresf
Copy link
Member

tresf commented Oct 22, 2014

No one has asked the most important question yet:

Whoops... my mistake. I'll leave the 1.2 tag for now but it should be removed if this has gone away.

@gligeti
Copy link
Author

gligeti commented Oct 23, 2014

Eeeer I am not quite ready to upgrade to the 1.1RC, but may try it on another rig with 1.1 later.It is quite easy to reproduce, if someone wants to try it, even if you just watch the levels it clearly is mouch louder after the export.
There is definitely something weird with the MIDI base velocity too which may or may not be related. If you load that soundfont, you'll see that the base velocity is set to 63, but not enabled. Enabling/disabling makes no difference. Now after working with the project eventually (several saves and exports) it got misteriously changed to 127, even though I never touched it -- but I can't reproduce that, not sure what caused it. (note that after the export, it still shows 63, still not enabled, but the sound is louder, and it seems that the velocity changed, not the volume)

@Sti2nd
Copy link
Contributor

Sti2nd commented Oct 23, 2014

If we look at my experience and your experience and take it for granted it is the same bug, this has nothing to do with anything introduced after 0.4.13 (like the Midi base), and most likely, it is the sf2. I am going to try today in RC4, I think, downloaded the file yesterday.

@tresf
Copy link
Member

tresf commented Oct 23, 2014

I've confirmed on 1.1 that export ignores velocity settings on the SF2 instrument.

image

The title should probably be changed to reflect this. I don't see any other anomalies in playback or render related to the base velocity setting. For now, I recommend people reset the velocity to 67, turn it off and use the volume sliders/knobs to achieve this effect. If this doesn't yield the same sound, you may choose to record the sound device (rather than using export) which would be a workaround until this is fixed.

@tresf
Copy link
Member

tresf commented Oct 23, 2014

Also, saving these SF2 preset settings in a separate preset file doesn't help this bug, they're still ignored. I don't see any code in ProjectRenderer.cpp which could cause this. Perhaps the problem lies in sf2_player.cpp

@Sti2nd
Copy link
Contributor

Sti2nd commented Oct 23, 2014

Reproduced here on LMMS RC4 64 bit Win. With the same sf2, though.

@gligeti
Copy link
Author

gligeti commented Oct 23, 2014

Do you also reprocude the issue in RC4 that subsequent playbacks inside LMMS are also louder after the export, or does it only affect the volume of the exported wav?
Also, in 1.0.3 the green checkbox to enable the custom base velocity doesn't seem to affect things, it always gets applied.
Not sure if these are related issues or not.

@tresf
Copy link
Member

tresf commented Oct 23, 2014

No, the volume playback after render wasn't noticeably affected in my test
results.

@diizy
Copy link
Contributor

diizy commented Oct 24, 2014

On 10/24/2014 01:50 AM, Tres Finocchiaro wrote:

No, the volume playback after render wasn't noticeably affected in my test
results.

From a quick look, I can't see anything in the SF2 plugin itself which
could cause this issue. The fact that this doesn't happen (?) on other
single-stream plugins also maybe suggests some kind of bug in
Fluidsynth, but it's too early to say...

@tresf
Copy link
Member

tresf commented Oct 24, 2014

Very interesting... So I tried reproducing this on Ubuntu 12.04 x64, (stable-1.1 branch) and it seem the base velocity is honored. Is there a chance this is a Windows-only bug? (tested SDL and ALSA)

image

@tresf
Copy link
Member

tresf commented Oct 24, 2014

@pgiblock @tobydox any quick hints as to where to look if this export behavior is differerent between Win32 and *nix? I know Toby has a knack for tracking down the Windows anomalies and I believe Paul helped write the sf2 instrument.

@mikobuntu
Copy link
Contributor

linux ubuntu 32bit { stable 1.1 } I can confirm the original bug, whereas after render the volume of said preset raises slightly. ( this is without touching sf2 base velocity )
I have looked at this soundfont in polyphone and noticed Calliope Lead has settings :- chorus 30% reverb 10% , so could it be possible that rendering a project is somehow switching these on, without any user interaction from the gui?

EDIT I'm almost sure that chorus and reverb are being switched on during/after render as when i used the gui switches and turned on/off the volume went back to its original lower volume!! @tresf @diizy

I did a further test by saving an .mmp both before and after render, but running diff showed the files where identicle.

Possibly unrelated, but worth mentioning....... that sf2 player spews out a lot of errors on load::_

fluidsynth: warning: No preset found on channel 0 [bank=0 prog=0]

** (lmms:3197): CRITICAL **: fluid_synth_sfont_unref: assertion `sfont_info != NULL' failed
fluidsynth: warning: No preset found on channel 1 [bank=0 prog=0]

this is a recursive error, which has been about for some time now , but imo it is non fatal?

@gligeti
Copy link
Author

gligeti commented Oct 24, 2014

I know that the mmp file doesn't save the messed up state as if I save it after the render changed the volume, and reload it, the volume is back to the lower value.
Does the base velocity work for you as intended? As I said turning it on/off (the green on/off checkbox) doesn't seem to affect it -- it is always gets applied for me in 1.0.3 under w8.1 x64.

@mikobuntu
Copy link
Contributor

@gligeti Oh yes i see what you mean, yes for example if i turn on the base volume, raise it turn it off again the higher volume will stay until changed again. I'm unsure if this is intended behaviour, i'd expect not, but i believe these are possibly 2 separate issues, where rendering a project 1st caused you to notice the initial rise in volume caused by the chorus reverb being applied, then on further investigation you noticed the base velocity bug?

@mikobuntu
Copy link
Contributor

I'm going to start a new bug report on my issue concerning sf2 player ;)

@gligeti
Copy link
Author

gligeti commented Oct 24, 2014

You are right, it IS the chorus that gets turned on (but not reflected on the led), and in fact I reproduced that if I toggle it on and off, the perceived volume goes back again. Good catch.

Yes, the base velocity is then probably a separate issue that I found by looking for what setting may have changed and found the odd behavior, but it sounded plausible that that gets messed up.

@tresf
Copy link
Member

tresf commented Oct 25, 2014

@diizy do you believe the velocity issue could be caused by this commit? 585f8b6

@tresf
Copy link
Member

tresf commented Dec 20, 2014

Can we get a confirmation that this bug still exists in stable-1.1 RC11? Namely Linux and Windows versions?

@tresf tresf mentioned this issue Dec 20, 2014
26 tasks
@Sti2nd
Copy link
Contributor

Sti2nd commented Dec 20, 2014

Not by me, hard to reproduce and only with specific soundfonts I believe. I do think this

@diizy do you believe the velocity issue could be caused by this commit? 585f8b6

This is the way I remember the bug. It wasn't just pure amplifying of the signal, it was some chorus or effect causing it, it seemed.

@tresf
Copy link
Member

tresf commented Dec 20, 2014

Thanks @Sti2nd . I'd like to see if @mikobuntu or @Umcaruje can reproduce on Linux.

@tresf
Copy link
Member

tresf commented Jan 10, 2015

Closing since no one has been able to reproduce. Please reopen if you feel this was closed in error.

@tresf tresf closed this as completed Jan 10, 2015
@badosu
Copy link
Contributor

badosu commented Jan 13, 2015

@tresf I've been out for a few days and noticed a lot of cleanup of stale issues, good work! 👍

@tresf
Copy link
Member

tresf commented Jan 13, 2015

The real thanks goes to these code contributors! 👍 Thanks for the gratitude though, it goes a long way. :)

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

6 participants