A method of generating a musical melody and related apparatus

By generating chord progressions, rhythmic progressions, and melodic progressions of musical melodies step by step, and using Bi-LSTM and Transformer modules to transform chord vectors, the problem of generating high-quality musical melodies for non-professional users is solved, realizing the generation of high-quality musical melodies and user intervention correction.

CN117012168BActive Publication Date: 2026-07-03TENCENT TECHNOLOGY (SHENZHEN) CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
TENCENT TECHNOLOGY (SHENZHEN) CO LTD
Filing Date
2022-04-25
Publication Date
2026-07-03

Smart Images

  • Figure CN117012168B_ABST
    Figure CN117012168B_ABST
Patent Text Reader

Abstract

This application provides a method and related apparatus for generating music melody, which provides diverse music theory information during the music melody generation process, thereby enabling the generation of high-quality music melodies. The method includes: acquiring a chord progression sequence, wherein the chord progression sequence includes K chords, where K is an integer greater than 1; converting the chord progression sequence into a chord vector sequence, wherein the chord vector sequence includes an encoding vector for each chord, the encoding vector of which is obtained based on the context chord encoding; inputting the chord vector sequence into a rhythm encoder to output a corresponding first rhythm vector sequence; inputting the first rhythm vector sequence and the chord vector sequence into a melody progression encoder to output a corresponding first melody vector sequence; and inputting the first rhythm vector, the chord vector sequence, and the first melody vector into a melody encoder to output a corresponding first musical melody.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of multimedia content processing, and in particular to a method and apparatus for generating music melody. Background Technology

[0002] With the development of electronic technology, musical instrument digital interface (MIDI) has become a widely used technology in the field of music composition. As various music applications become more popular, users are increasingly pursuing personalized music, and more and more users are beginning to try creating their own music.

[0003] However, for ordinary users who are not professionals, this idea is often impossible to realize due to a lack of professional music knowledge and unfamiliarity with the operation of related technologies. Therefore, technology that can automatically generate music is needed. Summary of the Invention

[0004] This application provides a method and related apparatus for generating music melody, which generates music theory information such as chord progressions, rhythmic progressions, and melodic progressions of music melody in steps. That is, it provides diverse music theory information in the process of generating music melody, thereby enabling the generation of high-quality music melody.

[0005] In view of this, this application provides a method for generating a musical melody, comprising: acquiring a chord progression sequence, wherein the chord progression sequence includes K chords, where K is an integer greater than 1; converting the chord progression sequence into a chord vector sequence, wherein the chord vector sequence includes an encoding vector for each chord, the encoding vector being obtained based on the context chord encoding of the chord; inputting the chord vector sequence into a rhythm encoder to output a corresponding first rhythm vector sequence, the first rhythm vector sequence representing a note and the start and end positions of each note; inputting the first rhythm vector sequence and the chord vector sequence into a melody progression encoder to output a corresponding first melody vector sequence, wherein the first melody vector sequence represents the pitch relationship between the notes; inputting the first rhythm vector, the chord vector sequence, and the first melody vector into a melody encoder to output a corresponding first musical melody, the first musical melody representing the note, the start and end positions of the note, the pitch relationship between the notes, and the pitch of the note.

[0006] Another aspect of this application provides a music melody generation apparatus, comprising: an acquisition module for acquiring a chord progression sequence, wherein the chord progression sequence includes K chords, and K is an integer greater than 1;

[0007] The first conversion module is used to convert the chord sequence into a chord vector sequence, wherein the chord vector sequence includes an encoding vector for each chord, and the encoding vector for each chord is obtained based on the context chord encoding of the chord;

[0008] The first processing module is used to input the chord vector sequence to the rhythm encoder to output the corresponding first rhythm vector sequence, which represents the notes and the start and end positions of each note;

[0009] The second processing module is used to input the first rhythm vector sequence and the chord vector sequence into the melody encoder to output the corresponding first melody vector sequence, wherein the first melody vector sequence represents the pitch relationship between the notes;

[0010] The third processing module is used to input the first rhythm vector, the chord vector sequence, and the first melody vector into the melody encoder to output the corresponding first musical melody, which represents the note, the start and end positions of the note, the pitch relationship between the notes, and the pitch of the note.

[0011] In one possible design, in another implementation of another aspect of the embodiments of this application, the first conversion module is specifically used to obtain the context chord of each chord in the chord progression sequence using a bidirectional long short-term memory network (Bi-LSTM); and to encode each chord in the chord progression sequence according to the context chord to obtain the chord vector sequence.

[0012] In one possible design, in another implementation of another aspect of the embodiments of this application, the music melody generation device further includes a first prediction module for predicting the first rhythm vector sequence to output a first rhythm sequence, the first rhythm sequence representing the note and the start and end positions of the note.

[0013] In one possible design, in another implementation of another aspect of the embodiments of this application, the music melody generation device further includes a second conversion module for embedding the first rhythm sequence into the embedding layer to convert it into a second rhythm vector sequence.

[0014] The first processing module is also used to input the chord vector sequence and the second rhythm vector sequence into the rhythm encoder to output the third rhythm vector sequence;

[0015] The second processing module is also used to input the chord vector sequence and the third rhythm vector sequence into the melody for encoder to output the second melody vector sequence;

[0016] The third processing module is also used to input the chord vector sequence, the third rhythm vector sequence and the second melody vector sequence into the melody encoder to output the second musical melody.

[0017] In one possible design, in another implementation of another aspect of the embodiments of this application, the music melody generation device further includes a fourth processing module, used to modify the first rhythm sequence into a second rhythm sequence in response to the first operation;

[0018] The third conversion module is used to embed the second rhythm sequence into the embedding layer to convert it into a third rhythm vector sequence.

[0019] The first processing module is also used to input the chord vector sequence and the third rhythm vector sequence into the rhythm encoder to output the fourth rhythm vector sequence;

[0020] The second processing module is also used to input the chord vector sequence and the fourth rhythm vector sequence into the melody for encoder to output the third melody vector;

[0021] The third processing module is also used to input the chord vector sequence, the fourth rhythm vector sequence and the third melody vector sequence into the melody encoder to output the third musical melody.

