         value
 
     setSweep: (value) ->
-        @sweepEnabled = value & 0x80 isnt 0
-        @sweepPeriod = (value & 0x70) >>> 4
-        @sweepNegate = value & 0x08 isnt 0
-        @sweepShift = value & 0x07
-        @sweepReload = true
-        @sweepCycle or= 0
+        @sweepEnabled = value & 0x80 isnt 0 # Sweeping enabled
+        @sweepPeriod = (value & 0x70) >>> 4 # Period after which sweep is applied
+        @sweepNegate = value & 0x08 isnt 0  # 0 - sweep is added to timer period / 1 - sweep is subtracted from timer period
+        @sweepShift = value & 0x07          # Shift of timer period when computing sweep
+        @sweepReload = true                 # Sweep counter will be reloaded
+        @sweepCycle or= 0                   # Sweep counter
 
     ###########################################################
     # Timer register

        value

    setDutyEnvelope: (value) ->
        @dutySelection = (value & 0xC0) >> 6
        @lengthCounterHalt = value & 0x20 isnt 0 # Disables length counter decrementation
        @envelopeLoop = @lengthCounterHalt       # Envelope is looping (length counter hold alias)
        @useConstantVolume = value & 0x10 isnt 0 # 0 - envelope itself is volume / 1 - volume is constant value
        @constantVolume = value & 0x0F           # Constant value of output volume
        @envelopePeriod = @constantVolume        # Envelope duration period (constant volume alias)

    ###########################################################
    # Sweep register

    ###########################################################

    updateEnvelope: ->
        if @envelopeReset
            @envelopeReset = false
            @envelopeCycle = @envelopePeriod
            @envelope = 0xF
        else if @envelopeCycle > 0
            @envelopeCycle--
        else if @envelope > 0 # Envelope cycle is 0
            @envelopeCycle = @envelopePeriod
            @envelope--
        else if @envelopeLoop # Envelope is 0
            @envelope = 0xF

    ###########################################################
    # Length counter
