A MIDI music generation method, device and terminal equipment

By preprocessing MIDI music data and training models to generate new MIDI music, the problems of low fluency and harmony in existing technologies are solved, and the diversity and harmony of music are improved.

CN115798440BActive Publication Date: 2025-12-05HEBEI UNIV OF SCI & TECH +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211404161.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-10
Publication Date
2025-12-05
Estimated Expiration
2042-11-10

AI Technical Summary

Technical Problem

Existing technologies for MIDI music generation suffer from low fluency and harmony, as well as a lack of musical diversity. In particular, they are less effective in chord harmony, and the notes generated by the REMI method are scattered and lack overall coherence.

Method used

By preprocessing the original MIDI music data, separating the note track and chord track, using MCST storage and digital mapping processing, training the music segment timing learning network and the similar chord replacement network, generating intermediate MCST segments and performing chord replacements, and generating new MIDI music.

Benefits of technology

It improves the smoothness and harmony of music, enriches the diversity of music, and generates music that is closer to the real score, with neat chords and melodies and rich chord variations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115798440B_ABST
    Figure CN115798440B_ABST
Patent Text Reader

Abstract

The application is suitable for the technical field of computers, and provides a MIDI music generation method, device and terminal equipment, which comprises the following steps: preprocessing original MIDI music data to obtain a note track and a chord track; obtaining MCST elements and chord elements based on the note track and the chord track; obtaining a first prediction model and a second prediction model based on the MCST elements and the chord elements; inputting a random MIDI music segment into the first prediction model to generate an intermediate MCST segment; inputting the generated intermediate MCST segment into the second prediction model to perform chord replacement and generate new MIDI music. The application can improve the fluency and harmony of music and also enrich the diversity of music.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of computers, and particularly relates to a MIDI music generation method and device, a terminal and a computer readable storage medium. BACKGROUND

[0002] At present, people often generate music data through computer algorithms, but the generated music is basically based on music theory rules and is too stereotyped and lacks diversity. In the prior art, the LSTM-GEN (music generation model based on the LSTM method) music generation model and the REMI music event storage method are often used, however, the LSTM-GEN and REMI have low performance in chord harmony, and the notes generated by the REMI method are scattered and lack integrity. In addition, using the pitch method to record chords will greatly increase the calculation difficulty. In real life, a song can be adapted to multiple tempos, and there is no strong correlation between tempos and notes. The existing model generally processes notes and tempos as associated factors at the same time, which further affects the harmony of the generated music.

[0003] In summary, the existing disclosed technologies have the problems of low fluency and harmony of music and lack of diversity of music. In view of these problems, it is necessary to optimize the MIDI (Musical Instrument Digital Interface) music generation technology. SUMMARY

[0004] Therefore, the present application provides a MIDI music generation method, device and terminal device, which can improve the fluency and harmony of music.

[0005] The first aspect of the embodiment of the present application provides a MIDI music generation method, comprising:

[0006] The original MIDI music data is preprocessed to obtain a note track and a chord track;

[0007] The note track and the chord track are subjected to melody-chord separation transformation MCST storage and digital mapping processing to obtain MCST elements, and the chord track is subjected to digital mapping to obtain chord elements;

[0008] The music segment time sequence learning network is trained through the MCST elements to obtain a first prediction model;

[0009] The similar chord replacement network is trained through the chord elements to obtain a second prediction model;

[0010] The random MIDI music segment is input into the first prediction model to generate an intermediate MCST segment, and the generated intermediate MCST segment is input into the second prediction model to replace the chord to generate new MIDI music.

[0011] In some embodiments based on the first aspect, the MCST storage of the note track and the chord track comprises:

[0012] The MCST element takes an eighth note length as a basic unit;

[0013] The chord information in the chord track is obtained, and the chord information is split into multiple eighth notes;

[0014] The note information in the note track is obtained, and the note information is an eighth note;

[0015] The note information is spliced with the split chord information, and stored as the smallest storage unit of the MCST storage.

[0016] In some embodiments based on the first aspect, the training of the music segment time sequence learning network through the MCST element to obtain a first prediction model comprises:

[0017] The MCST element is put into the music segment time sequence learning network, N MCST elements are a group, the MCST element of the previous group is used to predict the N+1 MCST element, and the training is circular; the N MCST elements are an integer greater than 1 MCST elements;

[0018] The music segment time sequence learning network is a neural sequence model with a self-attention mechanism.

[0019] In some embodiments based on the first aspect, the training of the similar chord replacement network through the chord element to obtain a second prediction model comprises:

[0020] The chord information of the chord track is obtained, the chord information contains a chord progression, and the second prediction model is trained through multiple chord progressions;

[0021] The similar chord replacement network is a word2vec model.

[0022] In some embodiments based on the first aspect, the input of the random MIDI music segment into the first prediction model to generate an intermediate MCST segment comprises:

[0023] The first prediction model is loaded, the random MIDI music segment is input into the first prediction model, converted MCST data format is obtained, and a new music segment is generated.

[0024] According to the first aspect, in some embodiments, the generated intermediate MCST segment is input into the second prediction model, chord substitution is performed, and new MIDI music is generated, including:

[0025] The second prediction model is loaded, the chord part of the newly generated music segment is taken out, repeated chords in the chord part are recorded, the second prediction model is used to perform chord substitution on the repeated chords, the substituted chords are stored in the chord track of the newly generated music segment, and new MIDI music is generated.

[0026] According to the first aspect, in some embodiments, an emotion selection label is set for the second prediction model, and the setting of the emotion selection label includes:

[0027] Grouping of major chords and minor chords is set; if the random MIDI music style is positive expression, major chords are selected to replace the repeated chords, and if the random MIDI music style is melancholy expression, minor chords are selected to replace the repeated chords.

[0028] After chord substitution, chord similarity calculation is performed on the repeated chords and the substituted chords.

[0029] When the chord similarity exceeds a threshold value, the major chords and the minor chords are reselected for substitution.

[0030] The second aspect of the embodiment of the application provides a MIDI music generation device, including:

[0031] A preprocessing module is configured to preprocess the original MIDI music data to obtain a note track and a chord track, perform MCST storage and digital mapping processing on the note track and the chord track to obtain MCST elements, and perform digital mapping on the chord track to obtain chord elements.

[0032] A training module is configured to train a music segment time sequence learning network through the MCST elements to obtain a first prediction model, and train a similar chord substitution network through the chord elements to obtain a second prediction model.

[0033] A generation module is configured to input a random MIDI music segment into the first prediction model to generate an intermediate MCST segment, input the generated intermediate MCST segment into the second prediction model, perform chord substitution, and generate new MIDI music.

[0034] The third aspect of the embodiments of the present application provides a terminal, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method according to any one of the first aspect when executing the computer program.

[0035] The fourth aspect of the embodiments of the present application provides a computer readable storage medium, which stores a computer program, wherein the computer program is executable by a processor to implement the steps of the method according to any one of the first aspect.

[0036] The present application has the beneficial effects compared with the prior art: the embodiments of the present application provide a MIDI music generation method, device and terminal equipment, the method comprising: preprocessing original MIDI music data to obtain note tracks and chord tracks; obtaining MCST elements and chord elements based on the note tracks and the chord tracks; obtaining a first prediction model and a second prediction model based on the MCST elements and the chord elements; inputting a random MIDI music segment into the first prediction model to generate an intermediate MCST segment, inputting the generated intermediate MCST segment into the second prediction model to replace chords, and generating new MIDI music. The present application can improve the fluency and harmony of music, and also enrich the diversity of music. BRIEF DESCRIPTION OF DRAWINGS

[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or prior art description will be briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0038] Figure 1 is an implementation flowchart of a MIDI music generation method provided by the embodiments of the present application;

[0039] Figure 2 is a detail diagram of MCST storage method provided by the embodiments of the present application;

[0040] Figure 3 is a piano-roll diagram and a staff diagram generated by each model provided by the embodiments of the present application;

[0041] Figure 4 is a detail diagram of music segment time sequence learning training provided by the embodiments of the present application;

[0042] Figure 5 is a size and chord distribution diagram provided by the embodiments of the present application;

[0043] Figure 6is a music generation process diagram provided by an embodiment of the present application;

[0044] Figure 7 is a structural schematic diagram of a MIDI music generation device provided by an embodiment of the present application;

