Audio theme generation method and system based on structural analysis and multi-resolution convolution
By analyzing audio segment structures and enhancing feature similarity calculations through a self-attention mechanism, and combining a multi-resolution convolutional and attention hybrid network, the shortcomings of existing audio generation models in topic recognition and structural control are addressed, enabling the efficient generation of audio works with clear topic structures and long-term coherence.
Patent Information
- Application Number
- CN202611347881.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-02
- Publication Date
- 2026-11-27
AI Technical Summary
Existing audio generation models have shortcomings in topic recognition and structural control, making it difficult to generate audio works with clear topic structure and long-term coherence. Balancing local features and global structure is difficult, topic extraction accuracy is insufficient, and there is a lack of rigorous control over the objective attributes of audio.
An audio topic generation method based on structural analysis and multi-resolution convolution is adopted. The boundary is detected by analyzing the structure of audio segments, and the feature similarity calculation is enhanced by combining a self-attention mechanism. The complete audio works are generated by using a hybrid network of multi-resolution convolution and attention, which captures audio features at different time scales and performs dynamic weighted fusion.
It improves the accuracy and flexibility of audio theme recognition, generates works with clear thematic structure and long-term coherence, enhances the structure and expressiveness of generated audio, and maintains good computational efficiency.
Smart Images