[0022] In one possible design, in another implementation of another aspect of the embodiments of this application, the music melody generation device further includes a second prediction module for predicting the first melody vector sequence to output a first melody progression sequence, the first melody progression sequence representing the pitch relationship between the notes.

[0023] In one possible design, in another implementation of another aspect of the embodiments of this application, the music melody generation device further includes a fourth conversion module, used to embed the first melody into the embedding layer as a sequence input, so as to convert it into a fourth melody vector sequence;

[0024] The second processing module is also used to input the chord vector sequence, the first rhythm vector sequence and the fourth melody vector sequence into the melody for encoder to output the fifth melody vector sequence;

[0025] The third processing module is also used to input the chord vector sequence, the first rhythm vector sequence and the fifth melody vector sequence into the melody encoder to output the fourth musical melody.

[0026] In one possible design, in another implementation of another aspect of the embodiments of this application, the music melody generation device further includes a fifth processing module, which is used to modify the first melody sequence into a second melody sequence in response to the second operation.

[0027] The fifth conversion module is used to embed the second melody into the embedding layer as a sequence input to convert it into a sixth melody vector sequence;

[0028] The second processing module is also used to input the chord vector sequence, the first rhythm vector sequence and the sixth melody vector sequence into the melody for encoder to output the seventh melody vector sequence;

[0029] The third processing module is also used to input the chord vector sequence, the first rhythm vector sequence and the seventh melody vector sequence into the melody encoder to output the fifth musical melody.

[0030] In one possible design, in another implementation of another aspect of the embodiments of this application, the second processing module is specifically used to fuse the chord vector sequence and the first rhythm vector sequence to obtain a first input vector; and input the first input vector into the rhythm encoder to output the corresponding first melody vector sequence.

[0031] In one possible design, in another implementation of another aspect of the embodiments of this application, the third processing module is specifically used to fuse the chord vector sequence, the first rhythm vector sequence and the first melody vector sequence to obtain a second input vector; and input the second input vector into the melody encoder to output the first musical melody.

[0032] In one possible design, in another implementation of another aspect of the embodiments of this application, the rhythm encoder, the melody encoder, and the melody encoder are encoders of a natural language neural network.

[0033] In one possible design, in another implementation of another aspect of the embodiments of this application, the natural language neural network is a recurrent neural network (RNN), a transformer, generative pre-training (GTP), or bidirectional encoder-representations-from-transformers (BERT).

[0034] In one possible design, in another implementation of another aspect of the embodiments of this application, the chord progression sequence is a pop music chord sequence or a classical music chord sequence.

[0035] This application also provides a computer device, including: a memory, a processor, and a bus system;

[0036] The memory is used to store programs;

[0037] The processor is used to execute programs in memory, and the processor is used to execute the methods mentioned above according to the instructions in the program code;

[0038] Bus systems are used to connect memory and processor to enable communication between them.

[0039] Another aspect of this application provides a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the methods described above.

[0040] Another aspect of this application provides a computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the above aspects.

[0041] As can be seen from the above technical solutions, the embodiments of this application have the following advantages: the process of generating a musical melody is divided into different steps to generate different music theory information, that is, the chords, rhythms and melodies of the musical melody are gradually obtained. Compared with the existing musical melody synthesis technology, the present invention provides more music theory information as prior information for the output of musical melody, thereby ensuring the generation of high-quality musical melodies. Attached Figure Description

[0042] Figure 1 This is a schematic diagram of the architecture of the music melody generation model in the embodiments of this application;

[0043] Figure 2 This is a schematic diagram of one embodiment of the music melody generation method in this application;

[0044] Figure 3 This is an exemplary input interface for chord progression sequences in the embodiments of this application;

[0045] Figure 4 This is another exemplary input interface for chord progression sequences in the embodiments of this application;

[0046] Figure 5 This is a schematic diagram of one embodiment of the music melody generation device in this application;

[0047] Figure 6 This is a schematic diagram of another embodiment of the music melody generation device in this application;

[0048] Figure 7 This is a schematic diagram of another embodiment of the music melody generation device in this application;

[0049] Figure 8 This is a schematic diagram of another embodiment of the music melody generation device in this application;

[0050] Figure 9 This is a schematic diagram of another embodiment of the music melody generation device in this application;

[0051] Figure 10 This is a schematic diagram of another embodiment of the music melody generation device in this application;

[0052] Figure 11 This is a schematic diagram of another embodiment of the music melody generation device in this application;

[0053] Figure 12 This is a schematic diagram of another embodiment of the music melody generation device in this application;

[0054] Figure 13 This is a schematic diagram of another embodiment of the music melody generation device in this application. Detailed Implementation

[0055] This application provides a method and related apparatus for generating music melody, which generates music theory information such as chord progressions, rhythmic progressions, and melodic progressions of music melody in steps. That is, it provides diverse music theory information in the process of generating music melody, thereby enabling the generation of high-quality music melody.

[0056] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented, for example, in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “corresponding to,” 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.

[0057] For ease of understanding, the following is an explanation of some of the terms that will be used in this application:

[0058] Network: In the conventional sense of machine learning, it refers to neural networks (NN), deep neural networks (DNN), convolutional neural networks (CNN), recurrent neural networks (RNN), other machine learning or deep learning networks, or combinations or modifications thereof.

[0059] Encoder: In the conventional sense of machine learning, for example, an encoder can be the decoder in a recurrent neural network (RNN).

[0060] Natural Language Neural Networks: Generally refers to neural networks that process the interrelated temporal information of natural language.

[0061] Music melody generation: refers to the automatic generation of music melodies through neural networks or model learning.

[0062] Musical Instrument Digital Interface (MIDI) is a widely used music standard format, often referred to as "computer-understandable sheet music," or standardized code representing musical parameters. These musical parameters are uniformly represented as MIDI messages.

[0063] MIDI messages: a type of timing information / instruction used to express and control music, such as note pitch, note velocity, note duration, staccato, accidentals, etc.