[0045] Figure 8 is a schematic diagram of a terminal provided by an embodiment of the present application. DETAILED DESCRIPTION

[0046] In the following description, for the purpose of explanation and not limitation, specific details are set forth, such as particular system configurations, techniques, etc., in order to provide a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application can be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.

[0047] In addition, the terms "first", "second", and the like are used only for the purpose of description, and cannot be understood as indicating or implying relative importance, and cannot be understood as explicitly or implicitly indicating the number of the technical features indicated. In the description of the present application, the meaning of "a plurality of" is three or more, unless otherwise specifically limited.

[0048] In order to make the purpose, technical scheme and advantages of the present application clearer, specific embodiments will be described below with reference to the accompanying drawings.

[0049] Referring to Figure 1 which shows an implementation flowchart of a MIDI music generation method provided by an embodiment of the present application, and is described in detail as follows:

[0050] In step 101, the original MIDI music data is preprocessed to obtain a note track and a chord track, the note track and the chord track are subjected to melody and chord separation transformation MCST storage and digital mapping processing to obtain MCST elements, and the chord track is subjected to digital mapping to obtain chord elements.

[0051] In some possible implementation embodiments, the MCST storage of the note track and the chord track includes:

[0052] The MCST element takes an eighth note duration as a basic unit.

[0053] The chord information in the chord track is obtained, and the chord information is split into a plurality of eighth notes.

[0054] The note information in the note track is obtained, and the note information is an eighth note.

[0055] The note information is spliced with the split chord information and stored as a minimum storage unit of MCST.

[0056] Exemplarily, a brand-new music sequence storage mode is adopted. The coordination of the left hand and the right hand in piano playing is crucial. The smoothness and harmony of music are also reflected in the matching of melody and chord. Therefore, the audio stream format in the original MIDI music is abandoned. The melody track and the chord track are separately extracted and spliced in sequence.

[0057] Exemplarily, as shown in Figure 2 A chord is two demisemiquavers, and each demisemiquaver corresponds to four eighth notes. When stored, the chord and the note are spliced and stored as a brand-new minimum storage unit. In subsequent neural network learning, the units corresponding to the chord and the melody can be learned at the same time, thereby improving the harmony of the generated piano music.

[0058] Specific scheme:

[0059] (1) Note extraction and storage: The music21 toolkit is used to obtain the offset displacement distance (displacement time length from the start of the song) information of each note.

[0060] (2) Chord extraction and storage: A chord dictionary is defined using music theory knowledge, such as “Chord Cmaj”: “Note C, Note E, Note G”. When the extracted notes at a certain time are Note C, Note E, and Note G, they are stored as Chord Cmaj. Other chord processing schemes are consistent. Note C, Note E, and Note G are do, mi, and so, which correspond to the major chord Cmaj.

[0061] (3) MCST storage: When a new chord appears, it is represented as Chord Star. When the note duration of the chord has not ended, it is represented as Chord Keep. As shown in Figure 2 A demisemiquaver chord is divided into four parts: chord star, chord keep, chord keep, and chord keep. Each part of the chord is connected with the note at the corresponding time to obtain the MCST basic unit of <Chord xx+Note xx>. The storage unit is one time grid of eighth note.

[0062] Exemplarily, the chord, melody music harmony evaluation index, expert evaluation objective evaluation index, and sheet music station subjective evaluation index of the LSTM-GEN model and REMI and MCST are evaluated and compared. (See Table 1)

[0063] Among them, the LSTM-GEN model is a music generation model based on the LSRM method, which learns long-dependent melody changes by using an LSTM network, predicts future notes by giving a music sequence, and finally generates a whole piece of music. At the same time, it separates the music measures and tries to eliminate the melody changes between different measures.

[0064] REMI is a brand new music event storage method, which splits the pitch, note duration, displacement and other information in the original MIDI music, and then recombines the pitch and rhythm of the note as a basic unit, puts it into the Transformer network, and lets the neural network predict each combination unit instead of predicting a single note.

[0065] Table 1

[0066] Chord Melody Expert Synthesis LSTM-GEN 0.422 0.034 1.32 1.776 REMI 0.582 0.074 1.71 2.366 MCST 0.660 0.042 1.82 2.522 MCST (chord replace) 0.745 0.042 1.93 2.717

