Music generation methods, devices, equipment and storage media

By using user-input music parameters to generate models and timbre prediction models, the problem of relying on original music in existing technologies has been solved, achieving a new type of music generation with high innovation and high musical value.

CN114783398BActive Publication Date: 2026-03-13BEIJING XIAOMI MOBILE SOFTWARE CO LTD +1
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-24
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

In existing technologies, machine-generated music relies on the original input music, resulting in low innovation and musical value.

Method used

By obtaining the first music parameters input by the user, the initial music and timbre parameters are generated using the music generation model and timbre prediction model, and then a brand new target music is generated by combining the user's operation.

Benefits of technology

It achieves highly innovative and high-value music generation that does not rely on the original music, and the generated music is more compatible with the original music, resulting in better effects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114783398B_ABST
    Figure CN114783398B_ABST
Patent Text Reader

Abstract

This disclosure relates to a music generation method, apparatus, device, and storage medium. The music generation method includes: obtaining first music parameters based on a user's first input operation; inputting the first music parameters into a music generation model to obtain initial music; inputting the initial music into a timbre prediction model to obtain timbre parameters corresponding to the initial music; and obtaining target music based on the timbre parameters and the initial music. The music generation method provided by this disclosure does not require inputting original music and can generate entirely new music based on user operations, resulting in music with higher innovation and musical value. Furthermore, the timbre parameters obtained from the initial music are more compatible with it, leading to better musical effects in the target music obtained from the timbre parameters and the initial music.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of artificial intelligence technology, and in particular to a method, apparatus, device and storage medium for generating music. Background Technology

[0002] With the development of technology, artificial intelligence has become increasingly mature and has been widely applied in various technical fields, such as image processing, music processing, and text processing.

[0003] In the field of artificial intelligence, machines can be used for intelligent mixing, analysis, and optimization of music, and they can also be used to generate music. However, in related technologies, machine-generated music requires inputting an original piece of music, which the machine then uses to add further lyrics and music. This method of music generation relies on the original input music, and the new music generated from it has low innovation and low musical value. Summary of the Invention

[0004] To overcome the problems existing in related technologies, this disclosure provides a music generation method, apparatus, device, and storage medium.

[0005] According to a first aspect of the present disclosure, a music generation method is provided, the method comprising:

[0006] Based on the user's first input, obtain the first music parameters;

[0007] Input the first music parameters into the music generation model to obtain the initial music;

[0008] The initial music is input into the timbre prediction model to obtain the timbre parameters corresponding to the initial music;

[0009] The target music is obtained based on the timbre parameters and the initial music.

[0010] In some embodiments, obtaining the first music parameter based on the user's first input operation includes:

[0011] Upon detecting the first input operation, determine the scenario type corresponding to the first input operation;

[0012] Based on the scene type, retrieve the first music parameter corresponding to the scene type from the preset database;

[0013] The preset database contains: the scene type, the first music parameter, and the mapping relationship between the scene type and the first music parameter.

[0014] In some embodiments, a target format corresponding to the scene type is determined based on the scene type;

[0015] The process of obtaining the target music based on the timbre parameters and the initial music includes:

[0016] Based on the timbre parameters and the initial music, music with an initial format is obtained;

[0017] Based on the format conversion strategy corresponding to the target format, music with the initial format is converted to obtain target music with the target format.

[0018] In some embodiments, the first music parameters include: style tag value, number of notes, and total music duration; the step of inputting the first music parameters into a music generation model to obtain initial music includes:

[0019] The style tag value, the number of notes, and the total duration of the music are input into the encoding layer of the music generation model for encoding to obtain a synthesized feature sequence;

[0020] The synthesized feature sequence is input into the prediction layer of the music generation model to predict the music and obtain the initial music.

[0021] In some embodiments, the timbre parameters include: timbre tags; obtaining the target music based on the timbre parameters and the initial music includes:

[0022] Based on the timbre tag, a target timbre material corresponding to the timbre tag is determined from a preset timbre material library; wherein, the preset timbre material library pre-stores: the timbre tag, the timbre material, and the mapping relationship between the timbre tag and the timbre material;

[0023] The target timbre material and the initial music are synthesized to obtain the target music.

[0024] In some embodiments, the method further includes:

[0025] Obtain sample music from a preset sound source;

[0026] The sample music is input into the initial music generation model, and the predicted music is obtained through the initial music generation model;

[0027] Based on the difference between the predicted music and the sample music, the model parameters of the initial music generation model are adjusted to obtain the music generation model.

[0028] In some embodiments, the method further includes:

[0029] Update the target music and the first music parameters corresponding to the target music to the target music library;

[0030] Upon detecting a second input operation from the user, obtain the second music parameters;

[0031] The second music parameter is compared with the first music parameter in the target music library to obtain the comparison result;

[0032] Based on the comparison results, music corresponding to the second input operation is determined from the target music library.

[0033] According to a second aspect of the present disclosure, a music generation apparatus is provided, characterized in that the apparatus comprises:

[0034] The first acquisition module is configured to acquire the first music parameters based on the user's first input operation;

[0035] The first generation module is configured to input the first music parameters into the music generation model to obtain the initial music.

[0036] The prediction module is configured to input the initial music into the timbre prediction model to obtain timbre parameters corresponding to the initial music;

[0037] The processing module is configured to obtain the target music based on the timbre parameters and the initial music.

[0038] In some embodiments, the first acquisition module is configured as follows:

[0039] Upon detecting the first input operation, determine the scenario type corresponding to the first input operation;

[0040] Based on the scene type, retrieve the first music parameter corresponding to the scene type from the preset database;

[0041] The preset database contains: the scene type, the first music parameter, and the mapping relationship between the scene type and the first music parameter.

[0042] In some embodiments, the apparatus further includes:

[0043] The first determining module is configured to determine the target format corresponding to the scene type based on the scene type;

[0044] The processing module is configured as follows:

[0045] Based on the timbre parameters and the initial music, music with an initial format is obtained;

[0046] Based on the format conversion strategy corresponding to the target format, music with the initial format is converted to obtain target music with the target format.

[0047] In some embodiments, the first music parameter includes: style tag value, number of notes, and total music duration;

[0048] The first generation module is configured as follows:

[0049] The style tag value, the number of notes, and the total duration of the music are input into the encoding layer of the music generation model for encoding to obtain a synthesized feature sequence;

[0050] The synthesized feature sequence is input into the prediction layer of the music generation model to predict the music and obtain the initial music.

[0051] In some embodiments, the timbre parameters include: timbre tags;

[0052] The processing module is configured as follows:

[0053] Based on the timbre tag, a target timbre material corresponding to the timbre tag is determined from a preset timbre material library; wherein, the preset timbre material library pre-stores: the timbre tag, the timbre material, and the mapping relationship between the timbre tag and the timbre material;

[0054] The target timbre material and the initial music are synthesized to obtain the target music.

[0055] In some embodiments, the apparatus further includes:

[0056] The second acquisition module is configured to acquire sample music from a preset sound source;

[0057] The second generation module is configured to input the sample music into the initial music generation model, and obtain the predicted music through the initial music generation model;

[0058] The adjustment module is configured to adjust the model parameters of the initial music generation model based on the difference between the predicted music and the sample music, thereby obtaining the music generation model.

[0059] In some embodiments, the apparatus further includes:

[0060] The update module is configured to update the target music and the first music parameters corresponding to the target music to the target music library;

[0061] The third acquisition module is configured to acquire the second music parameters when the user's second input operation is detected;

[0062] The comparison module is configured to compare the second music parameter with the first music parameter in the target music library to obtain a comparison result.

[0063] The second determining module is configured to determine the music corresponding to the second input operation from the target music library based on the comparison result.

[0064] According to a third aspect of the present disclosure, an electronic device is provided, comprising:

[0065] processor;

[0066] Memory used to store processor-executable instructions;

[0067] The processor is configured to, when executing, implement the steps of any of the music generation methods in the first aspect described above.

[0068] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium is provided, wherein when instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the steps of any of the music generation methods in the first aspect described above.

[0069] The technical solutions provided by the embodiments of this disclosure may include the following beneficial effects:

[0070] In this embodiment of the disclosure, after obtaining the first music parameters based on the user's first input operation, the first music parameters are input into the music generation model to obtain the initial music, and then the initial music is input into the timbre prediction model to obtain the timbre parameters corresponding to the initial music. Finally, the target music is obtained based on the timbre parameters and the initial music.

[0071] In this embodiment, first music parameters can be obtained based on user operations, and initial music can be obtained based on the first music parameters. That is, it is not necessary to input the original music; entirely new music can be generated based on user operations, which can make the generated music more innovative and of higher musical value. At the same time, the timbre parameters obtained from the initial music are more compatible with the initial music, resulting in better musical effects for the target music obtained from the timbre parameters and the initial music.

[0072] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0073] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.

[0074] Figure 1This is a flowchart of a music generation method according to an exemplary embodiment of the present disclosure. Figure 1 .

[0075] Figure 2 This is a flowchart of a music generation method according to an exemplary embodiment of the present disclosure. Figure 2 .

[0076] Figure 3 This is a flowchart of a music generation method according to an exemplary embodiment of the present disclosure. Figure 3 .

[0077] Figure 4 This is a flowchart illustrating a music generation method according to an exemplary embodiment of the present disclosure. Figure 4 .

[0078] Figure 5 This is a structural block diagram of a music generation apparatus according to an exemplary embodiment of the present disclosure.

[0079] Figure 6 This is a hardware structure block diagram of an electronic device according to an exemplary embodiment of the present disclosure. Figure 1 .

[0080] Figure 7 This is a hardware structure block diagram of an electronic device according to an exemplary embodiment of the present disclosure. Figure 2 . Detailed Implementation

[0081] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.

[0082] Figure 1 This is a flowchart of a music generation method according to an exemplary embodiment of the present disclosure. Figure 1 ,like Figure 1 As shown, the main steps include:

[0083] Step 101: Obtain the first music parameters based on the user's first input operation;

[0084] Step 102: Input the first music parameters into the music generation model to obtain the initial music;

[0085] Step 103: Input the initial music into the timbre prediction model to obtain the timbre parameters corresponding to the initial music;

[0086] Step 104: Obtain the target music based on the timbre parameters and the initial music.

[0087] It should be noted that the music generation method proposed in this disclosure can be applied to electronic devices or servers. Here, electronic devices can include terminal devices, such as mobile terminals or fixed terminals. Mobile terminals can include devices such as mobile phones, tablets, and laptops. Fixed terminals can include desktop computers or smart TVs.

[0088] Here, the first input operation can include user input based on an electronic device. For example, it can include voice input, gesture input, etc. For instance, text or symbols can be typed using gestures. Input operations can also include button presses, clicks, etc.

[0089] In some embodiments, an operation interface can be output through the touch screen of the electronic device, through which the user performs a first input operation, thereby inputting user-defined first music parameters into the electronic device. Alternatively, an application can be installed on the electronic device, allowing the user to first trigger the application and enter the operation interface, where they can then perform the corresponding operation.

[0090] In this embodiment, the first music parameter can be a music parameter corresponding to the first input operation. This music parameter may include parameters such as style tag value, number of notes, and total music duration. The style tag value can be a tag value corresponding to a music style; for example, a music style may include quiet, sad, rock, folk, upbeat, or energetic. The number of notes can be the total number of notes in the target music. The total music duration can be the sum of the durations of each note in the target music, where the duration of each note represents its relative duration. In some embodiments, the first music parameter may also include timbre parameters, pitch parameters, etc.

[0091] In some embodiments, a mapping relationship between various input operations and music parameters can be pre-set. When a corresponding input operation is detected, the corresponding music parameter can be obtained based on the input operation and the mapping relationship. For example, if the first input operation is a single click, the first music parameter can be a rock-style music parameter; if the first input operation is a double click, the first music parameter can be a sad-style music parameter; if the first input operation is a voice input operation containing the word "folk", the first music parameter can be a folk-style music parameter; if the first input operation is a voice input operation containing the word "quiet", the first music parameter can be a quiet-style music parameter; if the first input operation is a text input operation containing the word "cheerful", the first music parameter can be a cheerful-style music parameter; if the first input operation is a text input operation containing the word "dynamic", the first music parameter can be a dynamic-style music parameter.

