LMMS / lmms

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

Envelope + (Rapidly) varying tempo give undesirable output. #3775

Open PhysSong opened 7 years ago

PhysSong commented 7 years ago

TempoNaN.mmp.zip

The tempo model is connected to a LFO controller. Instruments with envelope sounds weird, ~some notes may be skipped.~ Edit: some notes may be skipped regardless of the envelope's status. If arpeggio is enabled, it sounds more glitchy. Infs and/or NaNs are also generated.

PhysSong commented 7 years ago

NotePlayHandle::resize( const bpm_t _new_tempo ) changes m_totalFramesPlayed, so EnvTotalFrames and EnvReleaseBegin in InstrumentSoundShaping::processAudioBuffer() can have wrong values. NotePlayHandle::resize() has introduced in 52d9ca47, which was done in 2007. I don't know why it exists and why it should be there.

PhysSong commented 6 years ago

That function is there because notes should be resized when the tempo changes. However, it shouldn't change m_totalFramesPlayed. Instead of this, left frames should be recalculated. There are some exceptions, like notes from MIDI input or arpeggio sub-notes(if tempo-sync is disabled, at least). Creating a new variable m_shouldBeResized may be handy, in my opinion.

zonkmachine commented 6 years ago

This sounds to me like another case where it would be easier to troubleshoot/test if https://github.com/LMMS/lmms/issues/2606 is fixed, as some of the symptoms are overlapping. Dropped notes etc.