[0067] Table 1 shows the comparison results of the present application and the baseline method on the Classic Piano dataset, where LSTM-GEN and REMI are baseline results, and MCST and MCST(chord replace) are proposed model results, which can draw the following conclusions:

[0068] The proposed model has a large improvement in chord harmony on the Classic Piano dataset, and the chord harmony is also not far behind the baseline model. In addition, when the music college experts conduct blind listening evaluation, the proposed MCST method achieves higher scores, and the performance is further improved when the Chord2vec chord replacement method is used.

[0069] By comparing the baseline model with the proposed model and the visualization of the real music score, observing the piano-roll graph and the staff generated by each model (see Figure 3 ), it can be found that the REMI method generates scattered notes and poor overall performance, the proposed MCST method has a neat chord and melody, and the MCST(chord replace) method uses the chord replacement method to make the chord change more abundant. The music scores generated by MCST and MCST(chord replace) are closer to the real music score.

[0070] For example, the mainstream piano MIDI music dataset Classic Piano is used for experiments, and the experimental results are shown in Table 2. It can be found that it has a significant improvement in the "Chord" score (up by 28%), which indicates that the proposed model has more abundant chords. In addition, compared with the "Experts" score, the improvement of the MCSF method is 13%, which means that the rich chord changes are more conducive to real music, and the MCSF method can learn interactive music knowledge.

[0071] Table 2

[0072]

[0073] In step 102, the music segment timing learning network is trained by the MCST element to obtain a first prediction model, and the similar chord replacement network is trained by the chord element to obtain a second prediction model.

[0074] In some possible implementation modes, the training of the music segment timing learning network by the MCST element to obtain the first prediction model comprises:

[0075] The MCST element is put into the music segment timing learning network, N MCST elements form a group, the Nth MCST element is predicted by the previous group of MCST elements, and the training is circular, N is an integer greater than 1.

[0076] The music segment timing learning network is a neural sequence model with a self-attention mechanism.

[0077] For example, as shown in Figure 2 Each row of chord and note combination (for example, C3, E3, D3 and Chord starNote A3) is regarded as an element, that is, an MCST element, N (N is greater than 1) elements form a group, the Nth element is predicted by the previous N elements, and the position information of the transformer and the self-supervised attention mechanism are used for circular training (see Figure 4 ), to obtain a main melody pre-training model, that is, a first prediction model.

[0078] The first prediction model contains pitch and length information, and the MCST element is equal in length. Compared with taking a word as a basic unit, taking the MCST element as a basic unit has better integrity, so that the corresponding relationship between notes and chords is not easily damaged.

[0079] In some possible implementation modes, the training of the similar chord replacement network by the chord element to obtain the second prediction model comprises:

[0080] The chord information of the chord track is obtained again, the chord information contains chord progression, and the second prediction model is obtained by training the chord progression.

[0081] The similar chord replacement network is a word2vec model.

[0082] For example, the chord information in the original MIDI file is retrieved again, and the probabilities of the first 8 chords are counted. The C chord (0.4.7) accounts for nearly half of the chord quantity, resulting in an excessive influence of the C chord on the training result. In addition, the C chord is a basic chord and cannot enrich the diversity of the music. Therefore, when the C chord appears continuously, a chord of the same family is used to replace the chord.

[0083] Based on the Chord2vec model, all chords in the music library are obtained and the frequencies of each chord are counted. A candidate chord pool is generated by the trained pre-trained model, that is, a plurality of similar chords are obtained for a given chord. Meanwhile, rules are added to set 35 replacement chords according to music theory knowledge (see Table 3), and the model prediction and rule method are used for chord replacement.

[0084] In order to highlight the emotional expression of music, the second prediction model is set with an emotional selection label, and the major and minor chords are grouped. In positive expression, Major, 7, M7, etc. bright chords can be selected, while in melancholy expression, minor, m7, dim7, etc. chords can be replaced (see Table 4). Figure 5 ).

[0085] Among them, the positive expression and the expression due to the expression of the music performance style.

[0086] Table 3

[0087]