[0064] Chord trend: As a higher-order musical information, this refers to multiple chords arranged in sequence. For example, C: major → G: major → A: minor → F: major is a common chord trend.

[0065] Rhythm trend: As a higher-order musical information, it refers to the start and end positions of multiple notes arranged in sequence. For example, the start and end times of pressing a note.

[0066] Melody trend: As a higher-order musical information, it refers to the relationship between multiple notes arranged in sequence. For example, whether two notes are in a stepwise or leaping relationship, etc.

[0067] To achieve the function of generating musical melody, this application proposes the following technical solution: acquiring a chord progression sequence, wherein the chord progression sequence includes K chords, where K is an integer greater than 1; converting the chord progression sequence into a chord vector sequence, wherein the chord vector sequence includes an encoding vector for each chord, which is obtained based on the context chord encoding; inputting the chord vector sequence into a rhythm encoder to output a corresponding first rhythm vector sequence, which represents a note and the start and end positions of each note; inputting the first rhythm vector sequence and the chord vector sequence into a melody encoder to output a corresponding first melody vector sequence, wherein the first melody vector sequence represents the pitch relationship between the notes; inputting the first rhythm vector, the chord vector sequence, and the first melody vector into a melody encoder to output a corresponding first musical melody, which represents the note, the start and end positions of the note, the pitch relationship between the notes, and the pitch of the note.

[0068] In one exemplary solution, embodiments of this application can be applied to, for example... Figure 1 The model architecture shown consists of a Bi-LSTM module and three Transformer modules. The model receives a chord progression sequence as input, such as C: major → G: major → A: minor → F: major. This sequence is then encoded by the Bi-LSTM module after acquiring the context information of each chord to generate a chord vector sequence. This chord vector sequence is then input into a Rhythm Transformer, which outputs a Rhythm Vector Sequence. This Rhythm Vector Sequence defines the notes, number of notes, and the start and end positions of each note in the melody to be generated, thus defining the dynamics of the entire melody. The Rhythm Vector Sequence generated by the Rhythm Transformer is then fused with the chord vector sequence to obtain an input vector. This input vector is then input into a Melody Trend Transformer, which outputs a Melody Vector Sequence. It's important to understand that this Melody Vector Sequence does not represent specific melody notes; rather, it defines the relationships between each note in the melody to be generated, such as steps and leaps. Finally, the rhythm vector sequence, melody vector sequence, and given chord vector sequence are fused (i.e., hidden vector concatenate) and input into the Melody Transformer to generate the final melody note sequence.

[0069] In this application, the music melody generation model can run on a terminal device or server via a browser, or as a standalone application (APP). The specific form of the music melody generation model is not limited here. The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. Terminal devices can be smartphones, tablets, laptops, PDAs, personal computers, smart TVs, smartwatches, in-vehicle devices, wearable devices, etc., but are not limited to these. Terminal devices and servers can be connected directly or indirectly via wired or wireless communication, which is not limited here. The number of servers and terminal devices is also not limited. The solution provided in this application can be completed independently by the server or in cooperation with the terminal device; this is not specifically limited here.

[0070] It is understood that in the specific embodiments of this application, data related to chord progression sequence templates and the like are involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0071] Based on the above introduction, the method for generating music melody in this application will be explained below. Please refer to [link / reference needed] for details. Figure 2 As shown:

[0072] 201. Obtain the chord progression sequence, which includes K chords, where K is an integer greater than 1.

[0073] In this embodiment, the music melody generation device receives an input chord progression sequence. It is understood that this chord progression sequence can be manually input by the user through the input interface of the music melody generation device, or it can be input by the user through a selectable chord progression template. Figure 3 As shown, when a user manually inputs the chord sequence through the input interface of the music melody generation device, the user can input multiple chords at once, for example, inputting a set of pre-defined chords all at once in the input box. The user can also input multiple chords in stages; for example, they can first input two chords in the input box and submit, then input two more chords in the input box and submit, until all chords in the chord sequence have been input. Figure 4As shown, the user selects a chord sequence template from the available chord input interface and then selects one chord to create a sequence.

[0074] In some exemplary schemes, the chord progression sequence may include multiple chords, each with a specified duration and multiple notes. Each chord is used as a reference for selecting notes when generating a musical melody, and the musical melody generated based on the corresponding chord has the specified duration of that chord.

[0075] In other exemplary solutions, the chord progression sequence can also be randomly generated. In this solution, the music melody generation device can randomly generate the aforementioned K chords. For example, chords can be randomly selected from characters in a pre-trained chord vocabulary or lookup table.

[0076] Based on the above description, in an exemplary scheme, the chord progression sequence can be as follows:

[0077] |chord(C:major)--chord(F:major)|chord(F:major)-chord(G:major)-|;

[0078] This chord progression consists of four chords spread across two measures, each with four beats. Specifically, the first chord (C: major) has a designated duration of three beats, lasting from the first beat to the third beat of the first measure. Then, the second chord (F: major) has a designated duration of one beat, ending the first measure. Next, the third chord (F: major) has a designated duration of two beats, lasting from the first beat to the second beat of the second measure. Finally, the fourth chord (G: major) has a designated duration of two beats, lasting from the third beat to the fourth beat of the second measure, ending the second measure.

[0079] The duration of each chord is indicated by the number of beats. It's important to note that in musical compositions, time signatures are typically used to indicate the number of beats in each measure and the duration of each beat. Common time signatures include 1 / 4, 2 / 4, 3 / 4, 4 / 4, 3 / 8, 6 / 8, 7 / 8, 9 / 8, and 12 / 8. Specifically, 4 / 4 time means a quarter note is one beat and there are four beats per measure; 3 / 8 time means an eighth note is one beat and there are three beats per measure. Therefore, if the duration of the musical melody to be output is specified as 1 minute and 60 beats, the length of one beat is 1 second; for example, in 4 / 4 time, there are four beats per measure, or 4 seconds; a quarter note is one beat, meaning its length is 1 second; an eighth note is half a beat and its length is half a second, and so on. Therefore, the duration of a note can be determined by the number of beats it lasts or by the note's value expressed as a percentage, i.e., a fraction of a note.

[0080] 202. Convert the chord sequence into a chord vector sequence, wherein the chord vector sequence includes the encoding vector of each chord, which is obtained based on the context chord encoding of the chord.

[0081] In this embodiment, the music melody generation device can first, through, as shown in the example... Figure 1 The Bi-LSTM shown encodes each chord and its duration within the chord sequence. Taking the above example, "|chord(C:major)--chord(F:major)|chord(F:major)-chord(G:major)-|", the Bi-LSTM extracts contextual information for each beat in the input chord sequence and then encodes the information for each beat. For example, the first chord (C:major) is encoded as A, the two beats following the first chord (C:major) are encoded as B, the second chord (F:major) as C, the third chord (F:major) as D, the beat following the third chord (F:major) as E, the fourth chord (G:major) as F, and the beat following the fourth chord (G:major) as G.

[0082] 203. Input the chord vector sequence into the rhythm encoder to output the corresponding first rhythm vector sequence, which represents the notes and the start and end positions of each note.

[0083] The music melody generation device inputs the chord vector sequence into the rhythm encoder, and outputs a corresponding first rhythm vector sequence through sampling and encoding / decoding by the rhythm encoder. It can be understood that this first rhythm vector sequence determines the notes included in the music melody to be output, and determines the start and end positions of each note based on the duration of the chord sequence.

[0084] It is understandable that the rhythm encoder can be a module of a sub-model in the music melody generation device. In this case, the sub-model can also predict the first rhythm sequence based on the first rhythm vector sequence, and the first rhythm sequence can be output in the form of a MIDI message. After the first rhythm sequence is output, it can be played to the user through a player or displayed to the user through a display interface.

[0085] In this embodiment, if the first rhythm sequence does not meet the requirements, the music melody generation device can resample and encode / decode the first rhythm sequence, specifically including the following possible implementation methods:

[0086] In one possible implementation, the music melody generation device directly receives the first rhythm sequence and inputs it into an embedding layer to convert it into a second rhythm vector sequence; then, the chord vector sequence and the second rhythm vector sequence are input into the rhythm encoder to output a third rhythm vector sequence.

[0087] In another possible implementation, the music melody generation device responds to the first operation by modifying the first rhythm sequence into a second rhythm sequence; then inputs the second rhythm sequence into the embedding layer to convert the second rhythm sequence into a fourth rhythm vector sequence; finally, inputs the chord vector sequence and the fourth rhythm vector sequence into the rhythm encoder to output a fifth rhythm vector sequence.

[0088] In this embodiment, the music melody generation device outputs a rhythm sequence, allowing the user to manually intervene in the generation of the rhythm sequence. This enables the music melody to be corrected during the generation process, which helps to improve the final quality of the generated music melody.

[0089] 204. Input the first rhythm vector sequence and the chord vector sequence into the melody encoder to output the corresponding first melody vector sequence, wherein the first melody vector sequence represents the pitch relationship between the notes.

[0090] The music melody generation device inputs the chord vector sequence and the first rhythm vector sequence into the melody encoder, samples the melody, and decodes it to output the corresponding first melody vector sequence. It can be understood that this first melody vector sequence determines the pitch relationships between the notes in the output melody. These pitch relationships include whether the pitches of two notes are stepwise or leaping.

[0091] It is understandable that the melody progression encoder can be a module of a sub-model in the music melody generation device. This sub-model can then predict a first melody progression sequence based on the first melody vector sequence, and this first melody progression sequence can be output as a MIDI message. After the first melody progression sequence is output, it can be played to the user through a player or displayed to the user through a display interface.

[0092] In this embodiment, if the sequence of the first melody does not meet the requirements, the music melody generation device can resample and encode / decode the sequence of the first melody, specifically including the following possible implementation methods:

[0093] In one possible implementation, the music melody generation device directly receives the first melody sequence and inputs the first melody sequence into an embedding layer to convert the first melody sequence into a fourth melody vector sequence; then, the chord vector sequence, the first rhythm vector sequence, and the fourth melody vector sequence are input into the melody encoder to output a fifth melody vector sequence.

[0094] In another possible implementation, the music melody generation device responds to the second operation by modifying the first melody sequence into a second melody sequence; then inputs the second melody sequence into the embedding layer to convert the second melody sequence into a sixth melody vector sequence; finally, inputs the chord vector sequence, the first rhythm vector sequence, and the sixth melody vector sequence into the melody encoder to output a seventh melody vector sequence.

[0095] In this embodiment, the music melody generation device outputs the melody in sequence, allowing the user to manually intervene in the generation of the melody sequence. This enables the music melody to be corrected during the generation process, which helps to improve the final quality of the generated music melody.

[0096] 205. Input the first rhythm vector, the chord vector sequence, and the first melody vector into the melody encoder to output the corresponding first musical melody, which represents the note, the start and end positions of the note, the pitch relationship between the notes, and the pitch of the note.

[0097] The music melody generation device inputs the chord vector sequence, the first rhythm vector sequence, and the first melody vector sequence into the melody encoder, and outputs the corresponding first music melody through sampling and encoding / decoding by the melody encoder. It can be understood that the first music melody represents all the characteristics of a complete piece of music, including notes, the start and end positions of each note, the pitch relationships between notes, and the pitch of each note.

[0098] Based on the description of step 203 or step 204, if the rhythm sequence predicted by the first rhythm vector sequence does not meet the requirements, the subsequent process of the music melody generation device can be as follows:

[0099] In one possible implementation, the music melody generation device inputs the chord vector sequence, the third rhythm vector sequence, and the first melody vector sequence into a melody encoder to output the second music melody.

[0100] In another possible implementation, the music melody generation device inputs the chord vector sequence, the fifth rhythm vector sequence, and the first melody vector sequence into the melody encoder to output the third music melody.

[0101] If the melody sequence predicted by the first melody vector sequence does not meet the requirements, the subsequent process of the music melody generation device can be as follows:

[0102] In one possible implementation, the music melody generation device inputs the chord vector sequence, the first rhythm vector sequence, and the fifth melody vector sequence into a melody encoder to output the fourth music melody.