[0092] In some embodiments, the first music parameters can be obtained based on a user's first input operation. For example, if the first input operation is a user's voice input operation, the electronic device performing the music generation method may include a sound acquisition module (e.g., a microphone) and a processor. The user's input voice may contain the first music parameters. The sound acquisition module can receive the user's input voice and transmit the voice to the processor. The processor parses the voice and obtains the first music parameters from the parsed information.

[0093] When the first input operation is a user's text input operation, the electronic device executing the music generation method may include a text input module such as a keyboard or touch screen, and a processor. The text input by the user may contain the first music parameter. The text input module can receive the text input by the user and transmit the text to the processor. The processor parses the text and obtains the first music parameter from the parsed information.

[0094] When the first input operation is a user click, the electronic device executing the music generation method may include a touch screen and a processor. The touch screen can display multiple parameter options, which the user can select by clicking. After receiving the user's first input operation for a target parameter option, the touch screen can transmit a signal corresponding to the target parameter option to the processor. Upon receiving the signal, the processor determines the target parameter option corresponding to that signal, and then, based on the target parameter option and its mapping relationship with music parameters, determines the first music parameter corresponding to the target parameter option. This allows for one-click determination of the first music parameter, improving the efficiency of determining the first music parameter and the convenience of user operation.

[0095] In some embodiments, the first input operation may carry a first music parameter. In this embodiment, the information carried in the first input operation can be parsed, and the first music parameter can be obtained from the carried information. For example, a user can directly input the first music parameter through a voice input operation, in which case the first music parameter can be obtained from the information carried by the user's voice input operation. In some embodiments, the first input operation may carry information related to the first music parameter. In this embodiment, the information carried in the first input operation can be parsed, and the information related to the first music parameter can be obtained from the carried information, and the first music parameter can be obtained based on the information related to the first music parameter. For example, a user can directly input a scene type through a voice input operation, in which case the scene type can be obtained from the information carried by the user's voice input operation, and then the first music parameter corresponding to the scene type can be determined based on the scene type and the preset mapping relationship between scene types and music parameters.

[0096] After determining the first music parameters, the first music parameters can be input into the music generation model to obtain the initial music.

[0097] Here, the music generation model can be a model pre-trained using machine learning to generate music based on input music parameters. In some embodiments, the music generation model may include a deep learning model. For example, the music generation model may include a CNN (Convolutional Neural Networks) based model, an RNN (Recurrent Neural Network) based model, an LSTM (Long Short-Term Memory) based model, or a Transformer (Deep Self-Attention Network) based model, etc.

[0098] Figure 2 This is a flowchart illustrating a music generation method according to an exemplary embodiment of the present disclosure. Figure 2 .like Figure 2 As shown, the music generation method may further include the following steps:

[0099] Step 201: Obtain sample music from a preset sound source;

[0100] Step 202: Input the sample music into the initial music generation model, and obtain the predicted music through the initial music generation model;

[0101] Step 203: Based on the difference between the predicted music and the sample music, adjust the model parameters of the initial music generation model to obtain the music generation model.

[0102] The preset sound source here may include: a music download list containing downloaded music, a music collection list containing favorited music, or a frequently played list containing music played more than a preset threshold number of times, all located in the electronic device or other electronic device executing the music generation method. Here, music can be obtained from the preset sound source to form the first training set, and the sample music can be sample music from the first training set. The initial music generation model here can be a model that has not yet started training or has not completed training; the initial music generation model may include a prediction layer for music prediction.

[0103] In some embodiments, the sample music in the first training set can be sample music in the form of a music sequence encoded based on the music parameters and note information of the music in the preset sound source, such as sample music in the form of a music sequence encoded based on style tag values, number of notes, total music duration, and the pitch and duration of each note.

[0104] In some embodiments, the sample music in the first training set can be labeled sample music, and the labels of the sample music in the first training set can include music parameters. After the sample music in the first training set is input into the initial music generation model, the prediction layer of the initial music generation model will perform music prediction based on the music parameters of the sample music in the first training set to obtain the predicted music.

[0105] After obtaining the predicted music, it can be compared with the sample music in the first training set. Based on the comparison result (i.e., the difference between the predicted music and the sample music in the first training set) and a preset loss function (e.g., cross-entropy loss function), the loss value of the initial music generation model is determined. After obtaining the loss value, the model parameters of the initial music generation model can be adjusted through backpropagation to optimize the initial music generation model until a convergence condition is met, at which point training stops, and the music generation model is obtained. The convergence condition can be: the change in the loss value within a set time period is less than a set change threshold; or the number of training epochs reaches a preset threshold, etc. In other optional embodiments, the music generation model can also be trained in other ways, which are not specifically limited here.

[0106] In this way, by adjusting the model parameters of the initial music generation model, the initial music generation model can be optimized, resulting in a better performance of the obtained music generation model.

[0107] Taking the Transformer model as the initial music generation model as an example, the Transformer model can be trained based on the labeled sample music in the first training set to obtain the music generation model. For example, a loss function can be used to determine the loss value of the Transformer model based on the sample music in the first training set and the predicted music obtained by the Transformer model according to the labeled tags of the sample music in the first training set. The model parameters of the Transformer model are then updated based on the loss value until the convergence condition is met, at which point the training of the Transformer model is stopped, and the music generation model is obtained.

[0108] It should be noted that after the first music parameters are input into the music generation model, the music generation model can output initial music. This initial music can include a music sequence encoded according to a preset encoding strategy, or it can include music in other formats, such as MIDI (Musical Instrument Digital Interface) format. In some embodiments, the initial music can be a music sequence encoded according to a preset encoding strategy based on the output first music parameters and the predicted note information.

[0109] For example, music parameters may include k-dimensional style label values ​​(k is determined by the number of style categories in the training data used to train the music generation model), m-dimensional note counts (m is determined by the number of notes that appeared in the training data used to train the music generation model), and n-dimensional total music duration (n is determined by the total duration value that appeared in the training data used to train the music generation model). Note information may include each note and its 128-dimensional pitch and 16-dimensional duration. In this case, the k-dimensional style label values, m-dimensional note counts, n-dimensional total music duration, each note, and its 128-dimensional pitch and 16-dimensional duration can be encoded using one-hot encoding to obtain the initial music in a music sequence format.