[0088] After the chord replacement, the chord similarity of the repeated chords and the replaced chords is calculated.

[0089] When the chord similarity exceeds the threshold value, the major chord or the minor chord is selected to replace the repeated chord. The threshold value sets a similarity range that allows replacement. The larger the threshold value range, the higher the randomness of the replacement, and the harmony of the corresponding song will decrease.

[0090] In step 103, the random MIDI music segment is input into the first prediction model to generate an intermediate MCST segment, and the generated intermediate MCST segment is input into the second prediction model to replace the chord and generate a new MIDI music.

[0091] In some possible implementation manners, inputting the random MIDI music segment into the first prediction model to generate an intermediate MCST segment, inputting the generated intermediate MCST segment into the second prediction model to replace the chord and generate a new MIDI music includes:

[0092] Load the first prediction model and the second prediction model, input the random MIDI music segment into the first prediction model, get the converted MCST data format, and generate a new music segment.

[0093] Take out the chord part of the newly generated music segment, record the repeated chords in the chord part, replace the repeated chords with the second prediction model, and store the chord part of the newly generated music segment again to generate new MIDI music.

[0094] In some possible implementation embodiments, the newly generated MIDI music is optimized, and the optimization process includes:

[0095] The chord style is selected according to the major and minor parameters, and different emotional style music can be output according to different emotional expression parameters. The temperature randomness setting is used to improve the degree of freedom of the music and generate more realistic music. Experiments show that a relatively complete music can be generated when the prediction coefficient is selected between 0.5 and 2.0. When the prediction coefficient is lower, the generated music segment is more similar to the original data set. When the coefficient increases, the prediction randomness is higher. The rhythm change, random degree, instrument selection and performance speed of the music are all set with customizable parameters to maximize the richness of music expression.

[0096] For example, the music generation process is shown in Figure 6 .

[0097] It should be understood that the size of the serial number of each step in the above embodiments does not mean the order of execution. The execution order of each process should be determined according to its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0098] In order to make the technical problems, technical solutions and beneficial effects of the present application clearer, the present application will be further described in detail below in combination with the drawings and examples. It should be understood that the specific examples described herein are only used to explain the present application and do not limit the present application.

[0099] The following is an embodiment of the device of the present application. For details not described in detail, reference can be made to the corresponding method embodiments described above.

[0100] Figure 7 A structure schematic diagram of a MIDI music generation device provided by an embodiment of the present application is shown, which includes a preprocessing module 701, a training module 702 and a generation module 703.

[0101] The preprocessing module 701 is configured to preprocess original MIDI music data to obtain a note track and a chord track, perform MCST storage and digital mapping processing on the note track and the chord track to obtain MCST elements, and perform digital mapping on the chord track to obtain chord elements.

[0102] In one embodiment, one chord is two demisemiquavers, each of which corresponds to four eighth notes, and the chord and the notes are spliced to form a new minimum storage unit for storage (see Figure 2 ). In subsequent neural network learning, the units corresponding to the chord and the melody can be learned at the same time, thereby improving the harmony of the generated piano music.

[0103] The training module 702 is configured to train a music segment time sequence learning network through the MCST elements to obtain a first prediction model, and train a similar chord replacement network through the chord elements to obtain a second prediction model.

[0104] In one embodiment, the music segment time sequence learning network is a neural sequence model with a self-attention mechanism.

[0105] In one embodiment, the first prediction model contains pitch and length information.

[0106] In one embodiment, the similar chord replacement network is a word2vec model.

[0107] The generation module 703 is configured to input a random MIDI music segment into the first prediction model to generate an intermediate MCST segment, input the intermediate MCST segment into the second prediction model to replace chords, and generate new MIDI music. The process of generating new MIDI music is described with reference to Figure 6 .

[0108] Figure 8 is a schematic diagram of a terminal according to an embodiment of the present application. As shown in Figure 8 , the terminal 8 of this embodiment includes a processor 80, a memory 81, and a computer program 82 stored in the memory 81 and executable on the processor 80. The processor 80 implements the steps in each of the above MIDI music generation method embodiments when executing the computer program 82, such as the steps 101 to 103 shown in Figure 1 . Alternatively, the processor 80 implements the functions of each module / unit in each of the above device embodiments when executing the computer program 82, such as the functions of the modules 701 to 703 shown in Figure 7 .

