Skip to content

Envelope triggered NaN #3408

@zonkmachine

Description

@zonkmachine

Edit: Brief intro

  • We produce NaN.
  • NaN is triggered in instrument envelopes. Specifically by changing release time while playing.
  • This may only be during the first loop.
  • NaN introduced here. 9e1cdd0
  • An uninitialized variable?

To reproduce.

  • Load test project:envelopeNaN.mmp.zip

  • Play until loop. Sound disappears? If yes, proof. If no, reload project and try again.


Verbose intro

The sound went out, NaN style, when I tweaked the decay on an instrument while the song was playing. I set out to see if I could pinpoint the source and I eventually managed to find a way to reproduce it reliably enought to be able to bisect this and the bug seem to have been introduced in 9e1cdd0

commit 9e1cdd0441bca0697f582be3b85d8e2d4c152c72
Author: Vesa <contact.diizy@nbl.fi>
Date:   Sun Aug 3 14:49:45 2014 +0300

    Start work on replacing/removing global locks

The test project is a simple melody with a bitinvader synt having the volume envelopes release knob controlled by an automation track. There is a reverb on the end for detection purposes as having a reverb seem to enormously aggravate the issue. The NaN is however introduced before the effect chain.
If you play this track the sound may go silent somewhere during the first loop but if it makes it to the second you're safe and need to reopen the project and repeat 'play' until it eventually crashes. For me it will go silent at least one time out of four. Since the issue seem to clear itself up after the first run, I suspect an uninitialised variable somewhere but so far I haven't managed to fix this. We divide with zero in the envelope which I set out to 'fix' in issue #3381 but fixing that doesn't affect this issue at all. I have only seen this with the release button and I think only on the first loop.
If you introduce an assert( ! isnanf( some buffer ) ); in the input of the FX chain you will see that the NaN is detected on either:

  • The first loop cycle on a project launched from the command line (or automatically from last session).
  • Immediately on pressing play on a project launched from the gui.

This is related to #1048 and #3313 . I think this one should be fixed first as it's introduced first in the sound chain.

Test project: envelopeNaN.mmp.zip

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions