Method and system for generating AI music works
By constructing a music score vocabulary and a part-of-speech transfer matrix, the problem of low accuracy in data conversion of the music generation model is solved, the generation of AI music works in the form of staffs is realized, and the accuracy of model training and the grammatical robustness of the generated results are improved.
Patent Information
- Application Number
- CN202410857320.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-28
- Publication Date
- 2024-09-06
AI Technical Summary
In the existing technology, music expression methods cannot be directly displayed as music scores, and the music generation model has low model accuracy due to data conversion reasons.
Build a music score vocabulary based on music theory knowledge, combine it with the autoregressive model to train the generation model, and constrain the random sampling process through the part-of-speech transfer matrix to generate music scores that meet user needs.
It realizes the generation of AI music works in the form of staffs, simplifies the reflection of music theory rules, improves the accuracy of model training and the grammatical robustness of the generated results, and facilitates interconversion with digital staffs.
Smart Images

Figure CN118609529A
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computer technology, and in particular relates to a method and system for generating AI music works. Background Art
[0002] The five-line notation is a classic way of musical notation, which can concisely express the core concept of a musical work. With the rapid development of artificial intelligence, music generation artificial neural networks based on autoregressive models have made great progress in recent years. Combining the language model of artificial neural networks and music serialization schemes described in the following paragraphs to generate efficient music scores that meet user needs has become a working method for music creators, but there are still some problems in the specific application process.
[0003] Oore et al. proposed a MIDI-like music language for generative AI in 2018 to express a sequence of music performance events, such as Figure 1 As shown, this scheme encodes the music performance signal and cannot be directly displayed as a music score.
[0004] The XML-based MusicXML is a universal standard format for digital musical notation. This solution is suitable for traditional rule-based algorithm parsing and generation, but the expression of music symbols is cumbersome, and there are a large number of long-term structural context dependencies in the XML syntax, which is not suitable for deep learning model training.
[0005] Lilypond is a special language for digital musical notation. It is simpler than MusicXML, but still has structured context dependencies. When used directly for deep learning, the vocabulary in its text encoder is still not concise enough due to certain grammatical complexity.
[0006] MusicGen is a music generation deep learning model proposed by Meta AI. The model is based on residual vector quantization. Vector quantization is a method of discretizing continuous signals. It can discretize audio signals into integer sequences and then be used to train autoregressive models. However, this scheme encodes the audio signal of the music, not the score. Summary of the invention
[0007] In view of the problem that the music expression method in the prior art cannot be directly displayed as a score and the music generation model has low model accuracy due to data conversion, the present invention proposes a method and system for generating AI music works. Inspired by MIDI-like languages, a set of language model token lexicons is established with reference to Lilypond. To solve the above technical problems, the technical solutions adopted by the present invention are as follows:
[0008] A method for generating AI music works, comprising the following steps:
[0009] S1, constructing a music score vocabulary including M section separators and N music theory representation symbols based on music theory knowledge, wherein the section separators and the music theory representation symbols are represented by different characters respectively;
[0010] S2, collecting digital musical notations, and training the autoregressive model based on the digital musical notations to obtain a music generation model;
[0011] S3, based on the score vocabulary constructed in step S1 and user needs, the score music comprises a plurality of score bars, each of which starts with a bar start mark in the bar separator and ends with a bar end mark in the bar separator, and at least one voice part is provided between the bar start mark and the bar end mark;
[0012] S4, constructing a part-of-speech transfer matrix for constraining a sampling rule between two adjacent parts-of-speech, wherein the parts-of-speech include a section separator and a music theory representation symbol;
[0013] S5, inputting the music score into the music generation model, and updating the random sampling process of the music generation model based on the part-of-speech transfer matrix to obtain the music score corresponding to the user's needs.
[0014] In step S3, when ξ>1, a part separator is provided between two adjacent parts, and ξ represents the number of parts between the measure start symbol and the measure end symbol of the same score measure.
[0015] In step S3, word unit separators are provided between the measure start symbol and the voice part, and between the measure end symbol and the voice part of the same music score measure.
[0016] In step S3, each of the voice parts includes a plurality of context items and a plurality of event items, and each event item includes a chord for describing the volume, a duration for describing the length of the music event, and an event suffix for describing the modifying component of the music event;
[0017] The context items all include a time signature, a clef, a track number, and a key signature, and the time signature, the clef, the track number, and the key signature are all music theory symbols.
[0018] The chord includes a phoneme and several octave changes, and the phoneme includes a pitch and at most one variation. The octave change, pitch, and variation are all one of the musical notations.
[0019] The section separators include PAD as a filler, BOM indicating a measure start, EOM indicating a measure end, and VB indicating a voice separator;
[0020] The music theory symbols include track number, clef, key signature, numerator of time signature, denominator of time signature, pitch, change of pitch, octave increase, octave decrease, basic time value, floating point, beam, rest, expression and technique;
[0021] The expression of the part-of-speech transfer matrix is:
[0022]
[0023] In the formula, when p i,j =1, indicating that the transfer from the part of speech in the row to the part of speech in the column is allowed. i,j = 0, indicating that the transfer from the part of speech in the row to the part of speech in the column is not allowed, p i,j Represents the element in the i-th row and j-th column of the part-of-speech transfer matrix P; the parts of speech corresponding to the 1st row and the 1st column in the part-of-speech transfer matrix P are all PAD, the parts of speech corresponding to the 2nd row and the 2nd column are all BOM, the parts of speech corresponding to the 3rd row and the 3rd column are all EOM, the parts of speech corresponding to the 4th row and the 4th column are all VB, the parts of speech corresponding to the 5th row and the 5th column are all track numbers, the parts of speech corresponding to the 6th row and the 6th column are all clefs, the parts of speech corresponding to the 7th row and the 7th column are all key signatures, the parts of speech corresponding to the 8th row and the 8th column are all numerators of the time signature, and the parts of speech corresponding to the 9th row and the 9th column are all The denominator of the time signature, the parts of speech corresponding to the 10th row and the 10th column are all pitch degrees, the parts of speech corresponding to the 11th row and the 11th column are all changes of voice, the parts of speech corresponding to the 12th row and the 12th column are all lowered octaves, the parts of speech corresponding to the 13th row and the 13th column are all raised octaves, the parts of speech corresponding to the 14th row and the 14th column are all basic durations, the parts of speech corresponding to the 15th row and the 15th column are all floating points, the parts of speech corresponding to the 16th row and the 16th column are all beams, the parts of speech corresponding to the 17th row and the 17th column are all rests, and the parts of speech corresponding to the 18th row and the 18th column are all expressions and techniques.
[0024] A system for generating AI music works, comprising:
[0025] A vocabulary building module: used to build a score vocabulary including M section separators and N music theory representation symbols based on music theory knowledge, where the section separators and the music theory representation symbols are represented by different characters respectively;
[0026] Model generation module: used to collect digital musical notations, and train the autoregressive model based on the digital musical notations to obtain a music generation model;
[0027] A music score creation module: used for creating a music score based on the music score vocabulary of the vocabulary building module and user requirements, wherein the music score includes a plurality of music score bars, each of which starts with a bar start mark in a bar separator and ends with a bar end mark in a bar separator, and at least one voice part is provided between the bar start mark and the bar end mark;
[0028] Matrix storage module: used to store a part-of-speech transfer matrix, wherein the part-of-speech transfer matrix is used to constrain the sampling rules between two adjacent parts of speech, wherein the parts of speech include section separators and music theory representation symbols;
[0029] Music score generation module: used to update the random sampling process of the music generation model based on the part-of-speech transfer matrix of the matrix storage module, and obtain the music score corresponding to the user's needs according to the music score creation module and the updated music generation model.
[0030] Beneficial effects of the present invention:
[0031] 1. This application can generate AI music works in the form of five-line notation, eliminating the complexity of training models to learn music performance, and can more directly reflect the music theory rules and the essence of music. It can also be converted to and from the standard format of digital five-line notation;
[0032] 2. Comparing with the Lilypond music notation system, it is easy to develop and can be converted into the Lilypond format. It is a music language solution that is easy to read and listen to.
[0033] 3. The grammatical structure is simple, the score language description is concise, and it is easy to train the autoregressive model. If the music score dataset is created in this language, it can be directly used to train the autoregressive model, and the generated results have good grammatical robustness;
[0034] 4. Music scores can also be directly applied to the training of recognition network models used to identify music score images to improve the training accuracy of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0036] Figure 1 A schematic diagram of generating music based on a MIDI-like music language in the prior art;
[0037] Figure 2This is one of the music score schematic diagrams generated based on this application;
[0038] Figure 3 This is the second schematic diagram of the music score generated based on this application;
[0039] Figure 4 Schematic diagram of training a music generation model;
[0040] Figure 5 A method and application diagram for parsing the music score generated by this application;
[0041] Figure 6 This is the structural analysis diagram of the example atlas section;
[0042] Figure 7 This is the music score corresponding to the music measure in the picture. DETAILED DESCRIPTION
[0043] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0044] Autoregressive model: It is a statistical method for processing time series, which can use the previous elements in a sequence to predict the value of the next element.
[0045] OMR: (Optical Music Recognition), similar to OCR, is a technology that restores digital music scores from images of five-line scores.
[0046] BNF: (Backus Normal Form), a type of formal language described by a context-free grammar, which can be used to define a set of grammatical rules for a formal language.
[0047] Token: It can be translated as "token", which represents a unit in the sequence processed by the language model. In natural language understanding, a token is the smallest segmentation unit during text preprocessing. A token may be a word, root or Chinese character.
[0048] The above is an introduction to the prior art used in this application.
[0049] A method for generating AI music works, comprising the following steps:
[0050] S1, constructing a music score vocabulary including M section separators and N music theory representation symbols based on music theory knowledge, wherein the section separators and the music theory representation symbols are represented by different characters respectively;
[0051] In this embodiment, M=4, N=14. Four section separators are used to separate different measures in the music score production process, and the section separators include PAD as a filler, BOM (begin of measure) indicating the start of a measure, EOM (end of measure) indicating the end of a measure, and VB (voice boundary) indicating a voice separator. In this embodiment, zero is used as a filler. Each section separator is used as a token.
[0052] The thirteen music theory symbols are as follows:
[0053]
[0054]
[0055] The token corresponding to each music theory symbol can be set according to the demand for music. In this embodiment, the setting and meaning of the token corresponding to each music theory symbol are as follows: each five-line in the vertical structure of the score of the five-line staff is called a track, which is sorted from top to bottom. The track position occupied by the music theory symbol can be indicated by the track number (Staff), and the corresponding tokens include S1, S2 and S3. For example, S2 represents the second track. The tokens corresponding to the clef include Cg and Cf. Cg is the treble clef and Cf is the bass clef. The treble clef is the G clef and the bass clef is the F clef. The tokens corresponding to the key signature include K0, K1, K2, K3, K4, K5, K6, K_1, K_2, K_3, K_4, K_5, K_6. K0 represents a key signature without sharp or flat, i.e., C major or a minor. K1, K2, K3, K4, K5, K6 represent key signatures with 1-6 sharps, respectively. K_1, K_2, K_3, K_4, K_5, K_6 represent key signatures with 1-6 flats, respectively. The time signature includes a numerator and a denominator. The tokens corresponding to the time signature as the numerator include TN1, TN2, TN3, TN4, TN5, TN6, TN7, TN8, TN9, TN10, TN11, TN12, representing the 1-12 numerators of the time signature, respectively. The tokens corresponding to the time signature as the denominator include TD2, TD4, TD8. The tokens corresponding to pitches include a, b, c, d, e, f, and g, which correspond to the seven pitches named ag. The tokens corresponding to accidentals include As, Af, Ass, and Aff, which represent sharp, flat, double sharp, and double flat, respectively.
[0056] The Token corresponding to the raised octave is Osup, which is used to record the notes played in the melody in a pure octave upward. The Token corresponding to the lowered octave is Osub, which is used to record the notes played in the melody in a pure octave downward. This application refers to the relative pitch mode of Lilypond. When the octave rise and fall (including raised octave and lowered octave) does not occur, the tone group is determined by the nearest tone to the previous pitch by default. The Token corresponding to the basic duration, that is, the basic duration type, includes D1, D2, D4, D8, D16, D32, and D64, which respectively represent whole notes, half notes, quarter notes, eighth notes, sixteenth notes, thirty-second notes, and sixty-fourth notes. This application divides the basic duration type symbols into powers of 2. The Token corresponding to the floating point is Dot, which represents that the duration of the modified music event is increased by 1 / 2. When multiple floating points are superimposed, the total duration of the music event is 2-2 of the basic duration (Division). -dtimes, where d is the floating point number of the current music event. In this application, the music event refers to a group of single notes, chords and / or rests on the score.
[0057] The tokens corresponding to beams include Bl and Br, which represent the beam start and beam end respectively. The beam start represents that the modified music event is at the left end of the beam, and the beam end represents that the modified music event is at the right end of the beam. The tokens corresponding to rests include Rest and RSpace. Rest represents that the modified music event is a rest, and RSpace represents that the modified music event is a blank rest, which is used as a placeholder for duration. The tokens corresponding to expressions and techniques include EslurL, EslurR, Etie, and Earp. EslurL is the slur start, which represents that the modified music event is at the left end of the slur; EslurR is the slur end, which represents that the modified music event is at the right end of the slur; Etie is the tie modifier, which represents that the modified music event has a tie; Earp represents that the modified music event has an arpeggio mark.
[0058] S2, such as Figure 4 As shown, digital staves are collected, and an autoregressive model is used to train the music generation model based on the digital staves;
[0059] Digital staves can be obtained by manually notating using music editing software. Music editors edit and create digital staves of existing music works using professional stave editing software (such as Finale, MuseScore, etc.), and then export the music scores, i.e. digital staves, into MusicXML format. MusicXML is a universal description format that is compatible with the music scores and lilypond edited texts of this application, and can be converted into formats.
[0060] Digital staves can also be obtained through stave images, specifically, by taking photos of a large number of existing music scores and using the OMR engine recognition method to recognize stave images. Using all digital staves as training sets to train an autoregressive model can obtain a music generation model.
[0061] OMR is a method for generating digital staves from music score image recognition. Specifically, there are multiple technical routes for the implementation of OMR, including: a. Locate the semantic point set of music symbols from the image, and then obtain the music score data through topological structure analysis; b. Directly use the cross-modal model of computer vision plus language (V+L) to convert the image into a language description of a certain music score. This technology is not the focus of protection of this application, and will not be described in detail in this embodiment.
[0062] S3, creating a music score based on the music score vocabulary constructed in step S1 and user needs, wherein the music score includes a plurality of music score bars, each of which starts with a bar start symbol and ends with a bar end symbol, and at least one voice part is provided between the bar start symbol and the bar end symbol;
[0063] Preferably, when a plurality of voices are provided between a measure start symbol and a measure end symbol, a voice separator is further provided between two adjacent voices.
[0064] Preferably, a word unit separator is provided between any two adjacent symbols such as a measure start symbol, a measure end symbol, a voice part, a voice part separator, etc. In this embodiment, a space is used as the word unit separator.
[0065] For example: BOM (part) EOM is a music measure, BOM (part 1) VB (part 2) EOM is also a music measure, and BOM (part 1) VB (part 2) VB (part 3) EOM is also a music measure.
[0066] Each part includes several context items and several event items, and the event items include a chord for describing the pitch, a duration for describing the length of a music event, and an event suffix for describing the modifier of a music event. When making a part, the duration is between the chord and the event suffix, and the duration includes a basic duration and λ floating points, λ≥0.
[0067] The chord includes several pitches, each of which includes a phoneme and several octave changes, and each phoneme includes a pitch class and at most one modified tone. In addition, the pitch may not include octave changes, and its number is set according to specific needs. According to the pitch, the absolute value of a single tone on the pitch axis of the score can be determined. The phoneme defines the position of the pitch of a single tone in the natural tone group to which it belongs. The natural tone group refers to a group of 7 consecutive pitch positions of c, d, e, f, g, a, and b defined by "spaces" and "lines" in the five-line staff. The modified tone defines the sharp / flat semitone attribute at each pitch position.
[0068] The post_events is an optional item used to describe the modifying components of a music event, and the number of the post_events can be zero, or any one or more of rests, beams, expressions, and techniques.
[0069] The context item describes the current state of the current part and is valid until the next similar context item appears in the current part. Each context item is a single token, which can be a track number, key signature, time signature (numerator or denominator) or clef. In a score measure, time signature and key signature generally appear once, while track number can appear multiple times.
[0070] Figure 6 The score measure in is “BOM K_1TN4 TD4 Cg S1 c D2 Dot EslurL g Osup b Af dD4 EslurR EOM”, among which “K_1TN4 TD4 Cg S1 c D2 Dot EslurL g Osup b Af d D4 EslurR” is a voice part, each token in “K_1TN4 TD4 Cg S1” is a context item, “c D2 Dot EslurLg Osup b Af d D4 EslurR” is an event item, “c” is a pitch, “D2 Dot” is a duration, “EslurL” is an event suffix, “g Osup” is a pitch, “b Af” is a pitch, “d” is a pitch, “D4” is a duration, and “EslurR” is an event suffix. Figure 6 The score corresponding to the measure in the score is as follows Figure 7 shown.
[0071] S4, constructing a part-of-speech transfer matrix for constraining sampling rules between adjacent different parts of speech, wherein the parts of speech include section separators and music theory representation symbols;
[0072] The way that the autoregressive model generates text in the prior art is based on a random sampling process. In order to avoid grammatical errors in the random sampling process, this application defines a set of adjacency transfer rules between different parts of speech to constrain the sampling process. The expression corresponding to the part-of-speech transfer matrix is:
[0073]
[0074] In the formula, p i,j ∈P,p i,jrepresents the element in the i-th row and j-th column of the part-of-speech transfer matrix, in which the parts of speech corresponding to the 1st row and the 1st column are PAD, the parts of speech corresponding to the 2nd row and the 2nd column are BOM, the parts of speech corresponding to the 3rd row and the 3rd column are EOM, the parts of speech corresponding to the 4th row and the 4th column are VB, the parts of speech corresponding to the 5th row and the 5th column are track numbers, the parts of speech corresponding to the 6th row and the 6th column are clefs, the parts of speech corresponding to the 7th row and the 7th column are key signatures, the parts of speech corresponding to the 8th row and the 8th column are numerators of the time signature, and the parts of speech corresponding to the 9th row and the 9th column are subdivided into the time signature. The parts of speech corresponding to the 10th row and the 10th column are all pitch degrees, the parts of speech corresponding to the 11th row and the 11th column are all changes of voice, the parts of speech corresponding to the 12th row and the 12th column are all Osub which lowers the octave, the parts of speech corresponding to the 13th row and the 13th column are all Osup which raises the octave, the parts of speech corresponding to the 14th row and the 14th column are all basic durations, the parts of speech corresponding to the 15th row and the 15th column are all floating points, the parts of speech corresponding to the 16th row and the 16th column are all beams, the parts of speech corresponding to the 17th row and the 17th column are all rests, and the parts of speech corresponding to the 18th row and the 18th column are all expressions and techniques.
[0075] The part-of-speech transfer matrix is a (M+N)×(M+N) matrix. The element value in the part-of-speech transfer matrix indicates whether the transfer from the "part-of-speech of the row" to the "part-of-speech of the column" is allowed (1 means allowed, 0 means not allowed). For example: the value of the 8th row and the 9th column is 1, so the expression of the form TN3 TD4 is legal (which means the time signature 3 / 4); and the value of the 9th row and the 8th column is 0, so the expression of the form TD4 TN3 is illegal.
[0076] S5, inputting the music score established in step S3 into the music generation model in step S2, and updating the random sampling process of the music generation model based on the part-of-speech transfer matrix obtained in step S4 to obtain the music score corresponding to the user's needs;
[0077] The autoregressive model in the prior art is an unconditional generation process, and the diversity of the generation results comes from the introduction of the random sampling process in the generation. The result of the random sampling output can be controlled by the seed of the pseudo-random number generator. Here, "unconditional" means that the model has no additional control parameters (such as pre-prompts, style, etc.). The present application further defines the random sampling process based on the part-of-speech transfer matrix. Specifically, after the music score is input into the music generation model, the music generation model first calculates the part-of-speech prediction probability vector Then select the row vector corresponding to the current part of speech from the part-of-speech transfer matrix as the first mask vector of the predicted part of speech The first mask vector is calculated based on the number of tokens corresponding to each part of speech. The second mask vector is obtained by expanding the number of elements of The second mask vector and the part-of-speech prediction probability vector Corresponding multiplication to obtain the updated part-of-speech prediction probability vector Then the normalized part-of-speech prediction probability vector is obtained through the softmax function Then, random sampling can be performed based on the normalized part-of-speech prediction probability vector. For example, the current part-of-speech is BOM, and its corresponding first mask vector is The expanded second mask vector is
[0078]
[0079] Updated part-of-speech prediction probability vector The calculation formula is:
[0080]
[0081] In the formula, Represents the updated part-of-speech prediction probability vector The kth element in Represents the part-of-speech prediction probability vector The kth element in represents the kth element in the mask vector, and m is the mask operation function.
[0082] The normalized part-of-speech prediction probability vector The calculation formula is:
[0083]
[0084] Where T represents the sampling temperature, and its value determines the degree of randomization of the sampling.
[0085] For example: the score measure is "BOM K0 TN4 TD4 S1 Cg c D1 EOM", the corresponding score is as follows Figure 2 When the score measure is “BOM K4 TN3 TD8 S1 Cg f As Osup D32 Bl d As D32 b D32 g As D32 Br S2f As Osub D32 Bl d As D32 b D32 g As D32 Br S1 d As Osup D32 Bl S2 g As D32Osub S1 b D32 d As D32Br VB S2 Cf b D8 S1 d As Osup D8 EslurL f As D8 EslurRVB S2 Cf b Osub d As D8 b D8 b D8EOM”, the corresponding score is as follows: Figure 3 shown.
[0086] like Figure 5 As shown, the music scores generated based on the music score vocabulary defined in this application can be parsed by BNF grammar. For a language with BNF grammar definition, a grammar analysis generator (such as BISON, YACC, etc.) can be used to generate the corresponding general music data format, which can then be played and displayed with the help of other digital staff tools.
[0087] The present application also provides a system for generating AI music works, comprising:
[0088] A vocabulary building module: used to build a score vocabulary including M section separators and N music theory representation symbols based on music theory knowledge, where the section separators and the music theory representation symbols are represented by different characters respectively;
[0089] Model generation module: used to collect digital musical notations, and train the autoregressive model based on the digital musical notations to obtain a music generation model;
[0090] A music score creation module: used for creating a music score based on the music score vocabulary of the vocabulary building module and user requirements, wherein the music score includes a plurality of music score bars, each of which starts with a bar start mark in a bar separator and ends with a bar end mark in a bar separator, and at least one voice part is provided between the bar start mark and the bar end mark;
[0091] Matrix storage module: used to store a part-of-speech transfer matrix, wherein the part-of-speech transfer matrix is used to constrain the sampling rules between two adjacent parts of speech, wherein the parts of speech include section separators and music theory representation symbols;
[0092] Music score generation module: used to update the random sampling process of the music generation model based on the part-of-speech transfer matrix of the matrix storage module, and obtain the music score corresponding to the user's needs according to the music score creation module and the updated music generation model.
[0093] An embodiment of the present application also provides an electronic device, which includes a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the steps of the above-mentioned method for generating AI music works are performed.
[0094] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the method for generating AI music works are executed. Specifically, the storage medium can be a general storage medium, such as a mobile disk, a hard disk, etc. When the computer program on the storage medium is executed, the embodiment of the method for generating AI music works can be executed.
[0095] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for generating AI music works, It is characterized in that The steps include: S1, constructing a music score vocabulary including M section separators and N music theory representation symbols based on music theory knowledge, wherein the section separators and the music theory representation symbols are represented by different characters respectively; S2, collecting digital musical notations, and training the autoregressive model based on the digital musical notations to obtain a music generation model; S3, based on the score vocabulary constructed in step S1 and user needs, the score music comprises a plurality of score bars, each of which starts with a bar start mark in the bar separator and ends with a bar end mark in the bar separator, and at least one voice part is provided between the bar start mark and the bar end mark; S4, constructing a part-of-speech transfer matrix for constraining a sampling rule between two adjacent parts of speech, wherein the parts of speech include a section separator and a music theory representation symbol; S5, inputting the music score into the music generation model, and updating the random sampling process of the music generation model based on the part-of-speech transfer matrix to obtain the music score corresponding to the user's needs.
2. The method for generating AI music works according to claim 1, It is characterized in that In step S3, when ξ>1, a part separator is provided between two adjacent parts, and ξ represents the number of parts between the measure start symbol and the measure end symbol of the same score measure.
3. The method for generating AI music works according to claim 1, It is characterized in that In step S3, word unit separators are provided between the measure start symbol and the voice part, and between the measure end symbol and the voice part of the same music score measure.
4. The method for generating AI music works according to claim 1, It is characterized in that In step S3, each of the voice parts includes a plurality of context items and a plurality of event items, and each event item includes a chord for describing the volume, a duration for describing the length of the music event, and an event suffix for describing the modifying component of the music event; The context items all include a time signature, a clef, a track number, and a key signature, and the time signature, the clef, the track number, and the key signature are all music theory symbols.
5. The method for generating AI music works according to claim 4, It is characterized in that The chord includes a phoneme and several octave changes, and the phoneme includes a pitch and at most one variation. The octave change, pitch, and variation are all one of the musical notations.
6. The method for generating AI music works according to claim 1, It is characterized in that The section separators include PAD as a filler, BOM indicating a measure start, EOM indicating a measure end, and VB indicating a voice separator; The music theory symbols include track number, clef, key signature, numerator of time signature, denominator of time signature, pitch, change of pitch, octave increase, octave decrease, basic time value, floating point, beam, rest, expression and technique; The expression of the part-of-speech transfer matrix is: In the formula, when p i,j =1, indicating that the transfer from the part of speech in the row to the part of speech in the column is allowed. i,j = 0, indicating that the transfer from the part of speech in the row to the part of speech in the column is not allowed, p i,j Represents the element in the i-th row and j-th column of the part-of-speech transfer matrix P; In the part-of-speech transfer matrix P, the parts of speech corresponding to the first row and the first column are PAD, the parts of speech corresponding to the second row and the second column are BOM, the parts of speech corresponding to the third row and the third column are EOM, the parts of speech corresponding to the fourth row and the fourth column are VB, the parts of speech corresponding to the fifth row and the fifth column are track numbers, the parts of speech corresponding to the sixth row and the sixth column are clefs, the parts of speech corresponding to the seventh row and the seventh column are key signatures, the parts of speech corresponding to the eighth row and the eighth column are the numerators of the time signature, the parts of speech corresponding to the ninth row and the ninth column are the denominators of the time signature, and the parts of speech corresponding to the tenth row and the eighth column are the numerators of the time signature. The parts of speech corresponding to the 10th row and column are all pitch degrees, the parts of speech corresponding to the 11th row and column are all changes of voice, the parts of speech corresponding to the 12th row and column are all lowered octaves, the parts of speech corresponding to the 13th row and column are all raised octaves, the parts of speech corresponding to the 14th row and column are all basic durations, the parts of speech corresponding to the 15th row and column are all floating points, the parts of speech corresponding to the 16th row and column are all beams, the parts of speech corresponding to the 17th row and column are all rests, and the parts of speech corresponding to the 18th row and column are all expressions and techniques.
7. A system for generating AI music works, It is characterized in that include: A vocabulary building module: used to build a score vocabulary including M section separators and N music theory representation symbols based on music theory knowledge, where the section separators and the music theory representation symbols are represented by different characters respectively; Model generation module: used to collect digital musical notations, and train the autoregressive model based on the digital musical notations to obtain a music generation model; A music score creation module: used for creating a music score based on the music score vocabulary of the vocabulary building module and user requirements, wherein the music score includes a plurality of music score bars, each of which starts with a bar start mark in a bar separator and ends with a bar end mark in a bar separator, and at least one voice part is provided between the bar start mark and the bar end mark; Matrix storage module: used to store a part-of-speech transfer matrix, wherein the part-of-speech transfer matrix is used to constrain the sampling rules between two adjacent parts of speech, wherein the parts of speech include section separators and music theory representation symbols; Music score generation module: used to update the random sampling process of the music generation model based on the part-of-speech transfer matrix of the matrix storage module, and obtain the music score corresponding to the user's needs according to the music score creation module and the updated music generation model.