[0109] The computer program 82 can be segmented into one or more modules / units which are stored in the memory 81 and executed by the processor 80 to accomplish the present application. The one or more modules / units can be a series of computer program instruction segments capable of accomplishing specific functions, which are used to describe the execution process of the computer program 82 in the terminal 8. For example, the computer program 82 can be segmented into one or more modules / units which are stored in the memory 81 and executed by the processor 80 to accomplish the present application. The one or more modules / units can be a series of computer program instruction segments capable of accomplishing specific functions, which are used to describe the execution process of the computer program 82 in the terminal device 8. For example, the computer program 82 can be segmented into a preprocessing module, a first training module, a second training module, and a generating module.

[0110] The terminal 8 can be a desktop computer, a notebook computer, a palm computer, a cloud server, and the like. The terminal can include, but is not limited to, the processor 80, the memory 81. Those skilled in the art can understand that the terminal 8 can include more or less components, or combine certain components, or different components, for example, the terminal can also include an input / output device, a network access device, a bus, and the like. Figure 8 The terminal 8 is only an example and does not constitute a limitation on the terminal 8, and can include more or less components than the illustration, or combine certain components, or different components, for example, the terminal can also include an input / output device, a network access device, a bus, and the like.

[0111] The processor 80 can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, and the like. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor.

[0112] The memory 81 can be an internal storage unit of the terminal 8, such as a hard disk or a memory of the terminal 8. The memory 81 can also be an external storage device of the terminal 8, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, or the like, equipped on the terminal 8. Further, the memory 81 can also include both the internal storage unit and the external storage device of the terminal 8. The memory 81 is used to store the computer program and other programs and data required by the terminal. The memory 81 can also be used to temporarily store data that has been output or is to be output.

[0113] It can be clearly understood by those skilled in the art that, for the convenience and brevity of description, only the division of the above functional units and modules is exemplified, and in actual application, the above functions can be completed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit, and the integrated unit can be realized in the form of hardware or in the form of software functional unit. In addition, the specific names of the functional units and modules are only for the convenience of mutual distinction, and do not limit the protection scope of the present application. The specific working process of the units and modules in the system can refer to the corresponding process in the foregoing method embodiments, which will not be described here.

[0114] In the above embodiments, the description of each embodiment has its own emphasis, and the parts not described or recorded in detail in a certain embodiment can refer to the relevant description of other embodiments.

[0115] Those of ordinary skill in the art can appreciate that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be realized in electronic hardware or in a combination of computer software and electronic hardware. Whether the functions are executed in hardware or software depends on the specific application and design constraints of the technical solution. A person skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0116] In the embodiments of the present application, it should be understood that the disclosed apparatus / terminal and method can be implemented in other manners. For example, the embodiments of the apparatus / terminal described above are merely schematic, and the division of the modules or units is merely logical function division, and there can be another division manner in actual implementation. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections between different units, can be indirect couplings or communication connections through some interfaces, devices or units, and can be electrical, mechanical or in other forms.

[0117] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e., can be located in one place, or can be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiments.

[0118] In addition, each functional unit in the various embodiments of the present application can be integrated into a processing unit, or each unit can be a physically independent unit, or two or more units can be integrated into a unit. The integrated unit can be implemented in the form of hardware or in the form of a software functional unit.

[0119] The integrated module / unit, if implemented in the form of a software functional unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, all or part of the flow of the above-mentioned embodiment methods can be completed by a computer program instructing related hardware, and the computer program can be stored in a computer readable storage medium. When the processor executes the computer program, the steps of each method embodiment described above can be implemented. The computer program includes computer program code, which can be in the form of source code, object code, executable file or some intermediate form. The computer readable medium can include any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the computer readable medium can include appropriate contents according to the requirements of legislation and patent practice in the jurisdiction, for example, in some jurisdictions, according to legislation and patent practice, the computer readable medium does not include electrical carrier signals and telecommunication signals.

[0120] The above-described embodiments are only used to illustrate the technical solutions of the present application, but not limit the present application; although the present application has been described in detail with reference to the foregoing embodiments, those ordinarily skilled in the art should understand: the technical solutions recorded in the foregoing embodiments can be modified, or some technical features can be replaced equivalently; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.