[0103] In another possible implementation, the music melody generation device inputs the chord vector sequence, the first rhythm vector sequence, and the seventh melody vector sequence into the melody encoder to output the fifth music melody.

[0104] It is understandable that modifications to the rhythmic or melodic sequences at each stage will affect the final musical melody output.

[0105] Based on the above method embodiments, it can be seen that the process of generating a musical melody is divided into different steps to generate different music theory information, that is, the chords, rhythms and melodies of the musical melody are gradually obtained. Compared with the existing musical melody synthesis technology, the present invention provides more music theory information as prior information for the output of musical melody, thereby ensuring the generation of high-quality musical melodies.

[0106] The music melody generation device in this application is described in detail below. Please refer to [link / reference]. Figure 5 , Figure 5This is a schematic diagram of one embodiment of the music melody generation device in this application. The music melody generation device 20 includes:

[0107] The acquisition module 501 is used to acquire a chord progression sequence, wherein the chord progression sequence includes K chords, and K is an integer greater than 1;

[0108] The first conversion module 502 is used to convert the chord sequence into a chord vector sequence, wherein the chord vector sequence includes an encoding vector for each chord, and the encoding vector for each chord is obtained according to the context chord encoding of the chord;

[0109] The first processing module 503 is used to input the chord vector sequence to the rhythm encoder to output the corresponding first rhythm vector sequence, which represents the notes and the start and end positions of each note;

[0110] The second processing module 504 is used to input the first rhythm vector sequence and the chord vector sequence into the melody encoder to output the corresponding first melody vector sequence, wherein the first melody vector sequence represents the pitch relationship between the notes;

[0111] The third processing module 505 is used to input the first rhythm vector, the chord vector sequence and the first melody vector to the melody encoder to output the corresponding first musical melody, which represents the note, the start position and end position of the note, the pitch relationship between the notes and the pitch of the note.

[0112] This application provides a music melody generation device. Using this device, the music melody generation process is divided into different steps to generate different music theory information, that is, the chords, rhythms, and melody of the music melody are gradually acquired. Compared with existing music melody synthesis technologies, this invention provides more music theory information as prior information for music melody output, thereby ensuring the generation of high-quality music melodies.

[0113] Optionally, in the above Figure 5 Based on the corresponding embodiments, in another embodiment of the music melody generation device 20 provided in this application,

[0114] The first conversion module 502 is specifically used to obtain the context chord of each chord in the chord progression sequence using a bidirectional long short-term memory network (Bi-LSTM); and to encode each chord in the chord progression sequence according to the context chord to obtain the chord vector sequence.

[0115] This application provides a music melody generation device. Using this device, a Bi-LSTM network is employed to obtain the context chords of each chord in a chord progression sequence. Then, based on the context information, each chord in the chord progression sequence and other relevant information are encoded to obtain a chord vector sequence, thereby improving the correlation of the chord vector sequence and thus enhancing the quality of the music melody.

[0116] Optionally, in the above Figure 5 Based on the corresponding embodiments, another embodiment of the music melody generation device 20 provided in this application can be as follows: Figure 6 As shown,

[0117] The music melody generation device also includes a first prediction module 506, which is used to predict the first rhythm vector sequence to output a first rhythm sequence, the first rhythm sequence representing the note and the start and end positions of the note.

[0118] This application provides a music melody generation device. Using this device, the music melody generation device outputs a rhythm sequence, allowing the user to ascertain the quality of the rhythm sequence midway through generation. This enables the music melody to be corrected during the generation process, helping to improve the final quality of the generated music melody.

[0119] Optionally, in the above Figure 5 Based on the corresponding embodiments, another embodiment of the music melody generation device 20 provided in this application can be as follows: Figure 7 As shown,

[0120] The music melody generation device also includes a second conversion module 507, which is used to embed the first rhythm sequence into the embedding layer to convert it into a second rhythm vector sequence;

[0121] The first processing module 503 is further configured to input the chord vector sequence and the second rhythm vector sequence into the rhythm encoder to output the third rhythm vector sequence;

[0122] The second processing module 504 is further configured to input the chord vector sequence and the third rhythm vector sequence into the melody for encoder processing, so as to output the second melody vector sequence.

[0123] The third processing module 505 is further configured to input the chord vector sequence, the third rhythm vector sequence and the second melody vector sequence into the melody encoder to output the second musical melody.

[0124] This application provides a music melody generation device. Using this device, the music melody generation device outputs a rhythm sequence, allowing the user to manually intervene in the generation of the rhythm sequence. This enables the music melody to be corrected during the generation process, helping to improve the final quality of the generated music melody.

[0125] Optionally, in the above Figure 5 Based on the corresponding embodiments, another embodiment of the music melody generation device 20 provided in this application can be as follows: Figure 8 As shown,

[0126] The music melody generation device also includes a fourth processing module 508, which is used to respond to the first operation and modify the first rhythm sequence into a second rhythm sequence.

[0127] The third conversion module 509 is used to embed the second rhythm sequence into the embedding layer to convert it into a third rhythm vector sequence;

[0128] The first processing module 503 is further configured to input the chord vector sequence and the third rhythm vector sequence into the rhythm encoder to output the fourth rhythm vector sequence;

[0129] The second processing module 504 is further configured to input the chord vector sequence and the fourth rhythm vector sequence into the melody for encoder processing, so as to output the third melody vector.

[0130] The third processing module 505 is also used to input the chord vector sequence, the fourth rhythm vector sequence and the third melody vector sequence into the melody encoder to output the third musical melody.

[0131] This application provides a music melody generation device. Using this device, the music melody generation device outputs a rhythm sequence, allowing the user to manually intervene in the generation of the rhythm sequence. This enables the music melody to be corrected during the generation process, helping to improve the final quality of the generated music melody.

[0132] Optionally, in the above Figure 5 Based on the corresponding embodiments, another embodiment of the music melody generation device 20 provided in this application can be as follows: Figure 9 As shown, the music melody generation device also includes a second prediction module 510, which is used to predict the first melody vector sequence to output a first melody progression sequence, which represents the pitch relationship between the notes.