Figure CN123182691A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of artificial intelligence and audio signal processing technology, specifically relating to an audio topic generation method and system based on structural analysis and multi-resolution convolution. Background Technology
[0002] With the continuous advancement of artificial intelligence and deep learning technologies, automatic audio (especially symbolic music sequences) generation technology has made significant progress, bringing new possibilities for automated content creation. Traditional automatic audio generation algorithms can be broadly classified into three categories: rule-based audio generation, probability model-based audio generation, and early neural network-based audio generation.
[0003] Rule-based audio generation methods rely on expertise in audio signal processing, with experts developing a set of rules to guide computers in generating audio content that conforms to a specific style. These methods typically require different rule sets for different types of audio, and the rule-making process is complex and demands deep domain expertise. Furthermore, post-processing often requires manual intervention and fine-tuning, making fully automated audio creation difficult.
[0004] The most representative audio generation methods based on probabilistic models are Markov models and Hidden Markov models. These models predict the next event by constructing a state transition matrix by analyzing the transition probabilities of audio frames or audio events in existing audio works. However, they can only generate partial fragments from the original corpus, making it difficult to produce completely original content. More importantly, due to the lack of long-term memory mechanisms, different input data may generate vastly different conditional probabilities, making it difficult to maintain the structural consistency and thematic coherence of the audio.
[0005] Early audio generation methods based on neural networks primarily employed recurrent neural networks (RNNs) and their variants (such as LSTMs). RNNs automatically extract features by learning from a large number of samples, without requiring explicit rule definitions. However, traditional RNNs suffer from a severe vanishing gradient problem, failing to generate audio structures with long-term consistency. The generated content often lacks macroscopic structure and thematic development, producing only locally coherent but overall scattered fragments.
[0006] In recent years, powerful deep generative models such as Variational Autoencoders (VAEs), Generative Adversarial Networks (GANs), and Transformers have been increasingly applied to this field. VAEs generate new samples through latent space sampling and decoding, while GANs generate high-quality samples through adversarial training, demonstrating the capabilities of deep models in audio generation. However, these models still face challenges in modeling long-term dependencies and maintaining consistency across long audio clips. Subsequently, the Transformer model, based on a self-attention mechanism, overcame the limitation of recurrent networks in capturing long-distance dependencies, enabling it to directly model dependencies between any positions in a sequence and generate more structurally complete and logically coherent works, thus becoming the widely used mainstream baseline model.
[0007] Despite the significant achievements of methods based on deep generative models such as Transformer, existing technologies still have the following significant shortcomings in practical audio topic control and structure generation: (1) Insufficient theme recognition and structural control: Existing models often struggle to generate audio works with clear thematic structure and long-term coherence. The generated content often appears to be locally reasonable but has a loose overall structure, lacking effective modeling and control over the long-term development of audio and the repetition and variation of themes.
[0008] (2) Difficulty in balancing local features and global structure: As a time-based art form, audio exhibits multi-layered structure (from short-term audio frame relationships to mid-term feature outlines, and then to long-term segment development). Existing methods struggle to simultaneously focus on features at different time scales, are inefficient in capturing local feature patterns, and find it difficult to achieve a good balance between local details and global structure.
[0009] (3) Insufficient topic extraction accuracy: Automatic identification and extraction of audio topics are prerequisites for conditional generation. Traditional extraction methods mainly rely on simple pattern matching or manual annotation, lacking an understanding of the deep structure of audio. Since high-quality topic extraction is crucial for topic-based audio generation, existing methods perform poorly in this stage, directly limiting the quality of subsequent generation.
[0010] (4) Lack of in-depth application of objective audio theory: Although some existing generative models (such as text-based generative models) can produce audio that matches the description, they have limited control over the objective attributes of audio (such as pitch distribution, rhythmic patterns, segment structure, etc.), making it difficult to meet the demand for rigorous structural control in professional audio creation. Summary of the Invention
[0011] In order to overcome the shortcomings of the prior art, the present invention aims to provide an audio topic generation method and system based on structural analysis and multi-resolution convolution.
[0012] To achieve the above objectives, the present invention employs the following technical solution: In a first aspect, the present invention provides an audio topic generation method based on structural analysis and multi-resolution convolution, comprising the following steps: S1: Perform audio segment structure analysis on the original audio file to be processed to detect audio segment boundaries and obtain candidate audio theme segments; S2: Extract features from the candidate audio topic segments and calculate feature similarity based on the self-attention mechanism to determine the target audio topic segment and the topic region mask corresponding to the target audio topic segment from the candidate audio topic segments; S3: Using the target audio theme segment as conditional input and the theme region mask as control input, a complete audio work containing the target audio theme segment is generated through a multi-resolution convolution and attention hybrid network. The multi-resolution convolution and attention hybrid network includes a multi-resolution convolution module, which contains multiple parallel dilated convolution branches. These multiple dilated convolution branches are used to capture audio features at different time scales. The multi-resolution convolution module dynamically weights and fuses the outputs of the multiple dilated convolution branches through an adaptive feature fusion mechanism for the generation of the complete audio work.
[0013] Further, in step S1, audio segment structure analysis is performed on the original audio file to be processed to detect audio segment boundaries, including: Pause detection: Detects silent or low-energy segments in an audio signal to identify potential segment boundaries; Spectral jump: Calculate the spectral difference between adjacent audio frames and identify spectral jump points as segment boundaries; Rhythm variation: When the time value of an audio frame is significantly longer than that of the audio frames before and after it, that position is marked as a segment boundary; Frame structure: with audio frame boundaries and empty frames as segment boundaries; And based on the boundaries of each segment, the candidate audio theme segment containing multiple consecutive audio frames is generated.
[0014] Further, in step S2, feature extraction is performed on the candidate audio topic segments, and feature similarity calculation is performed based on a self-attention mechanism, including: Audio frame-level features are extracted from the audio frames within the candidate audio theme segment. The audio frame-level features include pitch features, duration features, and dynamic features. The audio frame-level features are then projected into a high-dimensional space to obtain audio frame projection features. Calculate audio segment-level statistical features for the candidate audio theme segments. The audio segment-level statistical features include the number of audio frames in the segment, the pitch range of the segment, the start time of the first audio frame, the total duration of the entire audio, the average normalized pitch, and the average normalized audio frame duration. Then, project the audio segment-level statistical features into a high-dimensional space to obtain audio segment projection features. A query matrix is generated using the projection features of the audio frames, and a key matrix and a value matrix are generated using the projection features of the audio segments. Multi-head self-attention calculation is then performed based on the query matrix, the key matrix, and the value matrix to obtain the importance score and attention weight for each audio frame.
[0015] Furthermore, obtaining the importance score and attention weight for each audio frame includes: The output of the multi-head self-attention calculation is subjected to layer normalization and residual connection, and the importance score of each audio frame is obtained through linear layer mapping. The importance score is normalized to obtain the attention weight; The attention weights are integrated into the audio frame-level features to obtain an enhanced feature vector, which includes the pitch difference relative to the first audio frame, the relative time position, the duration, and the attention weights.
[0016] Further, in step S2, determining the target audio theme segment and the theme region mask corresponding to the target audio theme segment from the candidate audio theme segments includes: For each candidate audio topic segment, the enhanced feature vectors of all audio frames within the segment are aggregated to obtain the segment-level enhanced feature vector for each candidate audio topic segment; The distance between the segment-level enhanced feature vectors of the candidate audio topic segments is calculated and converted into a similarity score. Based on a preset threshold, it is determined whether two candidate audio topic segments belong to the same audio topic category. The target audio topic segment is selected from the candidate audio topic segments according to the frequency of occurrence of the same audio topic category, and the topic region mask corresponding to the target audio topic segment is generated.
[0017] Furthermore, in S3, the multi-resolution convolutional and attention hybrid network includes a Transformer encoder-decoder architecture, and the multi-resolution convolutional module is disposed in each layer of the Transformer encoder-decoder architecture; wherein, at the encoder end, the multi-resolution convolutional module is located after the self-attention layer and before the feedforward network; at the decoder end, the multi-resolution convolutional module is located after the self-attention layer and the cross-attention layer.
[0018] Furthermore, in S3, the dilated convolution branch is a one-dimensional dilated convolution branch, and each dilated convolution branch uses a different convolution kernel size and dilation rate to form different receptive fields; the multiple parallel dilated convolution branches include at least a branch with the smallest receptive field and a branch with the largest receptive field, the branch with the smallest receptive field captures local features of the audio frame time scale, and the branch with the largest receptive field captures structural features of the audio segment time scale spanning multiple time steps.
[0019] Furthermore, in S3, the dynamic weighted fusion of the outputs of multiple dilated convolution branches through an adaptive feature fusion mechanism includes: Global average pooling is performed on the output of each dilated convolution branch to obtain the global features of each dilated convolution branch. The global features are then subjected to channel-reduced convolution and sigmoid activation function to obtain the branch feature vector of each dilated convolution branch. The feature vectors of each branch are concatenated and then normalized using the softmax function to obtain the weight vector; The weight vector is weighted and summed with the outputs of multiple dilated convolution branches to obtain the fused feature. The fused feature is then subjected to channel number recovery convolution and Gaussian error linear unit activation function to obtain the final output of the multi-resolution convolution module.
[0020] Further, in S3, a complete audio work containing the target audio theme segment is generated through a multi-resolution convolutional and attention hybrid network, including: The target audio theme segment is input into the encoder to generate a theme conditional representation; Audio event sequences are generated in an autoregressive manner by a decoder, wherein when generating topic regions, the decoder focuses on the topic conditional representation through cross-attention, and when generating non-topic regions, the decoder focuses on the generated content through self-attention. The audio event sequence is decoded back into MIDI format to obtain the complete audio work.
[0021] Secondly, the present invention provides an audio topic generation system based on structural analysis and multi-resolution convolution, comprising: The audio segment structure analysis module is used to perform audio segment structure analysis on the raw audio file to be processed in order to detect audio segment boundaries and obtain candidate audio theme segments. The target topic determination module is used to extract features from the candidate audio topic segments and calculate feature similarity based on the self-attention mechanism to determine the target audio topic segment and the topic region mask corresponding to the target audio topic segment from the candidate audio topic segments. The audio generation module is used to generate a complete audio work containing the target audio theme segment by taking the target audio theme segment as conditional input and the theme region mask as control input, and using a multi-resolution convolution and attention hybrid network to generate a complete audio work containing the target audio theme segment. The multi-resolution convolution and attention hybrid network includes a multi-resolution convolution module, which contains multiple parallel dilated convolution branches. These multiple dilated convolution branches are used to capture audio features at different time scales. The multi-resolution convolution module dynamically weights and fuses the outputs of the multiple dilated convolution branches through an adaptive feature fusion mechanism for the generation of the complete audio work.
[0022] Compared with the prior art, the present invention has the following beneficial effects: This invention performs audio segment structure analysis on the original audio file to be processed to detect audio segment boundaries, obtain candidate audio theme segments, and determines the target audio theme segment and its corresponding theme region mask based on feature similarity calculation enhanced by a self-attention mechanism. By combining audio segment boundary analysis guided by audio signal processing theory with feature similarity calculation enhanced by self-attention, the accuracy and flexibility of audio theme recognition are effectively improved. Similarity judgment is no longer limited to strict exact matching; similar themes with subtle variations can also be flexibly identified. Furthermore, the theme region mask provides clear theme location information for the generation stage. Using the target audio theme segment as conditional input, multi-resolution convolution and injection are used to... The intention-power hybrid network generates complete audio works containing the target audio theme segments, giving the generated works a clear thematic structure and long-term coherence, thus enhancing the structure and expressiveness of the generated audio. Multiple parallel dilated convolution branches capture audio features at different time scales, expanding the receptive field without significantly increasing the number of parameters. An adaptive feature fusion mechanism dynamically weights and fuses the outputs of each branch, adaptively adjusting the importance of features at different scales based on the input content, achieving a better balance between capturing local feature patterns and modeling the global structure. Simultaneously, attention computation is applied only to candidate audio segments, maintaining good computational efficiency while improving the quality of theme recognition and generation. Attached Figure Description
[0023] Figure 1 This is a flowchart illustrating an audio topic generation method based on structural analysis and multi-resolution convolution provided in Embodiment 1 of the present invention. Figure 2 This is an overall framework diagram of the audio topic extraction and generation method based on audio segment structure analysis and multi-resolution convolution provided in Embodiment 1 of the present invention; Figure 3This is a flowchart of the topic extraction module based on audio segment structure analysis and self-attention mechanism enhancement provided in Embodiment 1 of the present invention; Figure 4 This is a schematic diagram illustrating the principle and flow of the adaptive feature fusion mechanism provided in Embodiment 1 of the present invention; Figure 5 This is a flowchart illustrating an audio topic generation system based on structural analysis and multi-resolution convolution, as provided in Embodiment 2 of the present invention. Detailed Implementation
[0024] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0025] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0026] The present invention will now be described in further detail with reference to the accompanying drawings: Example 1 See Figure 1-4 As shown, this embodiment provides an audio topic generation method based on structural analysis and multi-resolution convolution, including the following steps: S1: Perform audio segment structure analysis on the original audio file to be processed to detect audio segment boundaries and obtain candidate audio theme segments; S2: Extract features from the candidate audio topic segments and calculate feature similarity based on the self-attention mechanism to determine the target audio topic segment and the topic region mask corresponding to the target audio topic segment from the candidate audio topic segments; S3: Using the target audio theme segment as conditional input and the theme region mask as control input, a complete audio work containing the target audio theme segment is generated through a multi-resolution convolution and attention hybrid network. The multi-resolution convolution and attention hybrid network includes a multi-resolution convolution module, which contains multiple parallel dilated convolution branches. These multiple dilated convolution branches are used to capture audio features at different time scales. The multi-resolution convolution module dynamically weights and fuses the outputs of the multiple dilated convolution branches through an adaptive feature fusion mechanism for the generation of the complete audio work.
[0027] Specifically, such as Figure 2 As shown, the multi-resolution convolutional and attention hybrid network adopts an encoder-decoder architecture. Its conditional input is extracted by a topic extraction module enhanced by audio structure analysis and self-attention mechanism: this module performs audio structure analysis on the input audio to detect segment boundaries, calculates frame importance through multi-head self-attention mechanism, and outputs topic markers and topic region masks; the topic markers are embedded with markers and added with sine position encoding and then input to the encoder. The encoder includes a multi-head self-attention layer and a multi-resolution convolutional module to generate topic conditional representations. The topic conditional representations are sent to the cross-attention layer of the decoder; the complete target sequence markers are embedded with markers and added with topic alignment position encoding and sine position encoding and then input to the decoder. The decoder includes a cross-attention layer, a multi-head self-attention layer, and a multi-resolution convolutional module. The topic region mask is input to the decoder, so that it pays attention to the topic conditional representations in the topic regions through cross-attention and pays attention to the generated content in the non-topic regions through self-attention; the decoder outputs an audio event sequence, which is decoded back to MIDI format to obtain the complete audio work.
[0028] The topic region mask is used to indicate the position of the target audio topic segment within the entire audio sequence. During the S3 generation stage, this mask is added to the outputs of the two attention branches in the decoder after element-wise multiplication: in topic regions with a mask of 1, the decoder focuses on the topic conditional representation through cross-attention; in non-topic regions with a mask of 0, the decoder focuses on the generated content through self-attention, thereby achieving control over the topic structure of the generated content.
[0029] Furthermore, prior to S1, data preprocessing is included: converting the original audio file (MIDI format) into a discrete sequence of events using the REMI representation method; the REMI representation method replaces audio frame closing events with audio frame durations, replaces time-shift events with frame and position markers, provides a clear metric grid for the audio, and introduces a set of rhythmic events to allow for local rhythmic variations per beat.
[0030] Further, in step S1, audio segment structure analysis is performed on the original audio file to be processed to detect audio segment boundaries, including: Pause detection: Detects silent or low-energy segments in an audio signal to identify potential segment boundaries; Spectral jump: Calculate the spectral difference between adjacent audio frames and identify spectral jump points as segment boundaries; Rhythm variation: When the time value of an audio frame is significantly longer than that of the audio frames before and after it, that position is marked as a segment boundary; Frame structure: with audio frame boundaries and empty frames as segment boundaries; Based on the boundaries of each segment, candidate audio theme segments containing 2 to 4 audio frame lengths are generated, where 2 to 4 is an empirically set range of candidate segment lengths, covering common theme durations such as short theme motivations.
[0031] Further, in step S2, feature extraction is performed on the candidate audio topic segments, and feature similarity calculation is performed based on a self-attention mechanism, including: (1) Audio frame-level feature extraction and standardization; Audio frame-level features are extracted from the audio frames within the candidate audio theme segment. The audio frame-level features include pitch features, duration features, and velocity features. Specifically, to enhance the expressive power of audio topic extraction, this embodiment designs a multi-granularity feature interaction attention mechanism, combining audio frame-level and audio segment-level feature representations to capture both local details and global structure. Feature extraction is divided into two granular levels: audio frame-level and audio segment-level. For each audio frame of the audio sequence, a feature vector including pitch, duration, and dynamics features is extracted. Pitch features represent the pitch value or dominant frequency component of the audio frame, duration features represent the duration of the audio frame, and dynamics features represent the energy or loudness of the audio frame. These features are standardized to ensure their values fall within a reasonable range, and are standardized using the following formula:
[0032] in, For the first i The standardized audio frame-level feature vector of each audio frame; For the first in the audio sequence i One audio frame; For the first i The MIDI pitch value of each audio frame, in this embodiment, ranges from 0 to 127; For the first i The duration of each audio frame, in order to tick As a unit, and ,in For the first i The start / end time of each audio frame (in words) tick (in units) For the first i The velocity value of each audio frame, in this embodiment, ranges from 0 to 127; For each shot tick The specific value of the number is determined by the time resolution of the MIDI file (such as the common 480 or 960); the division operation is to standardize each feature to the range of [0,1]. The method aims to ensure that the duration feature does not exceed 1. 4 is the maximum number of beats considered based on experience, covering common time values such as whole notes, meaning a maximum duration of 4 beats is considered. In this embodiment, the audio sequence is taken. The feature vectors of each audio frame Stacking the frames in order, we obtain the audio frame-level feature matrix of the audio sequence N:
[0033] in, i It iterates through the index variable and retrieves its value. i = 1 , 2 , … , n , n audio sequence N The actual total number of audio frames included is determined by the length of the input audio. express n The number of audio frames is 3, and the feature dimension is 3. The three normalized components are arranged in the order of pitch, duration, and velocity to form a 3D vector. .
[0034] The audio frame-level feature matrix As input to frame-level projection, each row vector By projecting frame by frame using the following formula, the audio frame-level projection feature matrix is obtained. .
[0035] (2) Frame-level projection; The audio frame-level features are projected into a high-dimensional space to enhance expressive power, resulting in audio frame projection features. The projection process is achieved through linear transformation and activation functions, mapping the original low-dimensional features to a higher-dimensional representation space, as shown in the following formula.
[0036] in, For the first i The standardized audio frame-level feature vector of each audio frame; For the projected first iEach audio frame feature vector, and ; The projection dimension set for experience is used in this embodiment. ; Let be the projection matrix, and ; Let be the bias vector, and ; The hyperbolic tangent activation function is used to compress the values to the range of [-1, 1], introducing nonlinearity; Therefore, audio sequence The audio frame-level projection features are calculated using the frame-level projection feature matrix as follows:
[0037] in, i For the index of the audio frame, i = 1 , 2 , … , n , It indicates "frame-level (note-level)" granularity, as opposed to phrase-level notation; Representing the dimension of a matrix: n OK, d note Column; wherein, in this embodiment, a note-level projection dimension is provided. d note In this embodiment, 8 is used; fragment-level projection dimension d phrase To maintain consistency with the projection dimension of the note level, we set it to 8, in order to ensure the consistency of the multi-dimensional feature projection space and to simplify the implementation. Let be the set of real numbers / real space, indicating that each element in the matrix is a real number.
[0038] (3) Fragment-level statistical features and projection; Calculate audio segment-level statistical feature vectors for the candidate audio topic segments. Calculate using the following formula:
[0039] in, n seg=Number of audio frames in the segment (normalized by dividing by 30); pitch_range is the pitch range of the segment; start_first is the start time of the first audio frame of the segment; total_dur is the total duration of the entire audio; mean_pitch_norm is the average normalized pitch of the segment; mean_dur_norm is the average normalized duration of the audio frames in the segment; in the formula, each string connected by an underscore is a single feature variable name, and the underscore is an internal connector of the variable name (equivalent to a subscript), which does not indicate a product relationship.
[0040] It is a 6-dimensional statistical feature vector, and broadcast to the segments contained therein. n 1 audio frame, to obtain ∈ .Will Similarly, by linear transformation and projection onto a high-dimensional space using the tanh activation function, the audio segment-level projection features are obtained:
[0041] in, For the projection matrix, ∈ R dphrase For bias vectors, tanh (·) is the hyperbolic tangent activation function, which compresses the value to [ 1,1]; d phrase For fragment-level projection dimensions. Broadcast to the segment contained n 1 audio frame, to obtain ∈ .
[0042] (4) Calculation of multi-head self-attention; A query matrix is generated using the projection features of the audio frames, and a key matrix and a value matrix are generated using the projection features of the audio segments. Multi-head self-attention calculation is then performed based on the query matrix, the key matrix, and the value matrix to obtain the importance score and attention weight for each audio frame.
[0043] Specifically, in this embodiment for the first h For each attention head, the calculation of its query, key, and value matrix is as follows:
[0044] Among them, Q h For the first h The query matrix of each attention head and Q h ; The matrix of features for all audio frames and ; To query the projection matrix and ; K h For the first h The key matrix of each attention head and K h ; For audio segment level projection features and That is, after the segment-level statistical features are projected into a high-dimensional space, the projection features of each audio frame to which it belongs are taken. The key projection matrix and ; V h For the first h V is the value matrix of each attention head. h ; The projection matrix is a value and ;in For each head dimension, h For attention head index, h = 1 , 2 , ..., H ; H The number of attention heads is set to 4 in this embodiment; d hidden The hidden dimension of the model is 32 in this embodiment.
[0045] The Query matrix is obtained by projecting audio frame features, while the Key and Value matrices are obtained by projecting audio segment features. For example... Figure 3 As shown, the dimension of each attention head is the model's hidden dimension divided by the number of attention heads. For each attention head, a scaled dot product attention calculation is performed on its query matrix, key matrix, and value matrix, i.e., the query matrix Q is calculated. h With bond matrix K h The dot product of the transpose, with After scaling, it is normalized by softmax, and then the value matrix V is adjusted. h Weighted summation yields the attention output of the head; H The outputs of the attention heads are concatenated to obtain the output of the multi-head self-attention computation. The output is then subjected to layer normalization and residual connection, and then mapped to the importance score of each audio frame through a linear layer. The final attention weights are obtained by softmax normalization to ensure that the sum of all weights is 1.
[0046] Specifically, obtaining the importance score and attention weight for each audio frame includes: (5) Importance score; The output of the multi-head self-attention computation is subjected to layer normalization and residual connection (Add & Norm), and the importance score of each audio frame is obtained through linear layer mapping. The importance score is calculated using the following formula:
[0047] in, For the first i The importance score of each audio frame and ; For the first i The attention enhancement features are obtained by performing layer normalization and residual connection on the output of the multi-head self-attention calculation of each audio frame, and ; To output the weight matrix and .
[0048] (6) Attention weights; The importance score is normalized using softmax to obtain the attention weight;
[0049] in, For the first Attention weights for each audio frame and ; Score the importance of each audio frame; To ensure that the sum of all weights is 1; j For all n A dummy index variable summed from 1 audio frame ( j =1,2,…,n); n The total number of audio frames actually contained in the audio sequence, compared with the aforementioned formula (e.g., Xnote∈R^{n×dnote}). n The meanings are consistent. The denominator of the formula should be for all... n The importance scores of the frames are summed, i.e., Σ_{j=1}^{n} exp(s j ).
[0050] (7) Enhance the feature vector; Similarity calculation integrates the attention weights into the feature sequence for enhancement. For each audio frame in the audio sequence, an enhanced feature vector is constructed based on its pitch, start and end time attributes, and corresponding attention weights, and is calculated using the following formula:
[0051] in, For enhanced audio frame feature vectors; It is the pitch difference relative to the first audio frame, and ,in The first audio frame of the audio sequence ( i =1); The relative time position is measured in frames, and ; The duration is measured in frames, and ; Attention weights and .
[0052] For audio, the enhanced feature matrix for:
[0053] Where 4 represents the dimension of the enhanced feature vector, consisting of relPitch, relTime, relDuration, and The four components are arranged in sequence.
[0054] Further, in step S2, determining the target audio theme segment and the theme region mask corresponding to the target audio theme segment from the candidate audio theme segments includes: For each candidate audio topic segment, the enhanced feature vectors of all audio frames within the segment are... Element-wise averaging is used to enhance the feature vectors of all audio frames within a segment. The fragment-level enhanced feature vector of the candidate fragment is obtained by calculating the arithmetic mean of the corresponding dimensions. ef seg This yields the fragment-level enhanced feature vector for each candidate audio topic segment. ef seg ; For an audio theme segment, the enhanced feature vector is obtained by aggregating the enhanced features of all audio frames within the segment. This method of similarity calculation considers not only the pitch, time, and duration features of the audio frames but also integrates importance weights assigned by the attention mechanism. This fusion allows the algorithm to employ a more flexible approach when judging the similarity of audio segments, moving beyond strict exact matching. Similar audio themes, even with subtle variations, will typically produce similar feature sequences and attention distributions, thus being correctly identified as variations of the same theme.
[0055] For each pair of candidate audio topic segments, compute their segment-level enhanced feature vectors. ef segThe Euclidean distance d between them is calculated and converted into a similarity score using the following formula: sim = 1 / (1+d), so that the similarity score falls within the interval (0,1] and decreases monotonically as the distance increases. A preset similarity threshold τ (τ = 0.85 in this embodiment) is used to determine whether the two belong to the same audio topic category: when sim ≥ τ, they are determined to belong to the same audio topic category; otherwise, they are determined to be different categories. The target audio topic segment is selected from the candidate audio topic segments based on the frequency of occurrence of the same audio topic category, and a topic region mask corresponding to the target audio topic segment is generated. The topic region mask is a 0 / 1 indicator sequence of the same length as the audio sequence, indicating the location where the target audio topic segment appears.
[0056] The theme region mask is a 0 / 1 indicator sequence of the same length as the audio sequence: the target audio theme segment and all segments belonging to the same music theme category are set to 1, and the rest are set to 0. This mask is used in the S3 generation stage to switch the decoder's attention mechanism (theme region cross-attention, non-theme region self-attention).
[0057] Further, in S3, the multi-resolution convolutional and attention hybrid network includes a Transformer encoder-decoder architecture (this embodiment provides a topic transformer as the baseline model, retaining its encoder-decoder structure), and the multi-resolution convolutional module is set in each layer of the Transformer encoder-decoder architecture; wherein, at the encoder end, the multi-resolution convolutional module is located after the self-attention layer and before the feedforward network; at the decoder end, the multi-resolution convolutional module is located after the self-attention layer and the cross-attention layer.
[0058] In this embodiment, the target audio topic fragment is converted into topic tokens, which are then tokenized and embedded with sine position encoding before being input into the encoder. The decoder tokenizes the complete audio tokens and adds topic alignment position encoding and sine position encoding. The topic region mask and its inverse are element-wise multiplied with the outputs of the two attention branches in the decoder and then added, so that when generating topic regions, the decoder pays attention to the topic condition representation through cross attention, and when generating non-topic regions, it pays attention to the already generated content through self attention.
[0059] Further, in S3, the dilated convolution branch is a one-dimensional dilated convolution branch (the symbolic representation of audio is essentially one-dimensional sequence data). Each dilated convolution branch uses a different kernel size and dilation rate to form different receptive fields. The multiple parallel dilated convolution branches include at least a branch with the smallest receptive field and a branch with the largest receptive field. This embodiment uses three branches, so that the branch with the smallest receptive field captures the local features of the audio frame time scale, and the branch with the largest receptive field captures the structural features of the audio segment time scale spanning multiple time steps. The receptive field size of each branch satisfies: Receptive field size = Kernel size + (Kernel size + ...) 1) × (expansion rate) 1), such as Figure 4 As shown, the kernel size and dilation rate of the three branches are respectively ( k =3, d =1), ( k =5, d =2), ( k =7, d =4), therefore, the receptive fields of the three branches are 3, 9, and 25, respectively, and the dilated convolution of each branch is calculated according to the formula:
[0060] in, For input features and , For sequence length, For batch size, For feature dimension, i.e. d Input features X The channel dimension, and the model hidden dimension of the Transformer layer. d hidden Consistent, this embodiment uses 32; For the first The kernel size of each branch; For the first The expansion rate of each branch; For fill size and Designed to maintain a constant sequence length; , representing the first The output of each branch, where the number of channels is reduced to the original value. , M This represents the number of parallel dilated convolution branches (i.e., the total number of parallel one-dimensional convolution branches, in this embodiment). M =3).
[0061] Furthermore, in S3, the dynamic weighted fusion of the outputs of multiple dilated convolution branches through an adaptive feature fusion mechanism includes: Global average pooling (AvgPool) is performed on the output of each dilated convolution branch to obtain the global features of each dilated convolution branch. Then, a 1×1 convolution (reducing the number of channels to 1) and a sigmoid activation function are performed on the global features to obtain the branch feature vector of each dilated convolution branch. The feature vectors of each branch are concatenated and then normalized using the softmax function to obtain the weight vector, which is obtained by the following formula:
[0062] In the formula: This represents a join operation on the second dimension, where the dimension changes to... ; This represents the softmax function in the second dimension, ensuring The sum of the weights is 1, and the dimension changes as follows: ; For the first i The output of each dilated convolution branch The branch feature vector obtained after global average pooling, 1×1 convolution and sigmoid activation, and ,in i =1, 2, ..., M , M The number of parallel dilated convolution branches is M=3 in this embodiment, which is the three branches mentioned above; Represented as a normalized weight vector and .
[0063] The weight vector is weighted and summed with the outputs of multiple dilated convolution branches to obtain the fused feature, i.e.:
[0064] In the formula: For the first The weights of each branch and ; Represented as element-wise multiplication; Represented as the fused features and , d =32.
[0065] The fused features are then subjected to a 1×1 convolution (restoring the number of channels to the original dimension). d The final output of the multi-resolution convolution module is obtained by applying the Gaussian error linear unit activation function, as shown in the following equation:
[0066] In the formula: Represented as a 1×1 convolution, the dimension changes as follows: ; Represented as the Gaussian error linear unit activation function; This represents the final output and ; This is represented as follows: kernel size = 1, dilation rate = 1, padding = 0. The multi-resolution convolution module is then fed back into the Transformer layer (the encoder sends the data to the feedforward network, and the decoder sends it to the subsequent calculations) for the generation of the complete audio work.
[0067] Optionally, dropout is also performed after the Gaussian error linear unit activation function (see...). Figure 4 Then, the final output of the multi-resolution convolution module is obtained. .
[0068] Further, in S3, a complete audio work containing the target audio theme segment is generated through a multi-resolution convolutional and attention hybrid network, including: The target audio theme segment is input into the encoder to generate a theme conditional representation; Audio event sequences are generated in an autoregressive manner by a decoder, wherein when generating topic regions, the decoder focuses on the topic conditional representation through cross-attention, and when generating non-topic regions, the decoder focuses on the generated content through self-attention. The audio event sequence is decoded back into MIDI format to obtain the complete audio work.
[0069] In this embodiment, the training of the network includes: initializing the encoder-decoder structure using a pre-trained topic transformer model as a baseline; inserting a multi-resolution convolutional module containing three parallel dilated convolutional branches at the specific position of each layer of the Transformer; initializing the parameters of the global average pooling, 1×1 convolution, and softmax weight generation network; and performing end-to-end training using the Adam optimizer with topic segments as conditional input and complete audio as the target output.
[0070] This embodiment combines audio segment boundary analysis guided by audio signal processing theory with feature similarity calculation enhanced by self-attention, effectively improving the accuracy and flexibility of audio theme recognition. Similarity judgment is no longer limited to strict exact matching; similar themes with subtle variations can also be identified as variants of the same theme. Multiple parallel dilated convolution branches capture audio features at different time scales, expanding the receptive field without significantly increasing the number of parameters. An adaptive feature fusion mechanism dynamically weights and fuses the outputs of each branch, achieving a better balance between capturing local feature patterns and modeling the global structure. Ultimately, it can generate complete audio works with clear thematic structure and long-term coherence, enhancing the structure and expressiveness of the generated audio. Attention calculation is applied only to candidate audio segments, maintaining good computational efficiency.
[0071] Example 2 Combination Figure 5 As shown, this embodiment provides an audio topic generation system based on structural analysis and multi-resolution convolution, including: The audio segment structure analysis module is used to perform audio segment structure analysis on the raw audio file to be processed in order to detect audio segment boundaries and obtain candidate audio theme segments. The target topic determination module is used to extract features from the candidate audio topic segments and calculate feature similarity based on the self-attention mechanism to determine the target audio topic segment and the topic region mask corresponding to the target audio topic segment from the candidate audio topic segments. The audio generation module is used to generate a complete audio work containing the target audio theme segment by taking the target audio theme segment as conditional input and the theme region mask as control input, and using a multi-resolution convolution and attention hybrid network to generate a complete audio work containing the target audio theme segment. The multi-resolution convolutional and attention hybrid network includes a Transformer encoder-decoder architecture, and introduces a multi-resolution convolutional module with an adaptive feature fusion mechanism in each layer of the Transformer encoder-decoder architecture. The multi-resolution convolutional module contains multiple parallel dilated convolutional branches, which are used to capture audio features at different time scales. The multi-resolution convolutional module dynamically weights and fuses the outputs of the multiple dilated convolutional branches through the adaptive feature fusion mechanism to enhance the local and global structural consistency of the generated audio for the generation of the complete audio work.
[0072] The system in this embodiment is used to implement the method described in Embodiment 1. The specific implementation of each module can refer to the corresponding steps in Embodiment 1, and will not be repeated here. Specifically, when generating an audio event sequence, the audio generation module, in the theme region indicated by the theme region mask, uses cross-attention to focus on the theme condition representation; in non-theme regions, the decoder uses self-attention to focus on the generated content, so that the generated complete audio work has a clear theme structure and long-term coherence, enhancing the structure and expressiveness of the generated audio.
[0073] Example 3 This embodiment also provides a terminal device. The terminal device includes a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps in the various method embodiments described above (i.e., the audio theme generation method of Embodiment 1), or, when the processor executes the computer program, it implements the functions of each module / unit in the various device embodiments described above (i.e., the functions of the audio segment structure analysis module, target theme determination module, and audio generation module of Embodiment 2). The computer program can be divided into one or more modules / units, which are stored in the memory and executed by the processor to complete the present invention.
[0074] The terminal device can be a desktop computer, laptop computer, or cloud server, or other device with strong computing power, and may include, but is not limited to, a processor and memory. The processor is preferably a multi-core high-speed central processing unit (CPU). The memory can be used to store the computer programs and / or modules. The processor implements various functions of the terminal device by running or executing the computer programs and / or modules stored in the memory, and by accessing data stored in the memory.
[0075] If the modules / units integrated in the terminal device are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above.
[0076] The computer program includes computer program code, which may be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM). Only memory), random access memory (RAM), electrical carrier signals, electrical signals, and software distribution media, etc.
[0077] The above content is only for illustrating the technical concept of the present invention and should not be construed as limiting the scope of protection of the present invention. Any modifications made to the technical solution based on the technical concept proposed in this invention shall fall within the scope of protection of the claims of this invention.
Claims
1. An audio topic generation method based on structural analysis and multi-resolution convolution, characterized in that, Includes the following steps: S1: Perform audio segment structure analysis on the original audio file to be processed to detect audio segment boundaries and obtain candidate audio theme segments; S2: Extract features from the candidate audio topic segments and calculate feature similarity based on the self-attention mechanism to determine the target audio topic segment and the topic region mask corresponding to the target audio topic segment from the candidate audio topic segments; S3: Using the target audio theme segment as conditional input and the theme region mask as control input, a complete audio work containing the target audio theme segment is generated through a multi-resolution convolution and attention hybrid network; wherein, the multi-resolution convolution and attention hybrid network includes a multi-resolution convolution module, which contains multiple parallel dilated convolution branches, which are used to capture audio features at different time scales; the multi-resolution convolution module dynamically weights and fuses the outputs of the multiple dilated convolution branches through an adaptive feature fusion mechanism for the generation of the complete audio work.
2. The audio topic generation method based on structural analysis and multi-resolution convolution according to claim 1, characterized in that, In step S1, audio segment structure analysis is performed on the original audio file to be processed to detect audio segment boundaries, including: Pause detection: Detects silent or low-energy segments in an audio signal to identify potential segment boundaries; Spectral jump: Calculate the spectral difference between adjacent audio frames and identify spectral jump points as segment boundaries; Rhythm variation: When the time value of an audio frame is significantly longer than that of the audio frames before and after it, that position is marked as a segment boundary; Frame structure: with audio frame boundaries and empty frames as segment boundaries; And based on the boundaries of each segment, the candidate audio theme segment containing multiple consecutive audio frames is generated.
3. The audio topic generation method based on structural analysis and multi-resolution convolution according to claim 1, characterized in that, In step S2, feature extraction is performed on the candidate audio topic segments, and feature similarity calculation is performed based on a self-attention mechanism, including: Audio frame-level features are extracted from the audio frames within the candidate audio theme segment. The audio frame-level features include pitch features, duration features, and dynamic features. The audio frame-level features are then projected into a high-dimensional space to obtain audio frame projection features. Calculate audio segment-level statistical features for the candidate audio theme segments. The audio segment-level statistical features include the number of audio frames in the segment, the pitch range of the segment, the start time of the first audio frame, the total duration of the entire audio, the average normalized pitch, and the average normalized audio frame duration. Then, project the audio segment-level statistical features into a high-dimensional space to obtain audio segment projection features. A query matrix is generated using the projection features of the audio frames, and a key matrix and a value matrix are generated using the projection features of the audio segments. Multi-head self-attention calculation is then performed based on the query matrix, the key matrix, and the value matrix to obtain the importance score and attention weight for each audio frame.
4. The audio topic generation method based on structural analysis and multi-resolution convolution according to claim 3, characterized in that, The importance score and attention weight for each audio frame are obtained, including: The output of the multi-head self-attention calculation is subjected to layer normalization and residual connection, and the importance score of each audio frame is obtained through linear layer mapping. The importance score is normalized to obtain the attention weight; The attention weights are integrated into the audio frame-level features to obtain an enhanced feature vector, which includes the pitch difference relative to the first audio frame, the relative time position, the duration, and the attention weights.
5. The audio topic generation method based on structural analysis and multi-resolution convolution according to claim 4, characterized in that, In step S2, determining the target audio theme segment and the theme region mask corresponding to the target audio theme segment from the candidate audio theme segments includes: For each candidate audio topic segment, the enhanced feature vectors of all audio frames within the segment are aggregated to obtain the segment-level enhanced feature vector for each candidate audio topic segment; The distance between the segment-level enhanced feature vectors of the candidate audio topic segments is calculated and converted into a similarity score. Based on a preset threshold, it is determined whether two candidate audio topic segments belong to the same audio topic category. The target audio topic segment is selected from the candidate audio topic segments according to the frequency of occurrence of the same audio topic category, and the topic region mask corresponding to the target audio topic segment is generated.
6. The audio topic generation method based on structural analysis and multi-resolution convolution according to claim 1, characterized in that, In S3, the multi-resolution convolutional and attention hybrid network includes a Transformer encoder-decoder architecture, and the multi-resolution convolutional module is disposed in each layer of the Transformer encoder-decoder architecture; wherein, at the encoder end, the multi-resolution convolutional module is located after the self-attention layer and before the feedforward network; at the decoder end, the multi-resolution convolutional module is located after the self-attention layer and the cross-attention layer.
7. The audio topic generation method based on structural analysis and multi-resolution convolution according to claim 1, characterized in that, In S3, the dilated convolution branch is a one-dimensional dilated convolution branch, and each dilated convolution branch uses a different convolution kernel size and dilation rate to form a different receptive field; the multiple parallel dilated convolution branches include at least a branch with the smallest receptive field and a branch with the largest receptive field. The branch with the smallest receptive field captures the local features of the audio frame time scale, and the branch with the largest receptive field captures the structural features of the audio segment time scale spanning multiple time steps.
8. The audio topic generation method based on structural analysis and multi-resolution convolution according to claim 1, characterized in that, In step S3, the dynamic weighted fusion of the outputs of multiple dilated convolution branches through an adaptive feature fusion mechanism includes: Global average pooling is performed on the output of each dilated convolution branch to obtain the global features of each dilated convolution branch. The global features are then subjected to channel-reduced convolution and sigmoid activation function to obtain the branch feature vector of each dilated convolution branch. The feature vectors of each branch are concatenated and then normalized using the softmax function to obtain the weight vector; The weight vector is weighted and summed with the outputs of multiple dilated convolution branches to obtain the fused feature. The fused feature is then subjected to channel number recovery convolution and Gaussian error linear unit activation function to obtain the final output of the multi-resolution convolution module.
9. The audio topic generation method based on structural analysis and multi-resolution convolution according to claim 6, characterized in that, In step S3, a complete audio work containing the target audio theme fragment is generated using a multi-resolution convolutional and attention hybrid network, including: The target audio theme segment is input into the encoder to generate a theme conditional representation; Audio event sequences are generated in an autoregressive manner by a decoder, wherein when generating topic regions, the decoder focuses on the topic conditional representation through cross-attention, and when generating non-topic regions, the decoder focuses on the generated content through self-attention. The audio event sequence is decoded back into MIDI format to obtain the complete audio work.
10. An audio topic generation system based on structural analysis and multi-resolution convolution, characterized in that, include: The audio segment structure analysis module is used to perform audio segment structure analysis on the raw audio file to be processed in order to detect audio segment boundaries and obtain candidate audio theme segments. The target topic determination module is used to extract features from the candidate audio topic segments and calculate feature similarity based on the self-attention mechanism to determine the target audio topic segment and the topic region mask corresponding to the target audio topic segment from the candidate audio topic segments. The audio generation module is used to generate a complete audio work containing the target audio theme segment by taking the target audio theme segment as conditional input and the theme region mask as control input, and using a multi-resolution convolution and attention hybrid network to generate a complete audio work containing the target audio theme segment. The multi-resolution convolution and attention hybrid network includes a multi-resolution convolution module, which contains multiple parallel dilated convolution branches. These multiple dilated convolution branches are used to capture audio features at different time scales. The multi-resolution convolution module dynamically weights and fuses the outputs of the multiple dilated convolution branches through an adaptive feature fusion mechanism for the generation of the complete audio work.