[0110] In some embodiments, after obtaining the initial music in the music sequence format, the initial music in the music sequence format can be converted into the initial music in the MIDI format so that the initial music can be applied to a variety of music processing devices.

[0111] After obtaining the initial music, it can be input into the timbre prediction model to obtain the timbre parameters corresponding to the initial music.

[0112] Here, the timbre prediction model can be a trained model used to determine the timbre parameters corresponding to the initial music input. In some embodiments, the timbre prediction model may include a deep learning model. For example, the timbre prediction model may include a CNN-based model, an RNN-based model, an LSTM-based model, or a Transformer-based model, etc.

[0113] In some embodiments, the music generation method may further include the following steps:

[0114] Step 204: Obtain sample music from the second training set;

[0115] Step 205: Input the sample music from the second training set into the initial timbre prediction model, and obtain the predicted music parameters of the sample music from the second training set through the initial timbre prediction model.

[0116] Step 206: Adjust the model parameters of the initial timbre prediction model based on the difference between the predicted music parameters and the labeled tags of the sample music in the second training set to obtain the timbre prediction model, wherein the labeled tags of the sample music in the second training set include timbre parameters.

[0117] In some embodiments, music can be obtained from a preset sound source to form a second training set. The sample music in the second training set can be labeled sample music. The sample music in the second training set can be the same as or different from the sample music in the first training set; the labeling tags of the sample music in the second training set can be different from those in the first training set; the format of the sample music in the second training set can be different from that in the first training set. In some embodiments, the sample music in the second training set can be pianoroll format sample music obtained by converting MIDI format music.

[0118] The initial timbre prediction model here can be a model that has not yet started training or has not been fully trained. The initial timbre prediction model can include a feature extraction layer and a classifier for feature extraction.

[0119] After the sample music from the second training set is input into the initial timbre prediction model, the feature extraction layer of the initial timbre prediction model will extract features from the sample music in the second training set to obtain the musical features of the sample music in the second training set. Then, the classifier can classify the sample music in the second training set based on the musical features of the sample music in the second training set to obtain the classification result, and then output the predicted timbre parameters corresponding to the classification result.

[0120] After obtaining the predicted music parameters, these parameters can be compared with the labeled tags of sample music in the second training set. Based on the comparison results (i.e., the difference between the predicted music parameters and the labeled tags) and a preset loss function (e.g., cross-entropy loss function), the loss value of the initial timbre prediction model is determined. After obtaining the loss value, the model parameters of the initial timbre prediction model can be adjusted using backpropagation to optimize it until a convergence condition is met. Training then stops, and the timbre prediction model is obtained. The convergence condition can be: the change in the loss value within a set time period is less than a set change threshold; or the number of training epochs reaches a preset threshold, etc. In other optional embodiments, the timbre prediction model can also be trained in other ways, which are not specifically limited here.

[0121] Thus, by adjusting the model parameters of the initial timbre prediction model, the initial timbre prediction model can be optimized, resulting in a better-performing timbre prediction model. It is understood that the music generation model and the timbre prediction model can be models based on the same type of network; however, in some embodiments, the structure and model parameters of the music generation model and the timbre prediction model can be different.

[0122] In some embodiments, the music generation model can be a module in a deep learning model used for music generation, and the timbre prediction model can be a module in the same deep learning model used for timbre prediction. That is, the music generation model and the timbre prediction model can be two modules in the same model that perform different functions. For example, they can be two modules in a Transformer model.

[0123] Of course, in other embodiments, the music generation model and the timbre prediction model can also be two independent models that can perform different functions respectively. For example, the music generation model can be a Transformer model, and the timbre prediction model can be an LSTM model, etc., without specific limitations.

[0124] In some embodiments, after obtaining the initial music in MIDI format, the initial music in MIDI format can be converted into an initial music in a format corresponding to the timbre prediction model, such as converting it into an initial music in pianoroll format, and then the initial music in pianoroll format is input into the timbre prediction model.

[0125] In some embodiments, the timbre prediction model may include a feature extraction layer and a classifier. After inputting initial music into the timbre prediction model, the feature extraction layer extracts musical features from the initial music to obtain its musical characteristics. Then, the classifier classifies the initial music based on these musical characteristics to obtain a classification result, and outputs timbre parameters corresponding to the classification result. These timbre parameters can be the timbre type corresponding to the initial music, the timbre label of the timbre material corresponding to the initial music, or the timbre number of the timbre material corresponding to the initial music, etc.

[0126] After obtaining the initial music and its corresponding timbre parameters, the target music can be obtained based on the timbre parameters and the initial music. In some embodiments, based on the timbre parameters, the timbre material corresponding to the initial music can be determined according to the mapping relationship between the timbre parameters and the timbre material. Then, the initial music and its corresponding timbre material can be synthesized to obtain the finished music (i.e., the target music).

[0127] In this embodiment of the disclosure, after obtaining the first music parameters based on the user's first input operation, the first music parameters are input into the music generation model to obtain the initial music, and then the initial music is input into the timbre prediction model to obtain the timbre parameters corresponding to the initial music. Finally, the target music is obtained based on the timbre parameters and the initial music.

[0128] In this embodiment, first music parameters can be obtained based on user operations, and initial music can be obtained based on the first music parameters. That is, it is not necessary to input the original music; entirely new music can be generated based on user operations, which can make the generated music more innovative and of higher musical value. At the same time, the timbre parameters obtained from the initial music are more compatible with the initial music, resulting in better musical effects for the target music obtained from the timbre parameters and the initial music.

[0129] In some embodiments, in step 101, obtaining the first music parameter based on the user's first input operation mainly includes the following steps:

[0130] Upon detecting the first input operation, determine the scenario type corresponding to the first input operation;

[0131] According to the scene type, a first music parameter corresponding to the scene type is obtained from a preset database; wherein, the preset database stores: the scene type, the first music parameter, and the mapping relationship between the scene type and the first music parameter.

[0132] The scene types here can include alarm clock ringtones, incoming call ringtones, message notification sounds, startup music, etc. In some embodiments, the first input operation may include the scene type input by the user. In this case, the scene type can be obtained from the information carried by the first input operation, and then the first music parameter corresponding to the scene type can be obtained from a preset database based on the obtained scene type.