[0133] This application provides a music melody generation device. Using this device, the music melody generation device outputs a sequence of melodies, allowing the user to ascertain the quality of the sequence midway through generation. This enables the music melody to be corrected during the generation process, helping to improve the final quality of the generated music melody.

[0134] Optionally, in the above Figure 5 Based on the corresponding embodiments, another embodiment of the music melody generation device 20 provided in this application can be as follows: Figure 10 As shown,

[0135] The music melody generation device also includes a fourth conversion module 511, which is used to embed the first melody into the embedding layer as a sequence input to convert it into a fourth melody vector sequence;

[0136] The second processing module 504 is further configured to input the chord vector sequence, the first rhythm vector sequence and the fourth melody vector sequence into the melody for encoder to output the fifth melody vector sequence;

[0137] The third processing module 505 is also used to input the chord vector sequence, the first rhythm vector sequence and the fifth melody vector sequence into the melody encoder to output the fourth musical melody.

[0138] This application provides a music melody generation device. Using this device, the music melody generation device outputs a sequence of melodies, allowing the user to manually intervene in the generation of the melody sequence. This enables the music melody to be corrected during the generation process, helping to improve the final quality of the generated music melody.

[0139] Optionally, in the above Figure 5 Based on the corresponding embodiments, another embodiment of the music melody generation device 20 provided in this application can be as follows: Figure 11 As shown,

[0140] The music melody generation device also includes a fifth processing module 512, which is used to respond to the second operation and modify the first melody sequence into a second melody sequence.

[0141] The fifth conversion module 513 is used to embed the second melody into the embedding layer as a sequence input to convert it into a sixth melody vector sequence;

[0142] The second processing module 504 is further configured to input the chord vector sequence, the first rhythm vector sequence and the sixth melody vector sequence into the melody for encoder to output the seventh melody vector sequence;

[0143] The third processing module 505 is also used to input the chord vector sequence, the first rhythm vector sequence and the seventh melody vector sequence into the melody encoder to output the fifth musical melody.

[0144] This application provides a music melody generation device. Using this device, the music melody generation device outputs a sequence of melodies, allowing the user to manually intervene in the generation of the melody sequence. This enables the music melody to be corrected during the generation process, helping to improve the final quality of the generated music melody.

[0145] Optionally, in the above Figure 5 Based on the corresponding embodiments, in another embodiment of the music melody generation device 20 provided in this application,

[0146] The second processing module 504 is specifically used to fuse the chord vector sequence and the first rhythm vector sequence to obtain a first input vector; and to input the first input vector into the rhythm encoder to output the corresponding first melody vector sequence.

[0147] This application provides a music melody generation device. By using this device, different vectors are fused into the input, thereby improving the accuracy of the input vectors and thus enhancing the quality of the music melody.

[0148] Optionally, in the above Figure 5 Based on the corresponding embodiments, in another embodiment of the music melody generation device 20 provided in this application,

[0149] The third processing module 505 is specifically used to fuse the chord vector sequence, the first rhythm vector sequence and the first melody vector sequence to obtain a second input vector; and to input the second input vector into the melody encoder to output the first musical melody.

[0150] This application provides a music melody generation device. By using this device, different vectors are fused into the input, thereby improving the accuracy of the input vectors and thus enhancing the quality of the music melody.

[0151] Optionally, in the above Figure 5 Based on the corresponding embodiments, in another embodiment of the music melody generation device 20 provided in this application, the rhythm encoder, the melody encoder and the melody encoder are encoders of a natural language neural network.

[0152] This application provides a music melody generation device. Using this device, a natural language neural network is employed to generate the music melody, thereby improving the music melody generation rate.

[0153] Optionally, in the above Figure 5 Based on the corresponding embodiments, in another embodiment of the music melody generation device 20 provided in this application,

[0154] The natural language neural network used is RNN, Transformer, GTP, or BERT.

[0155] This application provides a music melody generation device. Using this device, and employing multiple language neural networks, the feasibility of the solution is improved.

[0156] Optionally, in the above Figure 5 Based on the corresponding embodiments, in another embodiment of the music melody generation device 20 provided in this application, the chord progression sequence is a pop music chord sequence or a classical music chord sequence.

[0157] This application provides a music melody generation device. Using this device increases the diversity of chord progression sequences, thereby improving the feasibility of the solution.

[0158] The music melody generation device provided in this application can be used on a server; please refer to [link / reference]. Figure 12 , Figure 12 This is a schematic diagram of a server structure provided in an embodiment of this application. The server 300 can vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 322 (e.g., one or more processors) and memory 332, and one or more storage media 330 (e.g., one or more mass storage devices) for storing application programs 342 or data 344. The memory 332 and storage media 330 can be temporary or persistent storage. The program stored in the storage media 330 may include one or more modules (not shown in the diagram), each module may include a series of instruction operations on the server. Furthermore, the CPU 322 may be configured to communicate with the storage media 330 and execute the series of instruction operations stored in the storage media 330 on the server 300.

[0159] Server 300 may also include one or more power supplies 326, one or more wired or wireless network interfaces 350, one or more input / output interfaces 358, and / or one or more operating systems 341, such as Windows Server. TM Mac OS X TM Unix TM Linux TM FreeBSD TM etc.

[0160] The steps performed by the music melody generation device in the above embodiments can be based on this. Figure 12 The server structure shown.

[0161] The music melody generation device provided in this application can be used in terminal devices; please refer to [link / reference]. Figure 13 For ease of explanation, only the parts relevant to the embodiments of this application are shown. For specific technical details not disclosed, please refer to the method section of the embodiments of this application. In the embodiments of this application, a personal computer is used as an example for illustration:

[0162] Figure 13 This is a block diagram illustrating a portion of the structure of a personal computer related to the terminal device provided in an embodiment of this application. (Reference) Figure 13 The personal computer includes components such as: radio frequency (RF) circuitry 410, memory 420, input unit 430, display unit 440, sensor 450, audio circuitry 460, wireless fidelity (WiFi) module 470, processor 480, and power supply 490. Those skilled in the art will understand that... Figure 13 The personal computer architecture shown does not constitute a limitation on the personal computer and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0163] The following is combined Figure 13 A detailed introduction to the various components of a personal computer:

[0164] RF circuit 410 can be used for receiving and transmitting signals during information transmission or network connection processes. Specifically, it receives downlink information from the router and processes it on the processor 480; additionally, it transmits uplink data to the router. Typically, RF circuit 410 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low-noise amplifier (LNA), a duplexer, etc. Furthermore, RF circuit 410 can also communicate wirelessly with the network and other devices. The aforementioned wireless communication can use any communication standard or protocol, including but not limited to Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Message Service (SMS), etc.

[0165] The memory 420 can be used to store software programs and modules. The processor 480 executes various functional applications and data processing of the personal computer by running the software programs and modules stored in the memory 420. The memory 420 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the personal computer (such as audio data, telephone directory, etc.). In addition, the memory 420 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0166] The input unit 430 can be used to receive input numerical or character information, and to generate key signal inputs related to user settings and function control of the personal computer. Specifically, the input unit 430 may include a touch panel 431 and other input devices 432. The touch panel 431, also known as a touch screen, can collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel 431), and drive the corresponding connection devices according to a pre-set program. Optionally, the touch panel 431 may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch position and the signal generated by the touch operation, and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device, converts it into touch point coordinates, sends it to the processor 480, and can receive and execute commands sent by the processor 480. In addition, the touch panel 431 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel 431, the input unit 430 may also include other input devices 432. Specifically, other input devices 432 may include, but are not limited to, one or more of the following: physical keyboard, function keys (such as volume control buttons, power buttons, etc.), trackball, mouse, joystick, etc.

[0167] Display unit 440 can be used to display information input by the user or information provided to the user, as well as various menus of a personal computer. Display unit 440 may include a display panel 441, optionally configured as a liquid crystal display (LCD), organic light-emitting diode (OLED), or similar form. Further, a touch panel 431 may cover the display panel 441. When the touch panel 431 detects a touch operation on or near it, it transmits the information to the processor 480 to determine the type of touch event. Subsequently, the processor 480 provides corresponding visual output on the display panel 441 based on the type of touch event. Although in Figure 13 In this embodiment, the touch panel 431 and the display panel 441 are two separate components to realize the input and output functions of the personal computer. However, in some embodiments, the touch panel 431 and the display panel 441 can be integrated to realize the input and output functions of the personal computer.

[0168] The personal computer may also include at least one sensor 450, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel 441 according to the ambient light level, and the proximity sensor can turn off the display panel 441 and / or backlight when the personal computer display is closed with the host unit. As a type of motion sensor, an accelerometer sensor can detect the magnitude of acceleration in various directions (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that recognize the posture of the personal computer (such as landscape / portrait switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc. Other sensors that may be configured in the personal computer, such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors, will not be described in detail here.

[0169] Audio circuit 460, speaker 461, and microphone 462 provide an audio interface between the user and the personal computer. Audio circuit 460 converts received audio data into electrical signals and transmits them to speaker 461, where speaker 461 converts them into sound signals for output. On the other hand, microphone 462 converts collected sound signals into electrical signals, which are received by audio circuit 460, converted into audio data, and then output to processor 480 for processing. The audio data is then transmitted via RF circuit 410 to, for example, another personal computer, or output to memory 420 for further processing.

[0170] WiFi is a short-range wireless transmission technology. Personal computers using a WiFi module 470 can help users send and receive emails, browse web pages, and access streaming media, providing wireless broadband internet access. Although Figure 13 WiFi module 470 is shown, but it is understood that it is not an essential component of a personal computer and can be omitted as needed without changing the nature of the invention.

[0171] Processor 480 is the control center of the personal computer, connecting various parts of the personal computer through various interfaces and lines. It performs various functions and processes data by running or executing software programs and / or modules stored in memory 420, and by calling data stored in memory 420, thereby providing overall monitoring of the personal computer. Optionally, processor 480 may include one or more processing units; optionally, processor 480 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the aforementioned modem processor may also not be integrated into processor 480.

[0172] The personal computer also includes a power supply 490 (such as a battery) that supplies power to the various components. Optionally, the power supply can be logically connected to the processor 480 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system.

[0173] Although not shown, personal computers may also include cameras, Bluetooth modules, etc., which will not be described in detail here.

[0174] The steps performed by the music melody generation device in the above embodiments can be based on this. Figure 13 The terminal device structure is shown.

[0175] This application also provides a computer-readable storage medium storing a computer program that, when run on a computer, causes the computer to perform the methods described in the foregoing embodiments.

[0176] This application also provides a computer program product including a program, which, when run on a computer, causes the computer to perform the methods described in the foregoing embodiments.

[0177] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0178] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.

[0179] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0180] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0181] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0182] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit it. Although this application 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 of the technical features. Such 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 this application.

Claims

1. A method of generating a musical melody, characterized by, include: Obtain a chord progression sequence, wherein the chord progression sequence includes K chords, and K is an integer greater than 1; The chord sequence is converted into a chord vector sequence, wherein the chord vector sequence includes an encoding vector for each chord, and the encoding vector for each chord is obtained based on the context chord encoding of the chord; The chord vector sequence is input to the rhythm encoder to output the corresponding first rhythm vector sequence, which represents the notes and the start and end positions of each note; The first rhythm vector sequence and the chord vector sequence are input into the melody encoder to output the corresponding first melody vector sequence, wherein the first melody vector sequence represents the pitch relationship between the notes; The second input vector is obtained by fusing the chord vector sequence, the first rhythm vector sequence, and the first melody vector sequence. The second input vector is input into the melody encoder to output the corresponding first musical melody, wherein the first musical melody represents the note, the start and end positions of the note, the pitch relationship between the notes, and the pitch of the note.

2. The method according to claim 1, characterized in that, The step of converting the chord sequence into a chord vector sequence includes: The context chords of each chord in the chord progression sequence are obtained using a bidirectional long short-term memory network (Bi-LSTM). The chord vector sequence is obtained by encoding each chord in the sequence according to the context chord.

