An encoder comprising: a periodic-combined-envelope generating part which generates a periodic combined envelope sequence which is a frequency-domain sequence based on a spectral envelope sequence which is a frequency-domain sequence corresponding to a linear predictive coefficient code obtained from an input audio signal in a predetermined time segment and on a frequency-domain period corresponding to a period code obtained from the input audio signal; a variable-length-coding-parameter calculating part which calculates a variable-length coding parameter dependent on an amplitude value from the periodic combined envelope sequence; a second variable-length-coding-parameter calculating part which calculates a variable-length coding parameter dependent on an amplitude value from the spectral envelope sequence; and a variable-length coding part which uses a variable-length coding parameter to encode a frequency-domain sequence derived from the input audio signal by variable-length coding dependent on an amplitude value, wherein when an indicator of the degree of periodicity of the input audio signal is within a predetermined range indicating high periodicity, the variable-length coding part uses the variable-length coding parameter calculated by the variable-length-coding-parameter calculating part to perform encoding; and when the indicator of the degree of periodicity is not within the range indicating high periodicity, the variable-length coding part uses the variable-length coding parameter calculated by the second variable-length-coding-parameter calculating part to perform encoding. a periodic-combined-envelope generating part which generates a periodic combined envelope sequence which is a frequency-domain sequence based on a spectral envelope sequence which is a frequency-domain sequence corresponding to a linear predictive coefficient code obtained from an input audio signal in a predetermined time segment and on a frequency-domain period corresponding to a period code obtained from the input audio signal; a variable-length-coding-parameter calculating part which calculates a variable-length coding parameter dependent on an amplitude value from the periodic combined envelope sequence; a second variable-length-coding-parameter calculating part which calculates a variable-length coding parameter dependent on an amplitude value from the spectral envelope sequence; and a variable-length coding part which uses a variable-length coding parameter to encode a frequency-domain sequence derived from the input audio signal by variable-length coding dependent on an amplitude value, wherein when an indicator of the degree of periodicity of the input audio signal is within a predetermined range indicating high periodicity, the variable-length coding part uses the variable-length coding parameter calculated by the variable-length-coding-parameter calculating part to perform encoding; and when the indicator of the degree of periodicity is not within the range indicating high periodicity, the variable-length coding part uses the variable-length coding parameter calculated by the second variable-length-coding-parameter calculating part to perform encoding.