[0133] Understandably, a mapping relationship between various scene types and various music parameters can be established in advance, and then the scene types and music parameters can be associated and stored in a preset database according to the mapping relationship.

[0134] For example, when the music parameters include style tag value, number of notes, and total music duration, the style tag value corresponding to the alarm clock ringtone application scenario can be quiet, the number of notes corresponding to the alarm clock ringtone can be the number of first notes, and the total music duration corresponding to the alarm clock ringtone can be the first total music duration. That is, a set of music parameters corresponding to the alarm clock ringtone is: quiet, number of first notes, and first total music duration.

[0135] For example, the style tag value corresponding to the message notification sound could be "joyful," the number of notes corresponding to the message notification sound could be the number of second notes, and the total duration of the music corresponding to the message notification sound could be the total duration of the second music. Considering that the duration of an alarm clock sound is generally longer and more complex than that of a message notification sound, the number of first notes can be greater than the number of second notes, and the total duration of the first music can be greater than the total duration of the second music.

[0136] In some embodiments, a scene type can correspond to multiple sets of music parameters. In this embodiment, the historical usage records of the music parameters can be obtained, and the music parameter with the most usage times among the multiple sets of music parameters corresponding to the scene type corresponding to the first input operation can be determined as the first music parameter.

[0137] In this way, users only need to input the scene type through the first input operation to accurately determine the first music parameter based on the scene type, without needing to manually input the music parameter. This method is more convenient and intelligent. Furthermore, retrieving the first music parameter corresponding to the scene type from the preset database is more efficient and yields more accurate first music parameters.

[0138] In some embodiments, the music generation method may further include:

[0139] Based on the scenario type, determine the target format corresponding to the scenario type;

[0140] In step 104, obtaining the target music based on the timbre parameters and the initial music may include:

[0141] Based on the timbre parameters and the initial music, music with an initial format is obtained;

[0142] Based on the format conversion strategy corresponding to the target format, music with the initial format is converted to obtain target music with the target format.

[0143] Understandably, music formats can differ across different application scenarios. These formats may include: CD format (Compact Disc Audio track), WAVE format (Waveform Audio), AIFF format (Audio Interchange File Format), MIDI format, or MP3 format (Moving Picture Experts Group Audio Layer III), etc.

[0144] To make the obtained target music more suitable for the application scenario, the target format can be determined based on the scenario type. After obtaining the initial format music based on the music parameters and the initial music, the initial format music can be converted to the target format music according to the format conversion strategy corresponding to the target format. The format conversion strategy here can include a format converter, such as an MP3 format converter, or a format conversion algorithm.

[0145] For example, the initial music obtained based on the music parameters and the initial music can be in MIDI format, while the music corresponding to the scene type can be in MP3 format. After obtaining the MIDI music based on the timbre parameters and the initial music, the MIDI music can be converted to the target MP3 music according to the format conversion strategy corresponding to the MP3 format.

[0146] In this way, converting the music in the initial format to the target format makes the resulting music more suitable for application scenarios corresponding to the scene type.

[0147] In some embodiments, the first music parameter includes: style tag value, number of notes, and total music duration.

[0148] In this embodiment, step 102, which involves inputting the first music parameters into the music generation model to obtain the initial music, includes:

[0149] The style tag value, the number of notes, and the total duration of the music are input into the encoding layer of the music generation model for encoding to obtain a synthesized feature sequence;

[0150] The synthesized feature sequence is input into the prediction layer of the music generation model to predict the music and obtain the initial music.

[0151] Here, the encoding layer of the music generation model encodes the first input music parameters according to the encoding strategy learned during model training, obtaining a synthesized feature sequence. The prediction layer of the music generation model can predict the music based on the synthesized feature sequence obtained from the encoding layer; that is, after inputting the synthesized feature sequence into the prediction layer, the prediction layer can output the predicted initial music.

[0152] The initial music predicted by the prediction layer can be a music sequence that is further encoded after the synthesized feature sequence. Understandably, the prediction layer can predict note information (e.g., notes, pitch, and duration) based on the synthesized feature sequence, and then encode this predicted note information after the synthesized feature sequence to obtain a music sequence containing the synthesized feature sequence.

[0153] In this way, by using a music generation model, initial music corresponding to the input style tag value, number of notes, and total music duration can be intelligently generated, making it possible to generate music by machine and reducing manual labor costs.

[0154] In some embodiments, the timbre parameters may include: timbre tags.

[0155] In this embodiment, step 104, obtaining the target music based on the timbre parameters and the initial music, may include:

[0156] Based on the timbre tag, a target timbre material corresponding to the timbre tag is determined from a preset timbre material library; wherein, the preset timbre material library pre-stores: the timbre tag, the timbre material, and the mapping relationship between the timbre tag and the timbre material;

[0157] The target timbre material and the initial music are synthesized to obtain the target music.

[0158] Understandably, a mapping relationship between each timbre material and each timbre tag can be pre-established, and then the timbre materials and timbre tags can be associated and stored in a preset timbre material library according to the mapping relationship. The timbre materials here can include: guzheng timbre materials, piano timbre materials, electronic keyboard timbre materials, guitar timbre materials, etc.

[0159] In some embodiments, the synthesis process of the target timbre material and the initial music may include: performing timbre loading processing on the initial music according to the target timbre material to achieve the synthesis of the timbre material and the initial music, that is, loading the target timbre material onto each note of the initial music.

[0160] It's understandable that the initial music can be music without any blended sound materials. The resulting target music can have different musical effects depending on the sound materials used to synthesize the initial music. Therefore, to achieve a better musical effect, sound materials that are more compatible with the initial music can be blended with it.

[0161] Here, the timbre labels predicted based on the initial music are the timbre labels corresponding to the initial music. Therefore, the target timbre material determined based on the timbre labels is also the timbre material corresponding to the initial music, which can be well adapted to the initial music. Therefore, the target timbre material is synthesized with the initial music, and the resulting music has a better musical effect.

[0162] Figure 3 This is a flowchart illustrating a music generation method according to an exemplary embodiment of the present disclosure. Figure 3 .like Figure 3 As shown, the music generation method may further include the following steps:

[0163] Step 301: Update the target music and the first music parameters corresponding to the target music to the target music library;

[0164] Step 302: If a second input operation by the user is detected, obtain the second music parameters;

[0165] The second music parameter is compared with the first music parameter in the target music library to obtain the comparison result;

[0166] Step 303: Based on the comparison results, determine the music corresponding to the second input operation from the target music library.

[0167] The target music library here can be a music database obtained based on the generated target music. After obtaining a new target music each time, the obtained target music and the first music parameters corresponding to the target music can be saved to the target music library to update the target music library.

[0168] In this embodiment, the second input operation may include a user's operation based on an electronic device to input a second music parameter. For example, it may include voice input or gesture input. For instance, text or symbols can be typed using gestures. The input operation may also include button presses, clicks, etc. In some embodiments, a mapping relationship between various input operations and music parameters can be pre-set. When a corresponding input operation is detected, the corresponding music parameter can be obtained based on the input operation and the mapping relationship. For example, if the second input operation is a double-click, the second music parameter could be a quiet music parameter.

[0169] In some embodiments, an operation interface can be output through the touch screen of the electronic device, through which the user performs a second input operation, thereby inputting user-defined second music parameters into the electronic device. Alternatively, an application can be installed on the electronic device, which the user can then trigger to access the operation interface and perform the corresponding operation.

[0170] In this embodiment, the second music parameter can be a music parameter corresponding to the second input operation. This music parameter can include parameters such as style tag value, number of notes, and total music duration. The style tag value can be a tag value corresponding to a music style; for example, a music style can include quiet, sad, rock, etc. The number of notes can be the total number of notes in the target music. The total music duration can be the sum of the durations of each note in the target music, where the duration of each note represents its relative duration. In some embodiments, the second music parameter may also include timbre parameters, pitch parameters, etc.

[0171] For example, when the second input operation is a user's voice input, the electronic device executing the music generation method may include a sound acquisition module (e.g., a microphone) and a processor. The user's voice input may contain second music parameters. The sound acquisition module can receive the user's voice input and transmit it to the processor. The processor parses the voice and obtains the second music parameters from the parsed information.

[0172] When the second input operation is a user's text input operation, the electronic device executing the music generation method may include a text input module such as a keyboard or touch screen, and a processor. The text input by the user may contain the second music parameters. The text input module can receive the text input by the user and transmit the text to the processor. The processor parses the text and obtains the second music parameters from the parsed information.

[0173] When the second input operation is a user click, the electronic device executing the music generation method may include a touch screen and a processor. The touch screen can display multiple parameter options, which the user can select by clicking. After receiving the user's second input operation for a target parameter option, the touch screen can transmit a signal corresponding to the target parameter option to the processor. Upon receiving the signal, the processor determines the target parameter option corresponding to that signal, and then, based on the target parameter option and its mapping relationship with music parameters, determines the second music parameter corresponding to the target parameter option. This allows for one-click determination of the second music parameter, improving the efficiency of determining the second music parameter and the convenience of user operation.

[0174] In some embodiments, the second input operation may carry a second music parameter. In this embodiment, the information carried in the second input operation can be parsed, and the second music parameter can be obtained from the carried information. For example, a user can directly input the second music parameter through a voice input operation, in which case the second music parameter can be obtained from the information carried by the user's voice input operation. In some embodiments, the second input operation may carry information related to the second music parameter. In this embodiment, the information carried in the second input operation can be parsed, and the information related to the second music parameter can be obtained from the carried information, and the second music parameter can be obtained based on the information related to the second music parameter. For example, a user can directly input a scene type through a voice input operation, in which case the scene type can be obtained from the information carried by the user's voice input operation, and then the second music parameter corresponding to the scene type can be determined based on the scene type and the preset mapping relationship between scene type and music parameter.

[0175] After obtaining the second music parameter, it can be compared with each first music parameter in the target music library to obtain the comparison result. This comparison result can include the similarity between the second music parameter and each first music parameter. Then, the target music corresponding to the first music parameter whose similarity to the second music parameter is greater than or equal to a preset similarity threshold is determined as the music corresponding to the second input operation.

[0176] Here, based on the user's second input operation, the music corresponding to the second input operation can be directly determined from the target music library, which is more efficient.

[0177] In other embodiments, the music generation model can be trained based on the target music to obtain the target music generation model. Training the music generation model with user-defined target music allows the user to directly obtain the music they desire, which is not only faster and more convenient but also ensures that the music is more closely aligned with the user's needs and preferences.

[0178] Figure 4 This is a flowchart illustrating a music generation method according to an exemplary embodiment of the present disclosure. Figure 4 .like Figure 4 As shown, the music generation method mainly includes the following steps:

[0179] Step 401: Train the initial music generation model based on the sample music in the first training set to obtain the music generation model; train the initial timbre prediction model based on the sample music in the second training set to obtain the timbre prediction model.

[0180] Here, the method for training the initial music generation model to obtain the music generation model can refer to steps 201 to 203 above; the method for training the initial timbre prediction model to obtain the timbre prediction model can refer to steps 204 to 206 above.

[0181] Step 402: Obtain the first music parameters based on the user's first input operation.

[0182] The user's first input operation can include voice input, text input, key input, click, etc. The first music parameter can be the music parameter corresponding to the first input operation. The music parameter can include parameters such as style tag value, number of notes, and total music duration.

[0183] In some embodiments, the first input operation may carry a first music parameter. In this embodiment, the information carried in the first input operation can be parsed, and the first music parameter can be obtained from the carried information. In other embodiments, the first input operation may carry information related to the first music parameter. In this embodiment, the information carried in the first input operation can be parsed, and the information related to the first music parameter can be obtained from the carried information, and the first music parameter can be obtained based on the information related to the first music parameter.

[0184] Step 403: Input the first music parameters into the music generation model to obtain the initial music.

[0185] The music generation model here can be a trained model used to generate music based on input music parameters. In some embodiments, the music generation model can be a deep learning model, such as a CNN-based model, an RNN-based model, an LSTM-based model, or a Transformer-based model.

[0186] Step 404: Input the initial music into the timbre prediction model to obtain the timbre parameters corresponding to the initial music.