3. The method according to claim 1, characterized in that, After inputting the chord vector sequence into the rhythm encoder to output the corresponding first rhythm vector sequence, the method further includes: The first rhythm vector sequence is predicted to output a first rhythm progression sequence, which represents the note and the start and end positions of the note.

4. The method according to claim 3, characterized in that, The method further includes: The first rhythm is input as a sequence and embedded in the embedding layer to be converted into a second rhythm vector sequence; The chord vector sequence and the second rhythm vector sequence are input into the rhythm encoder to output the third rhythm vector sequence; The chord vector sequence and the third rhythm vector sequence are input into the melody for encoder to output the second melody vector sequence; The chord vector sequence, the third rhythm vector sequence, and the second melody vector sequence are input into the melody encoder to output the second musical melody.

5. The method according to claim 3, characterized in that, The method further includes: In response to the first operation, the first rhythm sequence is modified to the second rhythm sequence; The second rhythm is input as a sequence and embedded in the embedding layer to be converted into a third rhythm vector sequence; The chord vector sequence and the third rhythm vector sequence are input into the rhythm encoder to output the fourth rhythm vector sequence; The chord vector sequence and the fourth rhythm vector sequence are input into the melody for encoder to output the third melody vector sequence; The chord vector sequence, the fourth rhythm vector sequence, and the third melody vector sequence are input into the melody encoder to output the third musical melody.

6. The method according to claim 1, characterized in that, After inputting the first rhythm vector sequence and the chord vector sequence into the melody encoder to output the corresponding first melody vector sequence, the method further includes: The first melody vector sequence is predicted to output a first melody progression sequence, which represents the pitch relationship between the notes.

7. The method according to claim 6, characterized in that, The method further includes: The first melody is input as a sequence and embedded in the embedding layer to be converted into a fourth melody vector sequence; The chord vector sequence, the first rhythm vector sequence, and the fourth melody vector sequence are input into the melody for encoder to output the fifth melody vector sequence; The chord vector sequence, the first rhythm vector sequence, and the fifth melody vector sequence are input into the melody encoder to output the fourth musical melody.

8. The method according to claim 6, characterized in that, The method further includes: In response to the second operation, the sequence of the first melody is modified to the sequence of the second melody. The second melody is input as a sequence and embedded in the embedding layer to be converted into a sixth melody vector sequence; The chord vector sequence, the first rhythm vector sequence, and the sixth melody vector sequence are input into the melody for encoder to output the seventh melody vector sequence; The chord vector sequence, the first rhythm vector sequence, and the seventh melody vector sequence are input into the melody encoder to output the fifth musical melody.

9. The method according to any one of claims 1 to 8, characterized in that, The step of inputting the first rhythm vector sequence and the chord vector sequence into the melody encoder to output the corresponding first melody vector sequence includes: The first input vector is obtained by fusing the chord vector sequence and the first rhythm vector sequence; The first input vector is input into the melody and encoded to output the corresponding first melody vector sequence.

10. The method according to any one of claims 1 to 8, characterized in that, The rhythm encoder, the melody encoder, and the melody encoder are encoders of a natural language neural network.

11. The method according to claim 10, characterized in that, The natural language neural network consists of a recurrent neural network (RNN), a transformer (Transformer), a generative pre-trained GPT, and a transformer-based bidirectional encoder-trained BERT.

12. A musical melody generation device, characterized in that, include: An acquisition module is used to acquire a chord progression sequence, wherein the chord progression sequence includes K chords, and K is an integer greater than 1; The first conversion module is used to convert the chord sequence into a chord vector sequence, wherein the chord vector sequence includes an encoding vector for each chord, and the encoding vector of the chord is obtained according to the context chord encoding of the chord; The first processing module is used to input the chord vector sequence to the rhythm encoder to output a corresponding first rhythm vector sequence, wherein the first rhythm vector sequence represents the notes and the start and end positions of each note; The second processing module is used to input the first rhythm vector sequence and the chord vector sequence into the melody encoder to output the corresponding first melody vector sequence, wherein the first melody vector sequence represents the pitch relationship between the notes; The third processing module is used to fuse the chord vector sequence, the first rhythm vector sequence, and the first melody vector sequence to obtain a second input vector; and input the second input vector into the melody encoder to output the corresponding first musical melody, wherein the first musical melody represents the note, the start and end positions of the note, the pitch relationship between the notes, and the pitch of the note.

13. The apparatus according to claim 12, characterized in that, The first conversion module is specifically used for: The context chords of each chord in the chord progression sequence are obtained using a bidirectional long short-term memory network (Bi-LSTM). The chord vector sequence is obtained by encoding each chord in the sequence according to the context chord.

14. The apparatus according to claim 12, characterized in that, The device further includes: The first prediction module is used to predict the first rhythm vector sequence to output a first rhythm sequence, wherein the first rhythm sequence represents the note and the start and end positions of the note.

15. The apparatus according to claim 14, characterized in that, The device further includes: The second conversion module is used to embed the first rhythm sequence into the embedding layer to convert it into a second rhythm vector sequence. The first processing module is further configured to input the chord vector sequence and the second rhythm vector sequence into the rhythm encoder to output a third rhythm vector sequence; The second processing module is further configured to input the chord vector sequence and the third rhythm vector sequence into the melody for encoder processing, so as to output a second melody vector sequence; The third processing module is further configured to input the chord vector sequence, the third rhythm vector sequence, and the second melody vector sequence into the melody encoder to output a second musical melody.

16. A computer device, characterized in that, include: Memory, processor, and bus system; The memory is used to store programs; The processor is configured to execute a program in the memory, and the processor is configured to execute the method of any one of claims 1 to 11 according to instructions in the program code; The bus system is used to connect the memory and the processor to enable communication between the memory and the processor.

17. A computer-readable storage medium comprising instructions that, when executed on a computer, cause the computer to perform the method as claimed in any one of claims 1 to 11.

18. A computer program product, characterized in that, The method includes computer instructions stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions to cause the computer device to perform the method as described in any one of claims 1 to 11.