-
Notifications
You must be signed in to change notification settings - Fork 19
Envelope Damp and KeyOn Noise
Unlike OPM/OPN families, YM2413's envelope has the damping phase after every key-on before the attack. The following image is from the YM2413 application manual that describes the DP phase occured after key-on. In the DP phase, the envelope output is quickly damped. This prevents the release of the previous note from being merged with the attack of the next note.
The only thing the manual says is that the rate of DP is about 10ms from 0 to -48dB. There is no more details about DP in it.
The author measured the length of DP. The envelope rate in the DP phase equals to DR=12 and is affected with key scaling offset. Even if RR!=12 is set, the rate will be set to 12 during the DP phase.
The following screenshot is an example wave of the actual damp phase, recorded from a real YM2413B chip.
Note that the waveform changes to the sine form during the DP. This means that the modulator is muted - i.e. The DP is present on the modulator side as well as on the carrier.
Some strange noise can often be found on the actual YM2413 playback around DP. The following screenshot shows the two notes sequentially key-on at fnum=172 and blk=6, recorded from a real YM2413B chip.
where the following voice parameter is used.
; TL FB
0, 4,
; AR DR SL RR KL MT AM VB EG KR WF
15, 0, 0, 0, 2, 1, 0, 1, 1, 0, 0, ; mod
15, 4, 6,12, 0, 5, 0, 1, 1, 0, 0 ; car
Ideally the two notes shape similar waveform. But in real, only the second note contains the noise at start. The following is the zoomed waveform at the begining of the first note. There is no strange points.
The next is the zoomed wave between the end of the first note and the begining of the second note.
A sine-like wave block exists at the start of attack phase. This can be heard as a clicky/beepy noise.
The noise cannot be eliminated even if we wait enough long time between the first and second notes. To remove the noise, we need to enough attenuate the output level of modulator in advance before key-off of the first note.
The author thinks that the carrier and the modulator envelopes are not synchronized with respect to the end of DP phase. In the previous example, the DP on the carrier ends earlier and the attack phase is started before the modulator DP finishes.
The following picture depicts the case that the modulator envelope is sustainable and its SL is 0. The modulator DP remains after the carrier's attack starts.
If a more higher SL value, for example, SL=8 is set, the modulator DP will complete faster. Thus the begining of the second note is changed like following. The noise is remarkably reduced.
By setting SL=10, the noise is gone from the second note.
These observations are consistent with the model where the DP is not synchronized between the carrier and the modulator.
Although the noise is not so remarkable at lower frequency, considering DP should reduce key-on noise, it is very strange that the actual DP implementation follows such a rough calculation. The author personally reckons it is a bug-like behavior but it may be an intended specification to simplify the implementation.
Anyway, there are a lot of musics that implcitly (mosts are not intentionally) use this noise and realize clicky sounds. Emulators should emulate this DP behavior for accuracy.