[0187] The timbre prediction model here can be a trained model used to determine the timbre parameters corresponding to the initial music input. In some embodiments, the timbre prediction model can be a deep learning model, such as a CNN-based model, an RNN-based model, an LSTM-based model, or a Transformer-based model.

[0188] Step 405: Obtain the target music based on the timbre parameters and the initial music.

[0189] After obtaining the initial music and its corresponding timbre parameters, the target music can be obtained based on the timbre parameters and the initial music. In some embodiments, based on the timbre parameters, the timbre material corresponding to the initial music can be determined according to the mapping relationship between the timbre parameters and the timbre material. Then, the initial music and its corresponding timbre material can be synthesized to obtain the finished music (i.e., the target music).

[0190] In this embodiment of the disclosure, after obtaining the first music parameters based on the user's first input operation, the first music parameters are input into the music generation model to obtain the initial music, and then the initial music is input into the timbre prediction model to obtain the timbre parameters corresponding to the initial music. Finally, the target music is obtained based on the timbre parameters and the initial music.

[0191] In this embodiment, first music parameters can be obtained based on user operations, and initial music can be obtained based on the first music parameters. That is, it is not necessary to input the original music; entirely new music can be generated based on user operations, which can make the generated music more innovative and of higher musical value. At the same time, the timbre parameters obtained from the initial music are more compatible with the initial music, resulting in better musical effects for the target music obtained from the timbre parameters and the initial music.

[0192] Figure 5 This is a structural block diagram of a music generation apparatus according to an exemplary embodiment of the present disclosure. Figure 5 As shown, the music generation device 500 mainly includes:

[0193] The first acquisition module 501 is configured to acquire the first music parameters based on the user's first input operation;

[0194] The first generation module 502 is configured to input the first music parameters into the music generation model to obtain the initial music;

[0195] Prediction module 503 is configured to input the initial music into the timbre prediction model to obtain timbre parameters corresponding to the initial music;

[0196] The processing module 504 is configured to obtain the target music based on the timbre parameters and the initial music.

[0197] In some embodiments, the first acquisition module 501 is configured as follows:

[0198] Upon detecting the first input operation, determine the scenario type corresponding to the first input operation;

[0199] Based on the scene type, retrieve the first music parameter corresponding to the scene type from the preset database;

[0200] The preset database contains: the scene type, the first music parameter, and the mapping relationship between the scene type and the first music parameter.

[0201] In some embodiments, the apparatus further includes:

[0202] The first determining module is configured to determine the target format corresponding to the scene type based on the scene type;

[0203] The processing module 504 is configured as follows:

[0204] Based on the timbre parameters and the initial music, music with an initial format is obtained;

[0205] Based on the format conversion strategy corresponding to the target format, music with the initial format is converted to obtain target music with the target format.

[0206] In some embodiments, the first music parameter includes: style tag value, number of notes, and total music duration;

[0207] The first generation module 502 is configured as follows:

[0208] The style tag value, the number of notes, and the total duration of the music are input into the encoding layer of the music generation model for encoding to obtain a synthesized feature sequence;

[0209] The synthesized feature sequence is input into the prediction layer of the music generation model to predict the music and obtain the initial music.

[0210] In some embodiments, the timbre parameters include: timbre tags;

[0211] The processing module 504 is configured as follows:

[0212] Based on the timbre tag, a target timbre material corresponding to the timbre tag is determined from a preset timbre material library; wherein, the preset timbre material library pre-stores: the timbre tag, the timbre material, and the mapping relationship between the timbre tag and the timbre material;

[0213] The target timbre material and the initial music are synthesized to obtain the target music.

[0214] In some embodiments, the apparatus further includes:

[0215] The second acquisition module is configured to acquire sample music from a preset sound source;

[0216] The second generation module is configured to input the sample music into the initial music generation model, and obtain the predicted music through the initial music generation model;

[0217] The adjustment module is configured to adjust the model parameters of the initial music generation model based on the difference between the predicted music and the sample music, thereby obtaining the music generation model.

[0218] In some embodiments, the apparatus further includes:

[0219] The update module is configured to update the target music and the first music parameters corresponding to the target music to the target music library;

[0220] The third acquisition module is configured to acquire the second music parameters when the user's second input operation is detected;

[0221] The comparison module is configured to compare the second music parameter with the first music parameter in the target music library to obtain a comparison result.

[0222] The second determining module is configured to determine the music corresponding to the second input operation from the target music library based on the comparison result.

[0223] Figure 6 This is a hardware structure block diagram of an electronic device according to an exemplary embodiment of the present disclosure. Figure 1 For example, electronic device 600 can be a mobile phone, computer, digital broadcasting terminal, messaging device, game console, tablet device, medical device, fitness equipment, personal digital assistant, etc.

[0224] Reference Figure 6 The electronic device 600 may include one or more of the following components: a processing component 602, a memory 604, a power supply component 606, a multimedia component 608, an audio component 610, an input / output (I / O) interface 612, a sensor component 614, and a communication component 616.

[0225] Processing component 602 typically controls the overall operation of electronic device 600, such as operations associated with display, telephone calls, data communication, camera operation, and recording operations. Processing component 602 may include one or more processors 620 to execute instructions to perform all or part of the steps of the methods described above. Furthermore, processing component 602 may include one or more modules to facilitate interaction between processing component 602 and other components. For example, processing component 602 may include a multimedia module to facilitate interaction between multimedia component 608 and processing component 602.

[0226] Memory 604 is configured to store various types of data to support the operation of electronic device 600. Examples of this data include instructions for any application or method operating on electronic device 600, contact data, phonebook data, messages, pictures, videos, etc. Memory 604 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.

[0227] Power supply component 606 provides power to various components of electronic device 600. Power supply component 606 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 600.

[0228] Multimedia component 608 includes a screen that provides an output interface between the electronic device 600 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of the touch or swipe action but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 608 includes a front-facing camera and / or a rear-facing camera. When the electronic device 600 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.

[0229] Audio component 610 is configured to output and / or input audio signals. For example, audio component 610 includes a microphone (MIC) configured to receive external audio signals when electronic device 600 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 604 or transmitted via communication component 616. In some embodiments, audio component 610 also includes a speaker for outputting audio signals.

