A digital music encoding method according to spectral feature extraction
Patent Information
- Application Number
- CN202611089525.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-22
- Publication Date
- 2026-10-13
Smart Images

Figure CN122907070A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of digital audio coding technology, and in particular to a digital music coding method based on spectral feature extraction. Background Technology
[0002] With the development of streaming music, cloud music libraries, and interactive audio services, digital music is typically divided into multiple data chunks that can be independently transmitted, cached, or randomly accessed. Each data chunk contains several consecutive audio frames and can be configured with random access points corresponding to playback time. For piano sustain, bells, plucked string instruments, string ensembles, choruses, and music signals with long reverberations, the harmonic components and reverberant tails after the notes are excited continue to decay after the original excitation event ends, spanning multiple audio frames or multiple data chunks.
[0003] Existing digital music coding schemes typically employ transform coding, band quantization, high-frequency parametric reconstruction, parametric audio coding, or neural audio coding. At the encoding end, after performing time-frequency transformation on the audio frame, spectral features such as band energy, spectral envelope, spectral peak position, spectral peak amplitude, phase, noise energy, and tonality are extracted. Codewords are then assigned to each band based on a perceptual model or model output. Some schemes also utilize low-frequency core signals combined with high-frequency envelopes, noise parameters, or a small number of spectral line parameters to generate high-frequency components or compensate for missing bands at the decoding end.
[0004] In scenarios where long tail notes persist across multiple blocks, multiple spectral peaks of the same tail note maintain similar frequencies in adjacent audio frames and gradually decay at different slopes. The decay rate, reverberation diffusion, and noise proportion vary across different frequency bands, and the harmonic spectral peaks in tonal tail notes and the diffused energy in noise-type tail notes also exhibit different persistence patterns. Existing methods that encode spectral parameters using single frames or fixed-length contexts typically rewrite peak positions, energy, phase, or envelope parameters for each current frame, lacking cross-block records oriented towards the tail note's activity state. This results in the same tail note repeatedly occupying bitstream fields in multiple data blocks.
[0005] At the decoding end, when directly reconstructing the tail note using the current frame's spectral peak, low-frequency signal, or high-frequency envelope, it's difficult to distinguish between active spectral peaks still in the decay process, residual components nearing the noise floor, and spectral components generated by newly entering notes. This can lead to problems such as the tail note's spectral peak extending beyond the new note, active harmonics prematurely ceasing, repeated switching between tonal and noise-type tail notes, and discontinuous phase continuity. Extending the analysis window or using unrestricted cross-frame prediction can utilize more contextual information, but this increases the tail note state confirmation interval and introduces state exit lag when a new note enters, the spectral structure changes abruptly, or the reverberant tail note turns into diffuse noise.
[0006] When a user starts playback from a random access point corresponding to the middle of the tail note, the decoder typically only obtains the encoded parameters within the current data block, lacking the frequency, energy, decay stage, and phase state of the still active spectral peaks from the previous data block. The decoder needs to wait for preceding data, reinitialize the frequency band parameters, or treat the tail note as a new spectral event, which can easily lead to tail note interruptions, energy jumps, or phase jitter. Keyframes or periodic state refresh methods can provide independent decoding entry points, but their refresh objects are usually determined according to fixed time intervals or fixed field sets, lacking tail note state filtering based on cross-frame spectral duration, energy decay slope, and spectral flatness. This may result in repeated transmission of parameters that have already stabilized and decayed, or omission of spectral components that still affect the reconstruction of subsequent blocks. Therefore, a digital music coding method based on spectral feature extraction is urgently needed to solve these problems. Summary of the Invention
[0007] This invention provides a digital music encoding method based on spectral features, which solves the problems of repeated encoding of long tail notes across blocks and missing state of randomly accessed tail notes.
[0008] This invention provides a digital music coding method based on spectral feature extraction, comprising:
[0009] Acquire a digital music signal and divide the signal into sequentially arranged streaming media blocks and audio frames, wherein the streaming media blocks include random access blocks that allow decoding from the starting position;
[0010] Frequency domain transformation is performed on each audio frame to obtain spectral data, and spectral peak position, spectral peak energy, band energy, spectral flatness, spectral flux and phase increment are extracted.
[0011] The spectral peaks are correlated based on the position and phase increment continuity of adjacent audio frames to form spectral ridges;
[0012] For each frequency band, the attack termination position is determined by the conversion attenuation relationship between spectral flux and frequency band energy;
[0013] After the attack ends at the corresponding frequency band, when the spectral ridge satisfies the following conditions: energy is continuous and attenuates as a whole, frequency drift is in the drift neighborhood, phase increment shift is in the phase neighborhood, the number of continuous frames reaches the tail tone entry threshold, and the energy rise of the newly entered spectral peak in the neighborhood does not reach the event entry threshold, the tone tail tone state is determined and the spectral peak neighborhood mask is set.
[0014] When the residual frequency band energy after deducting the spectral peak neighborhood mask continuously decays and the residual spectral flatness reaches the dispersion determination threshold, the dispersion tail tone state is determined, and the two are taken as the active tail tone state.
[0015] Generate tail note state parameters including the current phase quantization index; generate predicted tail note spectrum features according to the state update unit in each audio frame for each active tail note state, and compare the quantization consistency with the actual tail note spectrum features. If all are consistent, generate a state preservation flag; if there are differences, generate tail note correction parameters.
[0016] At the beginning of the random access block, the active tail tone states that cross the beginning position but have not reached the tail tone termination condition are filtered according to the active tail tone state table at the end of the previous streaming media block, and a tail tone state refresh record including the current phase quantization index is generated.
[0017] The spectral components that have not entered the active tail note state are encoded into spectral coefficient encoding results, and the spectral coefficient encoding results, tail note state parameters, state holding flag, tail note correction parameters, and tail note state refresh records are multiplexed into a digital music encoded bitstream.
[0018] In some embodiments, forming the spectral ridge includes:
[0019] In the previous audio frame, candidate spectral peaks that are in the frequency neighborhood of the current audio frame are identified; the association score is determined by the direction of frequency change, the difference in phase increment, and the proportion of energy change; the candidate spectral peaks that meet the association score conditions are associated with the spectral peaks in the current audio frame, and the current spectral peak is connected to the corresponding spectral ridge; when the spectral peaks in the current audio frame are not associated with an existing spectral ridge, a new spectral ridge is established.
[0020] In some embodiments, forming the spectral ridge line further includes:
[0021] Record the sequence of consecutive occurrences of the spectral ridge, the number of unmatched frames, the frequency change sequence, the energy change sequence, and the phase increment change sequence; when the correlation score difference of multiple candidate spectral peaks is within the score tolerance, select the candidate spectral peak with the smaller phase increment difference and the same frequency change direction; when the number of unmatched frames reaches the ridge termination threshold, terminate the corresponding spectral ridge; when there is a conflict in the continuation of the spectral ridge, record the ridge status change flag.
[0022] In some embodiments, determining the attack end location includes:
[0023] Calculate the spectral flux change sequence and the frequency band energy change sequence for each frequency band; select the frame position where the spectral flux decreases from the peak range to the stable range and the frequency band energy changes to the decay state as the candidate attack end position; determine the attack end position based on the number of subsequent continuously decaying frames and the number of new spectral peaks.
[0024] In some embodiments, the tail tone state parameters include pitch tail tone state parameters and diffuse tail tone state parameters;
[0025] The tonal tail tone status parameters include spectral peak identifier, current frequency quantization index, current energy quantization index, current phase quantization index, frequency drift category, energy attenuation category, phase increment quantization index, and phase increment change category; the diffuse tail tone status parameters include frequency band identifier, current frequency band energy quantization index, frequency band energy attenuation category, spectral envelope quantization index, and spectral flatness status; the same active tail tone status uses the same spectral peak identifier or the same frequency band identifier in consecutive audio frames.
[0026] In some embodiments, the generation of the state-preserving flag and the tail-tone correction parameters includes:
[0027] A pitch-type predicted tail tone spectral feature is generated based on the pitch tail tone state parameter, and a diffusion-type predicted tail tone spectral feature is generated based on the diffusion tail tone state parameter. The predicted tail tone spectral feature and the actual tail tone spectral feature are quantized using the same quantization partition. Within the same state update unit, when the predicted quantization index of each spectral feature to be compared is completely consistent with the corresponding actual quantization index, a state preservation flag is generated. When there is a quantization index difference in at least one spectral feature to be compared, a tail tone correction parameter is generated for the spectral feature where the difference is located.
[0028] In some embodiments, the tail tone correction parameters include a correction quantization index of frequency, energy, phase, phase increment, or spectral envelope; the tail tone correction parameters are residual quantization indexes of the difference between the actual tail tone spectral features and the predicted tail tone spectral features; when tail tone correction parameters are generated in multiple consecutive audio frames, the spectral ridge terminates, or the tail tone type changes, the state holding flag is stopped to indicate the corresponding active tail tone state, and the tail tone state is re-initialized or the spectral coefficients are encoded.
[0029] In some embodiments, when forming the encoded data of the previous streaming media block, the active tail tone state table is updated according to the active tail tone state, tail tone state parameters and tail tone termination flag.
[0030] At the beginning of the random access block, each active tail tone state in the active tail tone state table is filtered item by item; the frequency, energy, phase, phase increment and frequency band energy are extrapolated according to the corresponding quantization index and category mapping table.
[0031] The termination safety boundary is obtained by adding the corresponding tail tone termination energy boundary to half the width of the corresponding quantization partition;
[0032] For tone-type tail tone states, when the extrapolated energy is not lower than the corresponding termination safety boundary, the extrapolated frequency is within the corresponding frequency neighborhood, the extrapolated frequency change does not exceed the frequency extrapolation span threshold, and the extrapolated phase increment change does not exceed the phase increment extrapolation span threshold, it is determined that the tone-type tail tone state crosses the starting position of the random access block and does not meet the tail tone termination condition.
[0033] For diffuse tail tone states, when the extrapolated frequency band energy is not lower than the corresponding termination safety boundary and the spectral flatness state belongs to the set of spectral flatness states that allow the diffuse tail tone state to be maintained, it is determined that the diffuse tail tone state crosses the starting position of the random access block and has not reached the tail tone termination condition.
[0034] In some embodiments, generating the tail note state refresh record includes:
[0035] Write the active tail tone state that still meets the conditions of crossing the start position of the random access block and has not reached the tail tone termination condition into the tail tone state refresh record; for tone-type tail tone states, requantize the extrapolated frequency, extrapolated energy, extrapolated phase and extrapolated phase increment and write them into the current frequency quantization index, current energy quantization index, current phase quantization index and phase increment quantization index, and write the tail tone type, spectral peak identifier, phase increment change category, frequency drift category and energy attenuation category; for diffuse tail tone states, requantize the extrapolated frequency band energy and write it into the current frequency band energy quantization index, and write the tail tone type, frequency band identifier, frequency band energy attenuation category, spectral envelope quantization index and spectral flatness state.
[0036] In some embodiments, the multiplexing as a digital music encoded bitstream includes:
[0037] Write the tail tone state initialization record when the activity tail tone state is first entered or re-initialized; organize the streaming media blocks in the order of block header information, tail tone state refresh record, tail tone state initialization record, frame-by-frame state update unit and spectrum coefficient encoding data.
[0038] The frame-by-frame state update unit includes a state identifier, a state hold flag, and a tail tone correction parameter; when the active tail tone state reaches the tail tone termination condition, a tail tone termination flag is written; entropy encoding is used to obtain the digital music encoded bitstream.
[0039] Through the above technical solution, the present invention can achieve at least the following beneficial effects:
[0040] In this invention, after dividing the digital music signal into streaming media blocks and audio frames, a spectral ridge is formed using spectral peak position, spectral peak energy, bandwidth energy, spectral flatness, spectral flux, and phase increment. The active tail note state is determined after the attack end position. Since continuous spectral peaks within the same tail note are carried by the spectral ridge, pitch-type and diffuse tail note states are represented by tail note state parameters, respectively. Continuous tail notes are continued in adjacent audio frames and streaming media blocks through state-holding flags or tail note correction parameters. The frequency, energy, and phase increment of the same tail note spectral peak in the bitstream are carried by the state continuation relationship. Tail note spectral fields in state-holding states are carried by state-holding flags, reducing the frame-by-frame repetition of the same spectral peak parameters.
[0041] During the tail tone type determination process, the method simultaneously assesses the continuous and overall attenuation of spectral peak energy, frequency drift, phase increment shift, number of sustained frames, and the energy increase magnitude of newly entering spectral peaks. Harmonic spectral peaks still in the attenuation process are classified as tonal tail tone states, while newly entering spectral peaks and existing active tail tone states are encoded separately. For frequency bands without a dominant spectral ridge and with continuously attenuating band energy and spectral flatness reaching the dispersion determination threshold, they are classified as diffuse tail tone states. This processing ensures that harmonic tail tone, diffuse reverberant tail tone, and new musical events have different encoding paths, and the erroneous continuation, premature termination, and repeated switching between tonal and diffuse tail tone conditions of tail tone spectral peaks are constrained by the determination criteria.
[0042] During state preservation and tail tone correction, the encoder predicts the tail tone spectral characteristics of the next audio frame based on the tail tone state parameters of the current audio frame, and compares the predicted tail tone spectral characteristics with the actual tail tone spectral characteristics within the same quantization partition. When the quantization indices are consistent, the state preservation flag indicates that the tail tone state continues; when there are differences in the quantization indices, only the spectral characteristics where the differences exist are used to generate tail tone correction parameters. Thus, tail tones in a stable decay phase maintain their state with fewer fields, while tail tones that undergo changes in frequency, energy, phase increment, or spectral envelope are updated through correction parameters, establishing a correspondence between tail tone state continuation and spectral change writing.
[0043] At the beginning of the random access block, the method extrapolates the frequency, energy, and phase increment for tonal tail tone states based on the active tail tone state table at the end of the previous streaming block, and extrapolates the frequency band energy for diffuse tail tone states. It then combines the termination energy boundary, frequency extrapolation span, phase increment extrapolation span, and spectral flatness status to filter active tail tone states that still span the beginning position. The filtered tail tone type, current spectral status, current phase quantization index, and subsequent attenuation status are written into the tail tone state refresh record. This ensures that the decoder can obtain the continuity status of still active tail tones when processing begins from the beginning of the random access block. Tail tone interruptions, energy jumps, and phase continuity jitter are constrained by the status data in the refresh record. Attached Figure Description
[0044] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly described below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope of the present invention.
[0045] Figure 1 This is a flowchart of the digital music encoding method based on spectral feature extraction in the embodiment. Detailed Implementation
[0046] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0047] All terms used in this invention (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined.
[0048] Example 1:
[0049] like Figure 1 As shown, this embodiment employs a digital music coding method based on spectral feature extraction, including:
[0050] Step S1: Obtain the digital music signal to be encoded, divide the digital music signal into sequentially arranged streaming media blocks, and divide each streaming media block into multiple audio frames. The streaming media block includes a random access block, which is a streaming media block that allows decoding to start from the beginning of the block.
[0051] The digital music signal is a music sampling sequence obtained according to a preset sampling rate. A streaming media block is an encoded data unit carrying consecutive audio frames in playback time order. An audio frame is a processing unit obtained by truncating the music sampling sequence according to frame length and frame shift. A random access block is a streaming media block with an independent decoding entry point configured at its starting position. Each audio frame has a frame number and a corresponding playback time. The frame number increases sequentially according to the audio frame's time in the digital music signal. The starting position of a random access block is determined by the first audio frame number in that block. Frame length, frame shift, sampling rate, and frequency band division method are determined as configuration parameters at the encoding end, and the same configuration parameters are used within the same digital music encoding bitstream. When the end of the digital music signal to be encoded is less than a complete audio frame, the insufficient portion is filled with zero-value sampling, and the effective sampling length is recorded.
[0052] Step S2: Perform frequency domain transformation on each audio frame to obtain spectrum data, and extract spectral peak position, spectral peak energy, band energy, spectral flatness, spectral flux and phase increment from the spectrum data;
[0053] Specifically, the frequency domain transformation employs a windowed short-time frequency domain transformation. The spectral data includes the amplitude, energy, and phase of each frequency point. The spectral peak position is the frequency location where the local energy is greater than that of adjacent frequency points and reaches the spectral peak detection energy boundary. The spectral peak energy is the energy corresponding to the spectral peak position or the energy obtained by interpolation of its neighborhood. The frequency band energy is the sum of the energy of each frequency point within the same frequency band. The spectral flux is the positive cumulative value or the absolute cumulative value of the amplitude difference between corresponding frequency points in adjacent audio frames. The same spectral flux calculation method is used within the digital music encoding bitstream. The phase increment is the result of phase change of the same spectral peak or the same frequency point between adjacent audio frames after phase foldback processing. Spectral flatness is obtained by the ratio between the geometric mean and the arithmetic mean of the non-zero spectral energy within the same frequency band and is quantified as the spectral flatness state. When the frequency band energy is lower than the frequency band background energy boundary, the spectral flatness state of that frequency band is recorded as a state with no effective spectrum, and this frequency band does not participate in the entry determination of the tone-type tail tone state and the diffuse tail tone state.
[0054] Step S3: Associate spectral peaks with the continuous relationship between the position and phase increment of spectral peaks in adjacent audio frames to form spectral ridges;
[0055] A spectral ridge is a sequence of spectral peaks that maintain the same peak identifier across adjacent audio frames. The peak identifier is assigned when the spectral ridge is established and is retained along with the ridge's continuation relationship in subsequent audio frames. When multiple candidate peaks exist in adjacent audio frames, they are first filtered according to frequency distance, and the continuation relationship is determined by combining the phase increment difference and energy change ratio. If none of the candidate peaks satisfy the continuation relationship, a new spectral ridge is established for the peaks in the current audio frame. If no valid peak is detected in the current audio frame, that audio frame is recorded in the unmatched frame sequence of the corresponding spectral ridge. When the number of unmatched frames reaches the ridge termination threshold, the corresponding spectral ridge enters a terminated state.
[0056] Step S4: For each frequency band, determine the attack end position based on the change relationship between spectral flux and frequency band energy from rising state to decaying state, and after the attack end position of the corresponding frequency band, determine the active tail tone state and the corresponding tail tone type based on the continuous decay relationship of the spectral ridge and spectral flatness.
[0057] The active tail sound state refers to the tail sound record that continues to affect the spectral reconstruction of subsequent audio frames even after the attack ends. Tail sound types include pitch-type tail sound states and diffuse tail sound states. Pitch-type tail sound states correspond to spectral ridges with continuous spectral peaks, while diffuse tail sound states correspond to the residual spectral components after subtracting the spectral peak neighborhood mask. The spectral peak neighborhood mask is a frequency range record set around the spectral peak position corresponding to the pitch-type tail sound state, used to mark the spectral energy region already assigned to the pitch-type tail sound state. Residual band energy is the band energy after subtracting the spectral energy within the spectral peak neighborhood mask from the same band energy. Residual spectral flatness is the spectral flatness calculated from the spectral energy after subtracting the spectral peak neighborhood mask. Continuous attenuation indicates that the energy change between adjacent audio frames meets the attenuation relationship that allows for a slight upward float tolerance. Overall attenuation indicates that the energy decrease from the starting audio frame to the current audio frame of the observation segment reaches the overall attenuation threshold.
[0058] When determining the active tail tone state and its corresponding tail tone type, the following criteria are considered: whether the spectral peak energy of the spectral ridge is continuously and uniformly decaying; whether the frequency drift is within the drift neighborhood; whether the phase increment shift is within the phase neighborhood; whether the number of continuous frames reaches the tail tone entry threshold; and whether the energy rise of the newly entered spectral peak in the corresponding frequency neighborhood has not reached the event entry threshold. When the above criteria are met, the corresponding spectral ridge is identified as a tonal tail tone state, and a spectral peak neighborhood mask is set for the spectral peak corresponding to the tonal tail tone state. When the residual frequency band energy is continuously decaying and the residual spectral flatness reaches the dispersion determination threshold, the corresponding residual spectral component is identified as a dispersion tail tone state. When the energy rise of the newly entered spectral peak in the corresponding frequency neighborhood reaches the event entry threshold, the newly entered spectral peak and the existing active tail tone state are encoded separately.
[0059] The attack termination position is the audio frame position where the transient energy rise segment in the corresponding frequency band ends and enters the candidate judgment segment for the tail note. When determining the attack termination position, the spectral flux change sequence and the frequency band energy change sequence are used as inputs. First, candidate audio frames where the spectral flux transitions from a local high-value range to a stable range are identified. Then, it is determined whether the frequency band energy after the candidate audio frame maintains continuous decay. If a new spectral peak appears after a candidate audio frame and the energy rise of the new spectral peak reaches the event entry threshold, the new spectral peak after the candidate audio frame is treated as a new music event. The attack termination position is determined by candidate audio frames that meet the continuous decay requirement and whose number of new spectral peaks has not reached the event entry limit.
[0060] Step S5: Generate tail tone state parameters based on the active tail tone state, predict the tail tone spectrum features of the next audio frame based on the tail tone state parameters, extract the actual tail tone spectrum features from the spectrum data of the next audio frame, generate a state maintenance flag according to the quantization consistency between the predicted tail tone spectrum features and the actual tail tone spectrum features, and generate tail tone correction parameters when the quantization results are inconsistent.
[0061] Step S6: At the starting position of the random access block, determine whether the active tail tone state crosses the starting position and has not reached the tail tone termination condition. For active tail tone states with a determination result of yes, generate a tail tone state refresh record.
[0062] Step S7: The spectral coefficient encoding results of the spectral components that have not entered the active tail note state, the tail note state parameters, the state holding flag, the tail note correction parameters, and the tail note state refresh record are multiplexed into a digital music encoded bitstream.
[0063] In one optional implementation, spectral peaks are correlated based on the continuity of spectral peak positions and phase increments in adjacent audio frames to form spectral ridges, including:
[0064] For the spectral peaks in the current audio frame, candidate spectral peaks whose frequency distance is within the frequency neighborhood are identified in the previous audio frame; the association score is determined based on the frequency change direction, phase increment difference, and energy change ratio between the candidate spectral peaks and the spectral peaks in the current audio frame; the candidate spectral peaks that meet the association score conditions are associated with the spectral peaks in the current audio frame, and the spectral peaks in the current audio frame are connected to the corresponding spectral ridges; if the spectral peaks in the current audio frame are not associated with existing spectral ridges, a new spectral ridge is established using the spectral peaks in the current audio frame.
[0065] The correlation score is obtained by weighting the normalized frequency distance, phase increment difference, and energy change ratio, with the weights determined as configuration parameters at the encoder. A smaller correlation score indicates a stronger continuity between the candidate spectral peak and the spectral peak in the current audio frame. Correlation score criteria include the correlation score not exceeding a correlation score threshold. When multiple candidate spectral peaks meet the correlation score criteria, the candidate peak with the smallest correlation score is selected first. When the correlation score difference among multiple candidate spectral peaks is within the scoring tolerance, the candidate spectral peak with the smaller phase increment difference and consistent frequency change direction is selected.
[0066] In one alternative embodiment, forming the spectral ridge line further includes:
[0067] Record the sequence of consecutive occurrences of spectral ridges, the number of unmatched frames, the frequency change sequence, the energy change sequence, and the phase increment change sequence; when the correlation score difference of multiple candidate spectral peaks is within the score tolerance, select the candidate spectral peak with the smaller phase increment difference and the same frequency change direction; when the number of unmatched frames reaches the ridge termination threshold, terminate the corresponding spectral ridge; when two spectral ridges continue to the same spectral peak or a spectral ridge differentiates into multiple spectral peaks, record the ridge state change flag.
[0068] In one alternative implementation, determining the attack termination location includes:
[0069] Calculate the spectral flux change sequence and frequency band energy change sequence for each frequency band in each audio frame; determine the frame position where the spectral flux in the corresponding frequency band decreases from the peak interval to the stable interval and the frequency band energy changes from the rising state to the decaying state as the candidate attack end position; determine the attack end position from the candidate attack end positions based on the number of consecutive decaying frames after the candidate attack end position and the number of new spectral peaks entering; perform spectral coefficient coding or transient coding on the spectral components before the attack end position.
[0070] In one optional implementation, the tail tone state parameters include pitch tail tone state parameters and diffuse tail tone state parameters; the pitch tail tone state parameters include spectral peak identifier, current frequency quantization index, current energy quantization index, current phase quantization index, frequency drift category, energy attenuation category, phase increment quantization index, and phase increment change category; the diffuse tail tone state parameters include frequency band identifier, current frequency band energy quantization index, frequency band energy attenuation category, spectral envelope quantization index, and spectral flatness state; the same active tail tone state uses the same spectral peak identifier or the same frequency band identifier in consecutive audio frames.
[0071] The tail note state parameters are a set of data representing the predictable spectral state of the active tail note in the current audio frame. The current frequency quantization index is obtained by partitioning the current frequency of the spectral peak according to frequency quantization; the current energy quantization index is obtained by partitioning the current energy of the spectral peak according to energy quantization; the phase increment quantization index is obtained by partitioning the phase increment according to phase increment quantization; the frequency drift category is obtained by the interval to which the frequency change direction and amplitude belong between consecutive audio frames; and the energy attenuation category is obtained by the interval to which the energy retention ratio belongs between consecutive audio frames.
[0072] The current phase quantization index is obtained by partitioning the current phase of the spectral peak according to phase quantization, and serves as the initial phase value of the tone-type tail tone state in the starting audio frame of the random access block; the current frequency band energy quantization index is obtained by partitioning the current frequency band energy according to frequency band energy quantization; the frequency band energy attenuation category is obtained by the interval to which the frequency band energy retention ratio belongs between consecutive audio frames; the spectral envelope quantization index is obtained by quantizing the energy distribution of multiple consecutive spectral regions within the frequency band; and the spectral flatness state is obtained by the interval to which the spectral flatness belongs.
[0073] In one alternative implementation, generating a state-holding flag or tail-tone correction parameters includes:
[0074] Using the state update unit of each active tail tone state in each audio frame as the granularity, the pitch-type predicted tail tone spectrum features of the next audio frame are generated based on the frequency drift category, energy attenuation category, current phase quantization index, phase increment quantization index, and phase increment change category in the pitch tail tone state parameters. The diffusion-type predicted tail tone spectrum features of the next audio frame are generated based on the frequency band energy attenuation category and spectral envelope quantization index in the diffusion tail tone state parameters. The pitch-type predicted tail tone spectrum features and the diffusion-type predicted tail tone spectrum features are used as the predicted tail tone spectrum features. The predicted tail tone spectrum features and the actual tail tone spectrum features extracted from the spectral data of the next audio frame are quantized using the same quantization partition. When the predicted quantization index of each spectrum feature to be compared within the same state update unit is completely consistent with the corresponding actual quantization index, a state preservation flag is generated. When at least one spectrum feature to be compared has a quantization index difference, a tail tone correction parameter is generated for the spectrum feature where the difference exists.
[0075] Specifically, the predicted tail tone spectral features include the predicted frequency, predicted energy, predicted phase, predicted phase increment, predicted band energy, and corresponding data in the predicted spectral envelope corresponding to the active tail tone state in the next audio frame. The actual tail tone spectral features are data extracted from the spectral data of the next audio frame and corresponding to the same spectral peak identifier or the same band identifier. The data corresponding to the tone-type tail tone state includes the actual frequency, actual energy, actual phase, and actual phase increment. The same quantization partition means that the predicted tail tone spectral features and the actual tail tone spectral features use the same quantization boundary, the same quantization step size, and the same index numbering method; both the predicted tail tone spectral feature quantization index and the actual tail tone spectral feature quantization index are obtained from the same quantization partition. When the actual tail tone spectral features are missing, the corresponding active tail tone state is recorded as a pending confirmation state; when the number of audio frames in which the pending confirmation state continues reaches the termination decision boundary, the state holding flag is stopped from representing the active tail tone state, and spectral coefficient encoding or tail tone state re-initialization is performed on the corresponding spectral components.
[0076] In one optional implementation, the tail tone correction parameter includes at least one of frequency correction quantization index, energy correction quantization index, phase correction quantization index, phase increment correction quantization index, and spectral envelope correction quantization index; the tail tone correction parameter is the residual quantization index of the difference between the actual tail tone spectral feature and the predicted tail tone spectral feature; during decoding, the tail tone spectral feature of the current audio frame is obtained by adding the predicted tail tone spectral feature to the dequantized residual. When tail tone correction parameters are generated in multiple consecutive audio frames, the spectral ridge terminates, or the tail tone type changes, the stop-use state holding flag indicates the corresponding active tail tone state; when the corresponding spectral component meets the tail tone entry condition in the current audio frame, the tail tone state of the corresponding active tail tone state is reinitialized; when the corresponding spectral component does not meet the tail tone entry condition in the current audio frame, spectral coefficient encoding is performed on the corresponding spectral component.
[0077] In one optional implementation, the spectral coefficient encoding results, tail tone state parameters, state hold flags, tail tone correction parameters, and tail tone state refresh records of the spectral components that have not entered the active tail tone state are multiplexed into a digital music encoded bitstream. This includes: determining the encoded data category based on the frequency band identifier, spectral peak identifier, tail tone type, and spectral coefficient encoding results; organizing the streaming media into blocks according to the order of block header information, tail tone state refresh records, tail tone state initialization records, frame-by-frame state update units, and spectral coefficient encoding data; writing a tail tone termination flag when the active tail tone state reaches the tail tone termination condition; and performing entropy encoding on the tail tone state parameters, state hold flags, tail tone correction parameters, tail tone termination flags, and spectral coefficient encoding results to obtain a digital music encoded bitstream.
[0078] When an active tail note state is first entered or re-initialized, the encoder writes a tail note state initialization record, which includes the corresponding tail note state parameters. Each active tail note state corresponds to a state update unit in each audio frame, which includes a state identifier, a state hold flag, and tail note correction parameters. When decoding the digital music encoded stream, the decoder establishes the active tail note state based on the tail note state initialization record or the tail note state refresh record. For pitch-type tail note states, the phase obtained by inverse quantization of the current phase quantization index is used as the starting phase, and the phase of subsequent audio frames is recursively deduced based on the phase increment quantization index and the phase increment change category. For diffusion-type tail note states, diffusion spectral components are generated based on the current frequency band energy quantization index, frequency band energy attenuation category, spectral envelope quantization index, and spectral flatness state. The decoder combines the spectral components corresponding to the active tail note state with the spectral components corresponding to the spectral coefficient encoded data and then performs time-domain reconstruction.
[0079] The encoded data category indicates the encoding method of the current spectral component in the current audio frame, including spectral coefficient encoded data, tail tone state initialization record, state preservation data, tail tone correction data, and tail tone termination data. Spectral peak identifiers are used to index pitch-type tail tone states, frequency band identifiers are used to index diffuse tail tone states, and tail tone type is used to distinguish between pitch-type and diffuse tail tone states. The same spectral peak identifier or the same frequency band identifier points to the same active tail tone state in consecutive audio frames; when an active tail tone state reaches the tail tone termination condition, the identifier stops being used for the same active tail tone state in subsequent audio frames after the tail tone termination flag.
[0080] In the preferred embodiment of Example 1, after the attack ends, a tone-type tail note candidate determination is performed frame-by-frame for each unterminated spectral ridge. For spectral ridges With the current audio frame To conclude, select the audio frames that appear consecutively from the first occurrence of the spectral ridge after the end of the attack to the current audio frame. The observation segment; when the length of the observation segment exceeds the preset upper limit of judgment, the segment closest to the current audio frame is used. The continuous audio frames are used as observation segments.
[0081] When a spectral ridge does not match a spectral peak in the current audio frame, the spectral ridge will not enter the tone-type tail note state in the current audio frame. When the number of audio frames in the observation segment is less than two, the tone-type tail note condition of the spectral ridge in the current audio frame is determined to be unmet, and the spectral peak identifier, current spectral peak position, current spectral peak energy, current phase, and phase increment of the spectral ridge are retained for continued determination in the next audio frame. When there are audio frames with missing spectral peaks in the observation segment, the longest consecutive matching audio frame closest to the current audio frame is taken as the observation segment; when the number of matched consecutive audio frames in the observation segment is less than two, the spectral ridge will not enter the tone-type tail note state in the current audio frame.
[0082] When the observation segment contains at least two audio frames, the consistency of spectral peak energy attenuation and the overall attenuation magnitude of spectral peak energy within the observation segment are calculated:
[0083] ,
[0084] ,
[0085] in, Indicates spectral ridges In the current audio frame The consistency of spectral peak energy decay within the corresponding observation segment This represents the spectral ridge to be determined. This indicates the frame number of the current audio frame. Indicates spectral ridges In the current audio frame The number of audio frames within the corresponding observation segment. Indicates the audio frame number within the observation segment. Indicates spectral ridges In the current audio frame The starting frame number corresponding to the observation segment. This is an indicator function that takes the value 1 when the condition within the parentheses is true and takes the value 0 when the condition is false. Indicates spectral ridges In audio frames The peak energy corresponding to the spectral peak. Indicates spectral ridges In audio frames The peak energy corresponding to the spectral peak. This represents the tolerance for slight upward fluctuation of peak energy used to determine the consistency of peak energy attenuation. Indicates spectral ridges In the current audio frame The overall attenuation of spectral peak energy within the corresponding observation segment. Indicates spectral ridges Spectral peak energy in the initial frame of the observation segment Indicates spectral ridges In the current audio frame Spectral peak energy in the middle This indicates the lower limit of the spectral peak energy used for denominator protection in proportional calculations.
[0086] Further calculations were made of the frequency drift and phase increment offset of the spectral ridge within the observation segment:
[0087] ,
[0088] in, Indicates spectral ridges In the current audio frame The maximum frequency drift within the corresponding observation segment. Indicates spectral ridges In audio frames The spectral peak frequency corresponding to the spectral peak. Indicates spectral ridges In audio frames The spectral peak frequency corresponding to the spectral peak.
[0089] ,
[0090] in, Indicates spectral ridges In the current audio frame The maximum phase increment offset within the corresponding observation segment. This represents a phase refracting function that returns the phase difference to a preset principal value range. Indicates spectral ridges In audio frames The phase increment of the corresponding spectral peak. Indicates spectral ridges In audio frames The phase increment of the corresponding spectral peak.
[0091] To avoid misinterpreting new taps, plucks, or strong transient events as tail notes within the same current audio frame... In the middle, for those not associated with spectral ridges The energy increase of the newly entered spectral peak was detected:
[0092] ,
[0093] in, Indicates spectral ridges In the current audio frame The corresponding maximum energy increase of the new spectral peak This indicates the spectral peak number of the newly entered spectral peak. Indicates the current audio frame Not associated with spectral ridges And located at the spectral ridge The set of newly entering spectral peaks within the frequency neighborhood of the corresponding spectral peak. Indicates a new spectral peak In the current audio frame Spectral peak energy in the middle Indicates a new spectral peak The corresponding frequency neighborhood in the audio frame The neighborhood average energy, , and Following the aforementioned definition; when When it is an empty set, Set to 0. If there are no available audio frames before the current audio frame, or if there is no valid spectral data in the corresponding frequency neighborhood of the previous audio frame, the average energy of the neighborhood is set to the larger of the peak detection energy boundary and the background energy boundary of the frequency band; this value is used to generate the maximum energy rise of the new peak and to continue to perform the event entry threshold determination.
[0094] When the same spectral ridge When the following criteria are met simultaneously, the spectral ridge is... It has been determined to be a tone-type ending note:
[0095] ,
[0096] in, , , , , and Following the aforementioned definition, This indicates the threshold for uniformity of spectral peak energy decay. This indicates the threshold for the overall attenuation of the spectral peak energy. This represents the frequency drift neighborhood threshold. Represents the phase neighborhood threshold. This indicates the threshold for pitch-type ending sounds, with a value greater than or equal to 2. This indicates that the event has reached the threshold.
[0097] The peak energy attenuation consistency threshold is greater than or equal to 0 and less than or equal to 1, and the overall peak energy attenuation amplitude threshold is greater than or equal to 0 and less than or equal to 1. Both are calibrated based on stable attenuation samples after the attack ends. The larger the threshold value, the higher the requirement for the continuity of energy attenuation. The frequency drift neighborhood threshold is calibrated based on the frequency domain transformation resolution and frequency quantization step size, and its value is restricted to the frequency range that adjacent quantization partitions can distinguish. The phase neighborhood threshold is calibrated based on the phase increment quantization partition and phase foldback interval, and its value is restricted to the phase principal value interval. The event entry threshold is calibrated based on the increase amplitude of the new peak relative to the neighborhood background energy. When there is a new entering peak in the current audio frame that reaches the event entry threshold, the new entering peak and the existing active tail tone state are encoded separately, and spectral coefficient encoding or transient encoding is performed on the new entering peak that has not entered the active tail tone state. When the number of stable attenuation samples used for calibration is less than the preset minimum number of calibration samples, a preset conservative threshold is used. The preset conservative threshold increases the peak energy attenuation consistency threshold and the overall peak energy attenuation amplitude threshold, while decreasing the frequency drift neighborhood threshold, phase neighborhood threshold, and event entry threshold.
[0098] For example, the peak energy attenuation consistency threshold, the overall peak energy attenuation amplitude threshold, the frequency drift neighborhood threshold, the phase neighborhood threshold, and the event entry threshold are all written as judgment parameters at the encoding end into the encoding configuration or block header information. The above judgment parameters are determined based on the quantile values of historical stable attenuation samples or preset encoding levels; within the same digital music signal, the same set of judgment parameters is used when no encoding level switch occurs.
[0099] After determining that a tone-type tail note state is to be identified, the spectral peak identifier of the spectral ridge is used as the state identifier for the tone-type tail note state. The current frequency quantization index, current energy quantization index, current phase quantization index, frequency drift category, energy attenuation category, phase increment quantization index, and phase increment change category are written into the corresponding tone-type tail note state parameters. In subsequent consecutive audio frames, as long as the spectral ridge still satisfies the frequency drift neighborhood, phase neighborhood, and energy attenuation criteria, the same spectral peak identifier is used to represent the same tone-type tail note state. If, within the observation segment, the spectral ridge terminates, the energy changes from attenuation to continuous increase, the frequency drift exceeds the drift neighborhood, the phase increment shift exceeds the phase neighborhood, or the energy increase of the newly entered spectral peak reaches the event entry threshold, then the determination of the spectral ridge as a tone-type tail note state is stopped, and the corresponding spectral component is transferred to spectral coefficient encoding, tail note state reinitialization, or transient encoding processing.
[0100] Example 2:
[0101] Based on Embodiment 1, this embodiment provides a method for determining whether the active tail note state crosses the starting position at the beginning of a random access block in a digital music encoding method based on spectral feature extraction; when forming the encoded data of the previous streaming media block, the active tail note state table is updated according to the active tail note state, tail note state parameters, and tail note termination flag of each audio frame, and the determination method includes:
[0102] At the beginning of the random access block, each active tail tone state in the active tail tone state table at the end of the previous streaming media block is filtered one by one. The active tail tone state table records the corresponding state data according to the tail tone type.
[0103] The active tail tone state table is a data record maintained by the encoder when forming the encoded data for each streaming media block. It is used to store the active tail tone state before the end of the streaming media block reaches the tail tone termination condition. For each audio frame processed, the encoder updates the active tail tone state table based on the tail tone state parameters, state retention flag, tail tone correction parameters, and tail tone termination flag. When an active tail tone state generates a tail tone termination flag, that active tail tone state is removed from the active tail tone state table. If the first streaming media block does not have a preceding streaming media block, the active tail tone state table is initialized to an empty table; the starting position of the random access block corresponding to the empty table does not write the tail tone state refresh record inherited from the previous streaming media block.
[0104] For pitch-type tail notes, the active tail note status table records at least the tail note type, spectral peak identifier, end audio frame number, current frequency quantization index, current energy quantization index, current phase quantization index, phase increment quantization index, phase increment change category, frequency drift category, and energy attenuation category. For diffuse tail notes, the active tail note status table records at least the tail note type, frequency band identifier, end audio frame number, current frequency band energy quantization index, frequency band energy attenuation category, spectral envelope quantization index, and spectral flatness status. The frequency, energy, phase, phase increment, and frequency band energy used for extrapolation are obtained by dequantizing the corresponding quantization index according to the corresponding quantization partition. The dequantized energy and frequency band energy are first converted to the linear energy domain for extrapolation, and then requantized according to the corresponding quantization partition after extrapolation. The unit frame frequency drift, unit frame energy retention coefficient, unit frame phase increment change, and unit frame frequency band energy retention coefficient used for extrapolation are obtained from the frequency drift category, energy attenuation category, phase increment change category, and frequency band energy attenuation category according to the category mapping table.
[0105] Quantization partitions include frequency quantization partitions, energy quantization partitions, phase quantization partitions, phase increment quantization partitions, frequency band energy quantization partitions, and spectral envelope quantization partitions. During dequantization, the representative value of the quantization partition containing the corresponding quantization index is used as the extrapolation input; the representative value is either the center value of the quantization partition or the partition representative value configured at the encoder. When the quantization index exceeds the range of the corresponding quantization partition, the corresponding active tail tone state is recorded as a quantization anomaly, and the corresponding spectral component is transferred to spectral coefficient encoding or tail tone state reinitialization at the start of the random access block. During requantization, if the extrapolation result falls at the boundary of two quantization partitions, the quantization index is determined according to the boundary assignment rules configured at the encoder.
[0106] The category mapping table is a data table configured at the encoding end, used to record the correspondence between frequency drift category and unit frame frequency drift, energy attenuation category and unit frame energy preservation coefficient, phase increment change category and unit frame phase increment change, and band energy attenuation category and unit frame band energy preservation coefficient. The unit frame energy preservation coefficient and unit frame band energy preservation coefficient are greater than zero and less than or equal to one; the faster the attenuation rate of a category, the smaller the corresponding unit frame energy preservation coefficient or unit frame band energy preservation coefficient. The category mapping table can be provided by a preset encoding level or can be obtained by tuning the quantile values of historical stable attenuation samples; when a category exceeds the range of the category mapping table, the corresponding active tail tone state is recorded as an abnormal category state, and the corresponding spectral components are re-initialized using spectral coefficient encoding or tail tone state.
[0107] For tone-type tail tone states, extrapolate the state parameters at the end of the previous streaming media block to the starting position of the random access block to obtain the extrapolated frequency, extrapolated energy, extrapolated phase, and extrapolated phase increment. When the extrapolated energy is not lower than the sum of the tone-type tail tone termination energy boundary and half the width of the corresponding energy quantization partition, the frequency change of the extrapolated frequency relative to the end of the previous streaming media block does not exceed the tone-type tail tone frequency extrapolation span threshold, and the extrapolated frequency is within the frequency range of zero to half the sampling rate and within the frequency neighborhood allowed by the corresponding spectral peak identifier, and the phase increment change of the extrapolated phase increment relative to the end of the previous streaming media block does not exceed the tone-type tail tone phase increment extrapolation span threshold, it is determined that the tone-type tail tone state crosses the starting position of the random access block and does not meet the tail tone termination condition.
[0108] During extrapolation, the extrapolation frame interval is first determined based on the audio frame number at the end of the previous streaming media block and the audio frame number at the beginning of the random access block. Then, the corresponding unit frame change data is obtained according to the frequency drift category, energy attenuation category, and phase increment change category. When the extrapolation frame interval is zero, the state data at the end of the previous streaming media block is directly used as the extrapolation state data at the beginning of the random access block. When the extrapolation frame interval is less than zero, the corresponding active tail tone state is recorded as a frame sequence abnormal state, and the corresponding spectral component is transferred to spectral coefficient encoding or tail tone state reinitialization at the beginning of the random access block.
[0109] For diffuse tail tone states, the frequency band energy of the diffuse tail tone state at the start position of the random access block is extrapolated based on the frequency band energy attenuation category at the end of the previous streaming media block. When the extrapolated frequency band energy is not lower than the sum of the energy boundary of the diffuse tail tone termination frequency band and half the width of the corresponding frequency band energy quantization partition, and the spectral flatness state belongs to the set of spectral flatness states that allow the diffuse tail tone state to be maintained, it is determined that the diffuse tail tone state crosses the start position of the random access block and has not reached the tail tone termination condition.
[0110] Generate a record of the tail note status and refresh it, including:
[0111] After screening, tone-type and diffuse-type tail note states that still meet the conditions of crossing the starting position of the random access block and not reaching the tail note termination condition will be written into the tail note state refresh record of the corresponding random access block.
[0112] For tone-type tail tone states, the extrapolated frequency, extrapolated energy, extrapolated phase, and extrapolated phase increment are requantized according to the corresponding quantization partitions to obtain the current frequency quantization index, current energy quantization index, current phase quantization index, and phase increment quantization index at the start position of the random access block. The tail tone type, spectral peak identifier, current frequency quantization index, current energy quantization index, current phase quantization index, phase increment quantization index, phase increment change category, frequency drift category, and energy attenuation category are written into the tail tone state refresh record.
[0113] For diffuse tail tone states, the extrapolated frequency band energy is requantized according to the corresponding frequency band energy quantization partition to obtain the current frequency band energy quantization index at the start position of the random access block, and the tail tone type, frequency band identifier, current frequency band energy quantization index, frequency band energy attenuation category, spectral envelope quantization index and spectral flatness status are written into the tail tone state refresh record.
[0114] For active trailing tone states that have reached the trailing tone termination condition before the start position of the random access block, no trailing tone state refresh record is generated. The trailing tone state refresh record is located after the block header information of the corresponding random access block.
[0115] For tone-type trailing tones, the state parameters at the end of the previous streaming media block are extrapolated to the starting position of the random access block to obtain the extrapolated frequency, extrapolated energy, extrapolated phase, and extrapolated phase increment. The extrapolated phase is obtained by recursively extrapolating the phase at the end of the previous streaming media block frame by frame according to the extrapolated phase increment and then performing phase foldback processing.
[0116] ,
[0117] ,
[0118] ,
[0119] in, Indicates the state of the tone ending. Extrapolation to random access blocks Extrapolated frequency of the starting position This indicates the tone-type ending tone state to be filtered. This indicates the block number of the random access block. Indicates the state of the tone ending. The frequency in the audio frame at the end of the previous streaming segment. Indicates random access blocks The sequence number of the last audio frame of the previous streaming media segment. Indicates frequency drift category The corresponding unit frame frequency drift, Indicates the state of the tone ending. Frequency drift category, Indicates random access blocks The starting audio frame number, Indicates the state of the tone ending. Extrapolation to random access blocks Extrapolated energy at the starting position Indicates the state of the tone ending. Energy in the audio frame at the end of the previous streaming segment Indicates energy decay category The corresponding unit frame energy preservation coefficient, Indicates the state of the tone ending. Energy decay category, Indicates the state of the tone ending. Extrapolation to random access blocks Extrapolated phase increment at the starting position Following the aforementioned definition, Indicates the state of the tone ending. Phase increment in the last audio frame of the previous streaming segment Indicates the category of phase increment change The corresponding unit frame phase increment change, Indicates the state of the tone ending. The category of phase increment change.
[0120] When the tone-type tail note state The state of the final note of the tone type is determined when the extrapolation result satisfies the following filtering relationship. Crossing random access blocks The starting position and the ending condition of the note has not been met:
[0121] ,
[0122] ,
[0123] ,
[0124] in, , , , , , , and Following the aforementioned definition, This indicates the energy boundary at the end of a pitch-type final note. This represents the threshold for extrapolating the pitch-type tail frequency at the start position of random access. This represents the threshold for extrapolating the phase increment of the tone-type tail note at the starting position of a random access.
[0125] The aforementioned filtering relationship also includes a minimum difference between the extrapolated energy and the boundary of the tone-type tail tone termination energy, which is no less than half the width of the corresponding energy quantization partition. This difference condition is used to exclude critical tone-type tail tone states that are close to the termination energy boundary. Critical tone-type tail tone states are either switched to spectral coefficient encoding or the tail tone state is reinitialized at the start of the random access block.
[0126] The energy boundary for the termination of a tone-type tail note is defined based on the bottom quantization interval and masking threshold of the spectral energy quantization partition. When the extrapolated energy is below this boundary, the tone-type tail note state is considered to have finished decaying. The frequency extrapolation span threshold for the tone-type tail note is defined based on the frequency quantization step size and frequency domain transformation resolution, and its value is limited to the frequency neighborhood that can maintain the same spectral peak identifier. The phase increment extrapolation span threshold for the tone-type tail note is defined based on the phase increment quantization partition, and its value is limited to the phase return principal value interval. The unit frame energy retention coefficient corresponding to the tone-type tail note state is greater than 0 and less than or equal to 1. Under the same extrapolation frame interval, the faster the energy decay category, the smaller the unit frame energy retention coefficient and the lower the extrapolated energy. When the tone-type tail note state has already written a tail note termination flag at the end of the previous streaming media block, or when the extrapolated frequency or extrapolated phase increment exceeds the corresponding span threshold, the tone-type tail note state is not written into the tail note state refresh record at the beginning of the random access block.
[0127] For diffuse trailing tone states, the frequency band energy at the start of the random access block is extrapolated based on the frequency band energy attenuation category and spectral flatness state at the end of the previous streaming media block:
[0128] ,
[0129] in, Indicates diffuse coda state Extrapolation to random access blocks Extrapolated frequency band energy at the starting position This indicates the state of diffuse tail sounds to be screened. Indicates diffuse coda state Frequency band energy in the audio frame at the end of the previous streaming media segment Indicates the frequency band energy attenuation category The corresponding unit frame bandwidth energy preservation coefficient, Indicates diffuse coda state The frequency band energy attenuation category, , and The aforementioned definition will be used.
[0130] When the diffuse tail sound state When the extrapolated frequency band energy and spectral flatness satisfy the following screening relationship, the state of the diffuse tail tone is determined. Crossing random access blocks The starting position and the ending condition of the note has not been met:
[0131] ,
[0132] in, , , and Following the aforementioned definition, This indicates the energy boundary of the frequency band at the end of a diffuse tail tone. Indicates diffuse coda state The spectral flatness state in the audio frame at the end of the previous streaming media block. This represents the set of spectral flatness states that allow the maintenance of a diffuse tail tone state. The above filtering relationship also includes ensuring that the difference between the extrapolated band energy and the boundary of the diffuse tail tone termination band energy is not less than half the width of the corresponding band energy quantization partition. This difference condition is used to exclude critical diffuse tail tone states that are close to the termination band energy boundary. Critical diffuse tail tone states are either transitioned to spectral coefficient encoding or the tail tone state is reinitialized at the start of the random access block.
[0133] The energy boundary of the terminating frequency band of a diffuse tail sound is defined based on the bottom interval of the corresponding frequency band's energy quantization partition and the background noise of the frequency band. When the extrapolated frequency band energy is below this boundary, the diffuse tail sound state is considered to have finished decaying. The spectral flatness state set is defined based on the diffusion determination threshold when the diffuse tail sound enters. When the spectral flatness state leaves this set, it indicates that the frequency band has lost its diffuse tail sound characteristics, and no refresh record for this diffuse tail sound state is generated at the start position of the random access block. The unit frame frequency band energy preservation coefficient corresponding to the diffuse tail sound state is greater than 0 and less than or equal to 1. Under the same extrapolation frame interval, the faster the frequency band energy decay category, the smaller the unit frame frequency band energy preservation coefficient, and the lower the extrapolated frequency band energy.
[0134] If the active tail tone state table at the end of the previous streaming media block is missing, the tail tone type cannot be identified, the frequency drift category, energy attenuation category, frequency band energy attenuation category, or phase increment change category exceeds the preset category range, the quantization index exceeds the corresponding quantization partition range, the starting audio frame number of the random access block is less than the ending audio frame number of the previous streaming media block, or the corresponding extrapolated energy is lower than the sum of the corresponding termination energy boundary and half the width of the corresponding energy quantization partition, then a conservative approach is adopted. The corresponding spectral component is transferred to the spectral coefficient encoding or tail tone state reinitialization at the beginning position of the random access block, and this state is not written into the tail tone state refresh record as an active tail tone state crossing the starting position. For tone-type tail tone states, the corresponding extrapolated energy is the extrapolated energy of tone-type tail tone states, and the corresponding termination energy boundary is the termination energy boundary of tone-type tail tone states; for diffuse tail tone states, the corresponding extrapolated energy is the extrapolated frequency band energy of diffuse tail tone states, and the corresponding termination energy boundary is the termination frequency band energy boundary of diffuse tail tone states.
[0135] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
[0136] Furthermore, those skilled in the art will understand that although some embodiments herein include certain features included in other embodiments but not others, combinations of features from different embodiments are meant to be within the scope of the invention and form different embodiments. For example, all the embodiments above can be used in any combination. The information disclosed in the Background section is intended only to enhance the understanding of the general background of the invention and should not be construed as an admission or in any way implying that such information constitutes prior art known to those skilled in the art.
Claims
1. A digital music coding method based on spectral feature extraction, characterized in that, include: Acquire a digital music signal and divide the signal into sequentially arranged streaming media blocks and audio frames, wherein the streaming media blocks include random access blocks that allow decoding from the starting position; Frequency domain transformation is performed on each audio frame to obtain spectral data, and spectral peak position, spectral peak energy, band energy, spectral flatness, spectral flux and phase increment are extracted. The spectral peaks are correlated based on the position and phase increment continuity of adjacent audio frames to form spectral ridges; For each frequency band, the attack termination position is determined by the conversion attenuation relationship between spectral flux and frequency band energy; After the attack ends at the corresponding frequency band, when the spectral ridge satisfies the following conditions: energy is continuous and attenuates as a whole, frequency drift is in the drift neighborhood, phase increment shift is in the phase neighborhood, the number of continuous frames reaches the tail tone entry threshold, and the energy rise of the newly entered spectral peak in the neighborhood does not reach the event entry threshold, the tone tail tone state is determined and the spectral peak neighborhood mask is set. When the residual frequency band energy after deducting the spectral peak neighborhood mask continuously decays and the residual spectral flatness reaches the dispersion determination threshold, the dispersion tail tone state is determined, and the two are taken as the active tail tone state. Generate tail note state parameters including the current phase quantization index; generate predicted tail note spectrum features according to the state update unit in each audio frame for each active tail note state, and compare the quantization consistency with the actual tail note spectrum features. If all are consistent, generate a state preservation flag; if there are differences, generate tail note correction parameters. At the beginning of the random access block, the active tail tone states that cross the beginning position but have not reached the tail tone termination condition are filtered according to the active tail tone state table at the end of the previous streaming media block, and a tail tone state refresh record including the current phase quantization index is generated. The spectral components that have not entered the active tail note state are encoded into spectral coefficient encoding results, and the spectral coefficient encoding results, tail note state parameters, state holding flag, tail note correction parameters, and tail note state refresh records are multiplexed into a digital music encoded bitstream.
2. The digital music coding method based on spectral feature extraction according to claim 1, characterized in that, The formation of the spectral ridge includes: In the previous audio frame, candidate spectral peaks that are in the frequency neighborhood of the current audio frame are identified; the association score is determined by the direction of frequency change, the difference in phase increment, and the proportion of energy change; the candidate spectral peaks that meet the association score conditions are associated with the spectral peaks in the current audio frame, and the current spectral peak is connected to the corresponding spectral ridge; when the spectral peaks in the current audio frame are not associated with an existing spectral ridge, a new spectral ridge is established.
3. The digital music coding method based on spectral feature extraction according to claim 2, characterized in that, The formation of the spectral ridge line also includes: Record the sequence of consecutive occurrences of the spectral ridge, the number of unmatched frames, the frequency change sequence, the energy change sequence, and the phase increment change sequence; when the correlation score difference of multiple candidate spectral peaks is within the score tolerance, select the candidate spectral peak with the smaller phase increment difference and the same frequency change direction; when the number of unmatched frames reaches the ridge termination threshold, terminate the corresponding spectral ridge; when there is a conflict in the continuation of the spectral ridge, record the ridge status change flag.
4. The digital music coding method based on spectral feature extraction according to claim 1, characterized in that, Determining the attack termination location includes: Calculate the spectral flux change sequence and the frequency band energy change sequence for each frequency band; select the frame position where the spectral flux decreases from the peak range to the stable range and the frequency band energy changes to the decay state as the candidate attack end position; determine the attack end position based on the number of subsequent continuously decaying frames and the number of new spectral peaks.
5. The digital music coding method based on spectral feature extraction according to claim 1, characterized in that, The tail note state parameters include pitch tail note state parameters and diffusion tail note state parameters; The tonal tail tone status parameters include spectral peak identifier, current frequency quantization index, current energy quantization index, current phase quantization index, frequency drift category, energy attenuation category, phase increment quantization index, and phase increment change category; the diffuse tail tone status parameters include frequency band identifier, current frequency band energy quantization index, frequency band energy attenuation category, spectral envelope quantization index, and spectral flatness status; the same active tail tone status uses the same spectral peak identifier or the same frequency band identifier in consecutive audio frames.
6. The digital music coding method based on spectral feature extraction according to claim 5, characterized in that, The generation state preservation flag and tail tone correction parameters include: A pitch-type predicted tail tone spectral feature is generated based on the pitch tail tone state parameter, and a diffusion-type predicted tail tone spectral feature is generated based on the diffusion tail tone state parameter. The predicted tail tone spectral feature and the actual tail tone spectral feature are quantized using the same quantization partition. Within the same state update unit, when the predicted quantization index of each spectral feature to be compared is completely consistent with the corresponding actual quantization index, a state preservation flag is generated. When there is a quantization index difference in at least one spectral feature to be compared, a tail tone correction parameter is generated for the spectral feature where the difference is located.
7. The digital music coding method based on spectral feature extraction according to claim 6, characterized in that, The tail tone correction parameters include correction quantization indexes for frequency, energy, phase, phase increment, or spectral envelope; the tail tone correction parameters are residual quantization indexes of the difference between the actual tail tone spectral features and the predicted tail tone spectral features; when tail tone correction parameters are generated in multiple consecutive audio frames, the spectral ridge terminates, or the tail tone type changes, the state holding flag is stopped to indicate the corresponding active tail tone state, and the tail tone state is re-initialized or the spectral coefficients are encoded.
8. The digital music coding method based on spectral feature extraction according to claim 5, characterized in that, When forming the encoded data of the previous streaming media block, the active tail tone state table is updated according to the active tail tone state, tail tone state parameters and tail tone termination flag. At the beginning of the random access block, each active tail tone state in the active tail tone state table is filtered item by item; the frequency, energy, phase, phase increment and frequency band energy are extrapolated according to the corresponding quantization index and category mapping table. The termination safety boundary is obtained by adding the corresponding tail tone termination energy boundary to half the width of the corresponding quantization partition; For tone-type tail tone states, when the extrapolated energy is not lower than the corresponding termination safety boundary, the extrapolated frequency is within the corresponding frequency neighborhood, the extrapolated frequency change does not exceed the frequency extrapolation span threshold, and the extrapolated phase increment change does not exceed the phase increment extrapolation span threshold, it is determined that the tone-type tail tone state crosses the starting position of the random access block and does not meet the tail tone termination condition. For diffuse tail tone states, when the extrapolated frequency band energy is not lower than the corresponding termination safety boundary and the spectral flatness state belongs to the set of spectral flatness states that allow the diffuse tail tone state to be maintained, it is determined that the diffuse tail tone state crosses the starting position of the random access block and has not reached the tail tone termination condition.
9. The digital music coding method based on spectral feature extraction according to claim 8, characterized in that, The generation of the tail sound state refresh record includes: Write the active tail tone state that still meets the conditions of crossing the start position of the random access block and has not reached the tail tone termination condition into the tail tone state refresh record; for tone-type tail tone states, requantize the extrapolated frequency, extrapolated energy, extrapolated phase and extrapolated phase increment and write them into the current frequency quantization index, current energy quantization index, current phase quantization index and phase increment quantization index, and write the tail tone type, spectral peak identifier, phase increment change category, frequency drift category and energy attenuation category; for diffuse tail tone states, requantize the extrapolated frequency band energy and write it into the current frequency band energy quantization index, and write the tail tone type, frequency band identifier, frequency band energy attenuation category, spectral envelope quantization index and spectral flatness state.
10. The digital music coding method based on spectral feature extraction according to any one of claims 1 to 9, characterized in that, The multiplexing into a digital music encoding stream includes: Write the tail tone state initialization record when the activity tail tone state is first entered or re-initialized; organize the streaming media blocks in the order of block header information, tail tone state refresh record, tail tone state initialization record, frame-by-frame state update unit and spectrum coefficient encoding data. The frame-by-frame state update unit includes a state identifier, a state hold flag, and a tail tone correction parameter; when the active tail tone state reaches the tail tone termination condition, a tail tone termination flag is written; entropy encoding is used to obtain the digital music encoded bitstream.