A computer program product for encoding a signal, the computer program product comprising computer program instructions, which, when executed on a computer, cause the computer to perform the steps of: performing a classification decision process on a high frequency signal of an input signal to determine a current frame type of the high-frequency signal; adaptively encoding the high frequency signal according to the result of the classification decision process; and outputting the encoded bitstream of the low frequency signal, adaptive encoded bitstream of the high frequency signal, and the result of the classification decision process characterized in: wherein the adaptively encoding the high frequency signals according to the result of the classification decision process comprises: allocating bits according to the current frame type of the high frequency signals; and adaptively encoding a time envelope and a spectral envelope of the current frame of the high frequency signals by using the allocated bits, and wherein the adaptively encoding the high frequency signal according to the result of the classification decision process is performed such that, if the current frame type of the high frequency signal is determined to be a transient signal, B1 represents all bits occupied by the transient signal, M1 represents bits occupied by the time envelope of the transient signal, N1 represents bits occupied by the spectral envelope of the transient signal, B1=M1+N1, and M1 is greater than or equal to N1; and if the current frame type of the high frequency signal is determined to be a non-transient signal, B2 represents all bits occupied by the non-transient signal, M2 represents bits occupied by the spectral envelope of the non-transient signal, N2 represents bits occupied by the time envelope of the non-transient signal, B2=M2+N2, and M2 is greater than or equal to N2. performing a classification decision process on a high frequency signal of an input signal to determine a current frame type of the high-frequency signal; adaptively encoding the high frequency signal according to the result of the classification decision process; and outputting the encoded bitstream of the low frequency signal, adaptive encoded bitstream of the high frequency signal, and the result of the classification decision process characterized in: wherein the adaptively encoding the high frequency signals according to the result of the classification decision process comprises: allocating bits according to the current frame type of the high frequency signals; and adaptively encoding a time envelope and a spectral envelope of the current frame of the high frequency signals by using the allocated bits, and wherein the adaptively encoding the high frequency signal according to the result of the classification decision process is performed such that, if the current frame type of the high frequency signal is determined to be a transient signal, B1 represents all bits occupied by the transient signal, M1 represents bits occupied by the time envelope of the transient signal, N1 represents bits occupied by the spectral envelope of the transient signal, B1=M1+N1, and M1 is greater than or equal to N1; and if the current frame type of the high frequency signal is determined to be a non-transient signal, B2 represents all bits occupied by the non-transient signal, M2 represents bits occupied by the spectral envelope of the non-transient signal, N2 represents bits occupied by the time envelope of the non-transient signal, B2=M2+N2, and M2 is greater than or equal to N2. allocating bits according to the current frame type of the high frequency signals; and adaptively encoding a time envelope and a spectral envelope of the current frame of the high frequency signals by using the allocated bits, and wherein the adaptively encoding the high frequency signal according to the result of the classification decision process is performed such that, if the current frame type of the high frequency signal is determined to be a transient signal, B1 represents all bits occupied by the transient signal, M1 represents bits occupied by the time envelope of the transient signal, N1 represents bits occupied by the spectral envelope of the transient signal, B1=M1+N1, and M1 is greater than or equal to N1; and if the current frame type of the high frequency signal is determined to be a non-transient signal, B2 represents all bits occupied by the non-transient signal, M2 represents bits occupied by the spectral envelope of the non-transient signal, N2 represents bits occupied by the time envelope of the non-transient signal, B2=M2+N2, and M2 is greater than or equal to N2.