[0230] I / O interface 612 provides an interface between processing component 602 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.

[0231] Sensor assembly 614 includes one or more sensors for providing state assessments of various aspects of electronic device 600. For example, sensor assembly 614 can detect the on / off state of electronic device 600, the relative positioning of components such as the display and keypad of electronic device 600, changes in position of electronic device 600 or a component of electronic device 600, the presence or absence of user contact with electronic device 600, orientation or acceleration / deceleration of electronic device 600, and temperature changes of electronic device 600. Sensor assembly 614 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 614 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 614 may also include an accelerometer, gyroscope, magnetometer, pressure sensor, or temperature sensor.

[0232] Communication component 616 is configured to facilitate wired or wireless communication between electronic device 600 and other devices. Electronic device 600 can access wireless networks based on communication standards, such as Wi-Fi, 4G, or 5G, or combinations thereof. In one exemplary embodiment, communication component 616 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 616 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.

[0233] In an exemplary embodiment, the electronic device 600 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the methods described above.

[0234] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 604 including instructions, which can be executed by a processor 620 of an electronic device 600 to perform the above-described method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.

[0235] A non-transitory computer-readable storage medium, when instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to perform a music generation method, comprising:

[0236] Based on the user's first input, obtain the first music parameters;

[0237] Input the first music parameters into the music generation model to obtain the initial music;

[0238] The initial music is input into the timbre prediction model to obtain the timbre parameters corresponding to the initial music;

[0239] The target music is obtained based on the timbre parameters and the initial music.

[0240] Figure 7 This is a hardware structure block diagram of an electronic device according to an exemplary embodiment. Figure 2 For example, electronic device 700 can be provided as a server. (See reference...) Figure 7 The electronic device 700 includes a processing component 722, which further includes one or more processors, and memory resources represented by memory 732 for storing instructions, such as application programs, that can be executed by the processing component 722. The application programs stored in memory 732 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processing component 722 is configured to execute instructions to perform a music generation method, including:

[0241] Based on the user's first input, obtain the first music parameters;

[0242] Input the first music parameters into the music generation model to obtain the initial music;

[0243] The initial music is input into the timbre prediction model to obtain the timbre parameters corresponding to the initial music;

[0244] The target music is obtained based on the timbre parameters and the initial music.

[0245] Electronic device 700 may also include a power supply component 726 configured to perform power management of electronic device 700, a wired or wireless network interface 750 configured to connect electronic device 700 to a network, and an input / output (I / O) interface 757. Electronic device 700 may operate on an operating system stored in memory 732, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, or similar.

[0246] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the following claims.

[0247] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.

Claims

1. A music generation method characterized by, The method comprises: In the case of detecting a first input operation of a user, determining a scene type corresponding to the first input operation; According to the scene type, obtaining a first music parameter corresponding to the scene type from a preset database; wherein the preset database pre-stores the scene type, the first music parameter, and a mapping relationship between the scene type and the first music parameter; the first music parameter includes a style label value, a number of notes, and a total music time value; Inputting the first music parameter into an encoding layer of a music generation model for encoding to obtain a synthesized feature sequence; Inputting the synthesized feature sequence into a prediction layer of the music generation model for music prediction to obtain predicted note information; Encoding the predicted note information and the first music parameter to obtain initial music; Inputting the initial music into a timbre prediction model to obtain a timbre parameter corresponding to the initial music; According to the timbre parameter and the initial music, obtaining target music.

2. The method of claim 1, wherein, The method further comprises: Based on the scene type, determining a target format corresponding to the scene type; According to the timbre parameter and the initial music, obtaining target music, comprises: According to the timbre parameter and the initial music, obtaining music with an initial format; Based on a format conversion strategy corresponding to the target format, performing format conversion on the music with the initial format to obtain target music with the target format.

3. The method of claim 1, wherein, The timbre parameter includes a timbre label; according to the timbre parameter and the initial music, obtaining target music, comprises: According to the timbre label, determining a target timbre material corresponding to the timbre label from a preset timbre material library; wherein the preset timbre material library pre-stores the timbre label, timbre material, and a mapping relationship between the timbre label and the timbre material; Synthesizing the target timbre material and the initial music to obtain the target music.

4. The method of claim 1, wherein, The method further comprises: Obtaining sample music from a preset sound source; Inputting the sample music into an initial music generation model to obtain predicted music through the initial music generation model; According to the difference between the predicted music and the sample music, adjusting model parameters of the initial music generation model to obtain the music generation model.

5. The method of claim 1, wherein, The method further comprises: Updating the target music and the first music parameter corresponding to the target music to a target music library; In the case of detecting a second input operation of a user, obtaining a second music parameter; Comparing the second music parameter with the first music parameter in the target music library to obtain a comparison result; According to the comparison result, determining music corresponding to the second input operation from the target music library.

6. A music generation apparatus characterized by comprising: The device comprises: An acquisition module is configured to, in a case where a first input operation of a user is detected, determine a scene type corresponding to the first input operation; and acquire, according to the scene type, a first music parameter corresponding to the scene type from a preset database; wherein the preset database pre-stores the scene type, the first music parameter, and a mapping relationship between the scene type and the first music parameter; and the first music parameter includes a style label value, a number of notes, and a total music time value. A generation module is configured to input the first music parameter into an encoding layer of a music generation model to obtain a synthesized feature sequence; input the synthesized feature sequence into a prediction layer of the music generation model to obtain predicted note information; and encode the predicted note information and the first music parameter to obtain initial music. A prediction module is configured to input the initial music into a timbre prediction model to obtain a timbre parameter corresponding to the initial music. A processing module is configured to obtain target music according to the timbre parameter and the initial music.

7. An electronic device, comprising: comprise: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to implement the steps of any one of the music generation methods of claims 1-5 when executed.

8. A non-transitory computer-readable storage medium, when instructions in the storage medium are executed by a processor of an electronic device, enable the electronic device to perform the steps of any one of the music generation methods of claims 1-5.

Citation Information

Patent Citations

  • Meditation music generation method and device, equipment and storage medium

    CN113032615A

  • Automatic music generation

    CN113689835A

  • Intelligent tone tuning method and device based on timbre, medium and computing equipment

    CN113870873A