ChristopherJam
Registered: Aug 2004 Posts: 1409 |
Single cycle of decay at note start - in VICE too as of December 2016
It seems VICE users received a present with very little fanfare a little over a year ago. Decemeber 31st 2016, Groepaz checked in a patch from Leandro Nini (reSID patch #138) that contained a number of envelope emulation enhancements based on die reverse engineering and transistor level emulation.
Biggest news for me is reSID finally emulates the SID bug that results in a single cycle of decay state at the very beginning of every 'gate on' event.
I discovered this bug myself back in 2013, but got distracted attempting to create an envelope emulation that covered various other niggles I found at the same time. Without the circuit diagrams the reSID team has since acquired, cycle exact emulation proved intractable, and I moved on to other things. In hindsight I probably shouldn't have been such a perfectionist.
It's reasonably straightforward for music routine coders to ensure that the bug never affects musicians. Whenever you're about to gate on, if the current release value equals the current attack value, you need to ensure decay matches as well. If you don't do this, there's a 1 in <rate> chance that you'll let the rate counter escape¹, and note start will be delayed by a frame and a half; ADSR bug strikes again. For attack=decay=0, that's a one in nine; not good.
Simplest way to do this after a hard restart is to set gate before you set AD; then decay will still be zero, which will match the attack and release from the restart.
(¹ of course, if the attack value is lower than the decay value, the chances of a rate counter escape are considerably higher, but you knew that already, and musicians frequently do this deliberately to delay note start to halfway through the next frame). |