Claims

1. A MIDI music generation method, characterized in that, The method includes: Preprocess the raw MIDI music data to obtain note tracks and chord tracks; The note track and the chord track are subjected to melody and chord separation transformation, MCST storage and digital mapping processing to obtain MCST elements, and the chord track is digitally mapped to obtain chord elements; The music segment temporal learning network is trained using the MCST elements to obtain the first prediction model; The second prediction model is obtained by training the similar chord replacement network using the chord elements. A random MIDI music clip is input into the first prediction model to generate an intermediate MCST clip; The generated intermediate MCST segment is input into the second prediction model for chord replacement, generating new MIDI music. The step of inputting random MIDI music fragments into the first prediction model to generate intermediate MCST fragments includes: Load the first prediction model, input the random MIDI music fragment into the first prediction model, obtain the converted MCST data format, and generate a new music fragment; The step of inputting the generated intermediate MCST segment into the second prediction model for chord replacement to generate new MIDI music includes: The second prediction model is loaded, the chord portion of the newly generated music segment is extracted, the repeated chords in the chord portion are recorded, the repeated chords are replaced using the second prediction model, and the replaced chords are stored in the chord track of the newly generated music segment to generate new MIDI music.

2. The MIDI music generation method according to claim 1, characterized in that, The MCST storage of the note track and the chord track includes: The MCST element uses the duration of an eighth note as its basic unit. Obtain the chord information from the chord track, and break the chord information into multiple eighth notes; Obtain the note information from the note track, wherein the note information is an eighth note; The note information is concatenated with the split chord information and stored as the smallest storage unit of the MCST.

3. The MIDI music generation method according to claim 1, characterized in that, The step of training the music segment temporal learning network using the MCST elements to obtain the first prediction model includes: The MCST elements are placed into the music segment temporal learning network. N MCST elements are grouped together, and the MCST elements of the previous group are used to predict the (N+1)th MCST element. The training is repeated cyclically. The N MCST elements are an integer number of MCST elements greater than 1. The music segment temporal learning network is a neural sequence model with a self-attention mechanism.

4. The MIDI music generation method according to claim 1, characterized in that, The step of training the similar chord replacement network using the chord elements to obtain the second prediction model includes: Acquire chord information from a chord track, the chord information including chord progressions, and train the second prediction model using multiple chord progressions; The similar chord replacement network is the word2vec model.

5. The MIDI music generation method according to claim 1, characterized in that, The second prediction model is assigned sentiment selection labels. The process of assigning sentiment selection labels includes: Group major and minor chords; if the random MIDI music style is positive, then use major chords to replace the repeated chords; if the random MIDI music style is melancholic, then use minor chords to replace the repeated chords. After chord replacement, chord approximation is calculated for the repeated chord and the replaced chord; If the chord similarity exceeds the threshold, the major and minor chords are reselected for replacement.

6. A MIDI music generation device, characterized in that, The device includes: The preprocessing module is used to preprocess the raw MIDI music data to obtain note tracks and chord tracks; to perform MCST storage and digital mapping processing on the note tracks and chord tracks to obtain MCST elements, and to digitally map the chord tracks to obtain chord elements; The training module is used to train the music segment temporal learning network using the MCST elements to obtain a first prediction model; and to train the similar chord substitution network using the chord elements to obtain a second prediction model. The generation module is used to input random MIDI music fragments into the first prediction model to generate intermediate MCST fragments; input the generated intermediate MCST fragments into the second prediction model to perform chord replacement and generate new MIDI music; The generation module is specifically used to load the first prediction model, input the random MIDI music fragment into the first prediction model, obtain the converted MCST data format, and generate a new music fragment. The generation module is specifically used to load the second prediction model, extract the chord part of the newly generated music segment, record the repeated chords in the chord part, use the second prediction model to replace the repeated chords, and store the replaced chords into the chord track of the newly generated music segment to generate new MIDI music.

7. A terminal, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method as described in any one of claims 1 to 5 above.

8. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 5 above.

Citation Information

Patent Citations

  • Method of generating music data

    CN111630590A