An encoding method comprising: obtaining a time-domain pitch period L of an audio signal in a given time period and a time-domain pitch period code corresponding to the time-domain pitch period L and outputting the time-domain pitch period code; a period conversion step of obtaining, as a converted interval T 1, a sample interval in an N-points frequency-domain sample string based on the time-domain pitch period L and the number N of sample points in a frequency domain, the N-points frequency-domain sample string derived from the audio signal, the sample interval corresponding to the time-domain pitch period L of the audio signal; a frequency-domain pitch period analysis step of choosing a frequency-domain pitch period T from candidates including the converted interval T 1 and integer multiples U × T 1 of the converted interval T 1, where U is an integer in a predetermined first range, the frequency-domain pitch period T being a pitch period of the N-points frequency-domain sample string, and obtaining and outputting a first frequency-domain pitch period code indicating how many times the frequency-domain pitch period T is greater than the converted interval T 1; and a frequency-domain-pitch-period-based encoding step of encoding the N-points frequency-domain sample string by an encoding method based on the frequency-domain pitch period T to obtain and output a code string, wherein the encoding method based on the frequency-domain pitch period T is an encoding method in which first samples included in a first sample group of all or some of one or a plurality of successive samples including a sample corresponding to the frequency-domain pitch period T in the N-points frequency-domain sample string and one or a plurality of successive samples including a sample corresponding to an integer multiple of the frequency-domain pitch period T in the N-points frequency-domain sample string are encoded using variable-length coding according to a first criterion corresponding to magnitudes of amplitudes or estimated magnitudes of amplitudes of the first samples included in the first sample group and second samples included in a second sample group of samples in the sample string that are not included in the first sample group are encoded using variable-length coding according to a second criterion corresponding to magnitudes of amplitudes or estimated magnitudes of amplitudes of the second samples included in the second sample group. obtaining a time-domain pitch period L of an audio signal in a given time period and a time-domain pitch period code corresponding to the time-domain pitch period L and outputting the time-domain pitch period code; a period conversion step of obtaining, as a converted interval T 1, a sample interval in an N-points frequency-domain sample string based on the time-domain pitch period L and the number N of sample points in a frequency domain, the N-points frequency-domain sample string derived from the audio signal, the sample interval corresponding to the time-domain pitch period L of the audio signal; a frequency-domain pitch period analysis step of choosing a frequency-domain pitch period T from candidates including the converted interval T 1 and integer multiples U × T 1 of the converted interval T 1, where U is an integer in a predetermined first range, the frequency-domain pitch period T being a pitch period of the N-points frequency-domain sample string, and obtaining and outputting a first frequency-domain pitch period code indicating how many times the frequency-domain pitch period T is greater than the converted interval T 1; and a frequency-domain-pitch-period-based encoding step of encoding the N-points frequency-domain sample string by an encoding method based on the frequency-domain pitch period T to obtain and output a code string, wherein the encoding method based on the frequency-domain pitch period T is an encoding method in which first samples included in a first sample group of all or some of one or a plurality of successive samples including a sample corresponding to the frequency-domain pitch period T in the N-points frequency-domain sample string and one or a plurality of successive samples including a sample corresponding to an integer multiple of the frequency-domain pitch period T in the N-points frequency-domain sample string are encoded using variable-length coding according to a first criterion corresponding to magnitudes of amplitudes or estimated magnitudes of amplitudes of the first samples included in the first sample group and second samples included in a second sample group of samples in the sample string that are not included in the first sample group are encoded using variable-length coding according to a second criterion corresponding to magnitudes of amplitudes or estimated magnitudes of amplitudes of the second samples included in the second sample group.