Music generation method and device, computer readable medium and electronic device

By generating musical event sequences and performing feature extraction and mapping, the problem of the complexity and high cost of traditional musical composition has been solved, enabling automatic and flexible musical composition and lowering the barrier to entry.

CN116631359BActive Publication Date: 2026-03-10TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-11
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

Traditional music composition is complex and costly, and it requires a high level of technical skill from composers, resulting in a high barrier to entry.

Method used

By acquiring basic musical information, performing format conversion processing to generate basic instrument digital interface data, generating musical event sequences, and obtaining target musical data through feature extraction and mapping processing, musical composition is carried out using a preset sequence prediction model.

Benefits of technology

It enables automatic composition, lowers the threshold and cost of composition, provides multiple composition modes, and improves the flexibility of composition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116631359B_ABST
    Figure CN116631359B_ABST
Patent Text Reader

Abstract

The application discloses a music generation method and device, a computer readable medium and an electronic device. The method comprises: obtaining basic music information for generating target music data, the basic music information comprising at least one type of music data; performing format conversion processing on the basic music information to obtain basic musical instrument digital interface data corresponding to the basic music information; generating music events according to each type of music data in the basic musical instrument digital interface data, and sorting the music events to generate a music event sequence; performing feature extraction and mapping processing on the music event sequence, and obtaining target music data based on the processing result. The technical scheme of the application realizes automatic music creation and reduces the artificial dependence in the music creation process. Whether the basic music information is an audio data or a music data, the target music data can be generated, and music creators can realize music creation without being familiar with music theory knowledge.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of data processing technology, and specifically relates to a method, apparatus, computer-readable medium, and electronic device for generating music. Background Technology

[0002] Music plays a vital role in people's daily lives, but traditional music composition relies on manual labor and places high demands on composers. Composers must not only understand music theory but also possess creative inspiration, making the barrier to entry and the labor costs of music composition very high. Furthermore, with technological advancements, the types of music are increasing, and the technologies and equipment used in music composition are becoming more complex. Even users with music theory knowledge may find themselves unable to create satisfactory music due to the complex software and hardware operations involved in the composition process, further raising the barrier to entry for music composition.

[0003] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this application, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention

[0004] The purpose of this application is to provide a method, apparatus, computer-readable medium, and electronic device for generating music, in order to solve the problems of complex and costly traditional music composition operations.

[0005] Other features and advantages of this application will become apparent from the following detailed description, or may be learned in part from practice of this application.

[0006] According to one aspect of the embodiments of this application, a method for generating a musical piece is provided, comprising:

[0007] Obtain basic music information for generating target music data, wherein the basic music information includes at least one type of music data;

[0008] The basic musical information is converted to obtain the basic instrument digital interface data corresponding to the basic musical information.

[0009] Music events are generated based on the various types of music data in the basic instrument digital interface data, and the music events are sorted to generate a music event sequence.

[0010] Feature extraction and mapping are performed on the musical event sequence, and the target musical data is obtained based on the processing results.

[0011] According to one aspect of the embodiments of this application, a musical composition generation apparatus is provided, comprising:

[0012] The data acquisition module is used to acquire basic music information for generating target music data, wherein the basic music information includes at least one type of music data;

[0013] The format conversion module is used to perform format conversion processing on the basic music information to obtain the basic instrument digital interface data corresponding to the basic music information.

[0014] The music event generation module is used to generate music events based on the music data of various types in the basic instrument digital interface data, and to sort the music events to generate a music event sequence.

[0015] The target music generation module is used to extract and map features from the music event sequence and obtain target music data based on the processing results.

[0016] In one embodiment of this application, the basic music information is audio data composed of various music data; the format conversion module includes:

[0017] The format conversion unit is used to perform format conversion processing on the audio data to obtain the original instrument digital interface data;

[0018] A beat detection unit is used to perform beat detection on the audio data and obtain a beat detection result, wherein the beat detection result includes the actual occurrence time of each beat in the audio data;

[0019] The calibration unit is used to calibrate the original instrument digital interface data according to the beat detection result, so as to obtain the basic instrument digital interface data corresponding to the basic music information.

[0020] In one embodiment of this application, the verification unit is specifically used for:

[0021] The number of beats per minute corresponding to the first beat is determined based on the time interval between the first beat and the second beat in the beat detection results, wherein the second beat is the beat that follows the first beat and is adjacent to the first beat;

[0022] The target duration of the first note corresponding to the first beat in the original instrument digital interface data is determined based on the number of beats per minute corresponding to the first beat.

[0023] If the recording duration of the first beat in the original instrument digital interface data is different from the target duration, then the recording duration is adjusted according to the target duration.

[0024] In one embodiment of this application, the various types of musical data include measure data, chord data, and note data; the musical event generation module includes:

[0025] The chord event generation unit is used to perform chord recognition on the basic instrument digital interface data to obtain chord data, and generate chord events based on the chord data;

[0026] The measure event generation unit is used to determine the measure data of the basic instrument digital interface data based on the beat detection result, and generate measure events based on the measure data.

[0027] A note event generation unit is used to detect note data in the basic musical instrument digital interface data and generate note events based on the note data;

[0028] The event sequence generation unit is used to arrange the chord events, the measure events, and the note events in a time sequence to generate a musical event sequence.

[0029] In one embodiment of this application, the chord event generation unit is specifically used for:

[0030] Using time as a reference, the chord data in the basic instrument digital interface data is determined by sliding a window of preset length through the window and based on the chromaticity characteristics of each window.

[0031] In one embodiment of this application, the note data includes note position, note type, note duration, and note dynamics, and the note events include note position events, note duration events, and note dynamics events; the note event generation unit is specifically used for:

[0032] Generate a note type event based on the note type in the basic musical instrument digital interface data;

[0033] The duration of each measure in the basic instrument digital interface data is divided into multiple first moments. The first moment closest to the start time of the note is taken as the start time of the note, and note position events corresponding to each note are generated according to the start time of each note.

[0034] The duration of each measure in the basic instrument digital interface data is divided into multiple second moments. The second moment closest to the end time of the note is taken as the end time of the note. The note duration is determined according to the start time and end time of each note. The note duration event corresponding to each note is generated according to the note duration of each note.

[0035] Based on preset mapping rules, the note velocity representation of each note in the basic musical instrument digital interface data is mapped to the target velocity representation, and the note velocity event corresponding to each note is generated according to the target velocity representation of each note.

[0036] In one embodiment of this application, the basic musical information consists of one type of musical data; the format conversion module is used for:

[0037] The music data is converted according to the data format of the basic instrument digital interface data to obtain the basic instrument digital interface data corresponding to the music data.

[0038] In one embodiment of this application, the target music generation module is specifically used for:

[0039] The music event sequence is subjected to feature extraction and mapping processing by a preset sequence prediction model to obtain a target music sequence of a specified duration, wherein the target music sequence includes multiple target music events;

[0040] Multiple target music events in the target music sequence are converted into target instrument digital interface data to obtain target music data.

[0041] In one embodiment of this application, the apparatus further includes a model building module, which is specifically used for:

[0042] The sample audio data is processed by source separation to extract sample audio track data; the sample audio track data is processed by format conversion to obtain sample instrument digital interface data; sample music events are generated based on each piece of music data in the sample instrument digital interface data; a preset number of sample music events are sorted to generate a sample music event sequence, and a prediction model is trained based on the sample music event sequence to obtain a preset sequence prediction model.

[0043] According to one aspect of the embodiments of this application, a computer-readable medium is provided, on which a computer program is stored, which, when executed by a processor, implements the method for generating music as described in the above technical solutions.

[0044] According to one aspect of the embodiments of this application, an electronic device is provided, the electronic device comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute a method for generating music as described above by executing the executable instructions.

[0045] According to one aspect of the embodiments of this application, a computer program product or computer program is provided, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the method for generating music as described in the above technical solutions.

[0046] In the technical solution provided in this application embodiment, basic instrument digital interface data is generated from basic musical information, which in turn generates a musical event sequence. Finally, the target musical data is obtained from the musical event sequence, realizing automatic composition of music and reducing the manual dependence in the composition process. Regardless of whether the basic musical information is a piece of audio data or a piece of musical data, the target musical data can be generated. The composition process is simple, allowing composers to create music even without familiarity with music theory, lowering the threshold and cost of composition. Furthermore, when the basic musical information is a piece of audio data, it is equivalent to continuing the composition based on that audio data; when the basic musical information is a piece of musical data, it is equivalent to generating a new piece of music from scratch based on a piece of musical data. Therefore, there are multiple modes of composition, and the duration of the target musical data can be specified, greatly improving the flexibility of composition.

[0047] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description

[0048] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.

[0049] Figure 1 An exemplary system architecture block diagram illustrating the application of the technical solution of this application is shown schematically.

[0050] Figure 2 A flowchart illustrating a method for generating music according to an embodiment of this application is shown schematically.

[0051] Figure 3 A flowchart illustrating a format conversion process provided in one embodiment of this application is shown schematically.

[0052] Figure 4 A flowchart illustrating the generation of a musical event sequence is shown in one embodiment of this application.

[0053] Figure 5 A flowchart illustrating a method for generating music according to an embodiment of this application is shown schematically.

[0054] Figure 6 A schematic block diagram of the musical composition generation apparatus provided in the embodiments of this application is shown.

[0055] Figure 7A schematic diagram of a computer system architecture suitable for implementing the embodiments of this application is shown. Detailed Implementation

[0056] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided to make this application more comprehensive and complete, and to fully convey the concept of the exemplary embodiments to those skilled in the art.

[0057] Furthermore, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to give a thorough understanding of embodiments of this application. However, those skilled in the art will recognize that the technical solutions of this application can be practiced without one or more of the specific details, or other methods, components, apparatuses, steps, etc., can be employed. In other instances, well-known methods, apparatuses, implementations, or operations are not shown or described in detail to avoid obscuring various aspects of this application.

[0058] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0059] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily have to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.

[0060] Figure 1 An exemplary system architecture block diagram illustrating the application of the technical solution of this application is shown schematically.

[0061] like Figure 1 As shown, the system architecture 100 may include terminal devices 110, a network 120, and a server 130. Terminal devices 110 may include smartphones, tablets, laptops, smart voice interaction devices, smart home appliances, in-vehicle terminals, etc. Server 130 may be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. Network 120 may be a communication medium of various connection types capable of providing a communication link between terminal devices 110 and server 130, such as a wired communication link or a wireless communication link.

[0062] Depending on the implementation requirements, the system architecture in this application embodiment can have any number of terminal devices, networks, and servers. For example, server 130 can be a server group composed of multiple server devices. In addition, the technical solutions provided in this application embodiment can be applied to terminal device 110, or to server 130, or can be implemented jointly by terminal device 110 and server 130. This application does not impose any special limitations on this.

[0063] In one embodiment of this application, the music generation method provided in this application is implemented by a terminal device 110. For example, the terminal device 110 acquires basic music information for generating target music data. The basic music information includes at least one type of music data. For example, the basic music information is a piece of audio data with a certain duration, or it can be a single piece of music data (such as tempo, chords, etc.). Then, the terminal device 110 performs format conversion processing on the basic music information to obtain the basic instrument digital interface data corresponding to the basic music information. Generally, the instrument digital interface data is MIDI (Musical Instrument Digital Interface) data. When the basic music information is a piece of audio data, the audio data is transcribed to obtain basic MIDI data; when the basic music information is a single piece of music data, the music data is directly used as the basic MIDI data. Next, the terminal device 110 generates music events based on the various types of music data in the basic instrument digital interface data, and sorts the music events to generate a music event sequence. Music events include tempo events, chord events, etc. Finally, the terminal device 110 performs feature extraction and mapping processing on the music event sequence, and obtains the target music data based on the processing results. This feature extraction and mapping processing can be achieved through a pre-trained model.

[0064] In one embodiment of this application, the music generation method provided in this application is implemented by server 130. For example, server 130 obtains basic music information for generating target music data. The basic music information includes at least one type of music data, which can be obtained from terminal device 110 or stored by server 130 itself. Then, server 130 performs format conversion processing on the basic music information to obtain basic instrument digital interface data corresponding to the basic music information. Next, server 130 generates music events based on each type of music data in the basic instrument digital interface data, and sorts each music event to generate a music event sequence. Finally, server 130 performs feature extraction and mapping processing on the music event sequence, and obtains the target music data based on the processing results. After server 130 generates the target music data, it can send the target music data to terminal device 110, which then feeds the target music data back to the target object so that the target object can play the target music data.

[0065] The method for generating music provided in this application will be described in detail below with reference to specific implementation methods.

[0066] Figure 2 A flowchart illustrating a method for generating music according to an embodiment of this application is shown schematically, such as... Figure 2 As shown, the method includes steps 210 to 240, as detailed below:

[0067] Step 210: Obtain basic music information for generating target music data. The basic music information includes at least one type of music data.

[0068] Specifically, the target music data refers to the music data generated by the music generation method of this application embodiment, and the basic music information is the reference data for generating the target music data. The basic music information includes at least one type of music data, and the type of music data mainly refers to the meaning of the music data in the basic music information, such as the type of music data being measures, chords, notes, tempo, duration, etc.

[0069] In one embodiment of this application, the basic music information can be a segment of audio data with a certain duration. In this case, the basic music information is equivalent to a short piece of music and should include various types of music data, such as measure data, chord data, note data, etc.

[0070] In one embodiment of this application, the basic musical information can be musical data, such as a chord, a tempo, or a musical duration. This musical data can be externally input or randomly generated.

[0071] Step 220: Perform format conversion processing on the basic music information to obtain the basic instrument digital interface data corresponding to the basic music information.

[0072] Specifically, the instrument digital interface data is MIDI (Musical Instrument Digital Interface) data. MIDI is the most widely used music standard format in the music production industry. It is a format that uses digital control signals of notes to record music. That is, MIDI data does not record sound signals, but rather instructions such as notes and control parameters. MIDI data instructs the device that can process MIDI data to do what and how, such as which note to play and at what volume.

[0073] Generally, when the basic musical information is audio data of a certain duration, the audio data usually records sound signals in the same storage format as sound signals, such as MP3 or WAVE. To enable computers to further process this basic musical information, it is necessary to perform format conversion to obtain the corresponding basic instrument digital interface data. This format conversion can be achieved through transcription techniques, such as transcription based on onset and framewise detectors.

[0074] In one embodiment of this application, when the basic musical information is audio data, considering that the audio data may consist of a performance by a primary instrument combined with performances by multiple auxiliary instruments, and that the performances by auxiliary instruments are usually easily replaceable, the processing of the basic musical information only requires processing the performances by the primary instrument. Therefore, before performing format conversion processing on the audio data, the musical data corresponding to each instrument in the audio data can be separated using sound source separation technology, such as the Spleeter sound source separation technology. The musical data corresponding to one instrument is called a track data, such as piano performance data being piano track data, bass performance data being bass track data, etc. Generally, the primary instrument in audio data is often the piano. The format conversion process for the audio data includes: firstly, extracting the piano track data from the audio data using sound source separation technology, and then converting the piano track data into the corresponding basic MIDI data using piano transcription technology.

[0075] In one embodiment of this application, when the basic music information consists of one type of music data, the format conversion process is achieved by converting the music data according to the data format requirements of MIDI data. For example, if MIDI data is recorded using hexadecimal encoding, the format conversion process is to convert the music data into the corresponding hexadecimal encoded data.

[0076] In one embodiment of this application, when the basic music information is audio data, the format conversion process is as follows: Figure 3 As shown, steps 310 to 330 are included, specifically:

[0077] Step 310: Perform format conversion processing on the audio data to obtain the original instrument digital interface data.

[0078] Specifically, the audio data undergoes format conversion processing, and the converted data becomes the original audio data interface data.

[0079] Step 320: Perform beat detection on the audio data to obtain the beat detection result, which includes the actual occurrence time of each beat in the audio data.

[0080] Specifically, beat detection determines the actual occurrence time of each beat in audio data, that is, the start time position of each beat in the audio data. For example, if there is a beat at 0 minutes and 12 seconds in the audio data, then 0 minutes and 12 seconds is the actual occurrence time of this beat. Beat detection can also detect whether each beat is a strong or weak beat. Generally, a measure in music usually starts with a strong beat, so beat detection can also determine the start time of the measure. Beat detection can be implemented using a beat detector based on a recurrent neural network.

[0081] Step 330: Based on the beat detection results, calibrate the original instrument digital interface data to obtain the basic instrument digital interface data corresponding to the basic music information.

[0082] Specifically, in audio data, each beat has the same duration. However, due to the different recording methods used for music data in audio data and the original instrument digital interface (IDIA) data, errors may occur during the conversion process, causing a discrepancy between the actual duration of each beat in the original IDA data and the actual duration of each beat in the audio data. Calibrating the original IDA data based on the beat detection results involves calibrating the duration of each beat, thereby obtaining the final required basic IDA data. This ensures that the beats in the subsequent processing of the basic IDA data are consistent with the beats in the audio data, thus improving the quality of the generated target music data.

[0083] In one embodiment of this application, the calibration process includes: determining the number of beats per minute corresponding to the first beat based on the time interval between the first beat and the second beat in the beat detection result, wherein the second beat is the beat after the first beat and adjacent to the first beat; determining the target duration of the first note corresponding to the first beat in the original instrument digital interface data based on the number of beats per minute corresponding to the first beat; and adjusting the recording duration based on the target duration if the recording duration of the first note in the original instrument digital interface data is different from the target duration.

[0084] Specifically, since the beat detection results record the start time position of each beat, the time interval between the start times of two adjacent beats is the beat length, or beat duration. Beats per minute (BPM) refers to the number of beats contained in one minute. Knowing the beat duration of a beat allows us to calculate the number of beats per minute. For example, if the actual occurrence time of the first beat is 0 minutes and 12 seconds, and the actual occurrence time of the second beat adjacent to the first beat is 0 minutes and 13 seconds, then the time interval between the first and second beats is 1 second, meaning the beat duration of the first beat is 1 second, and the bpm is 60.

[0085] In MIDI data, ticks are the unit of time. MIDI specifies how many ticks a note represents and sets the default bpm for each beat. Therefore, in raw instrument digital interface (IDIA) data, the bpm for each beat is the same, but in reality, each beat may have a different bpm. Generally, one note corresponds to one beat, so the bpm for the first beat is the target duration of the first note. Assuming the default beats per minute in raw IDA data is 100 bpm, the recording duration of the first note is 200 ticks, and the calculated beats per minute is 50 bpm, then the target duration of the first note should be 400 ticks. It's clear that the recording duration of the first note is inconsistent with the target duration; therefore, the recording duration of the first note is adjusted to 400 ticks.

[0086] Continue to refer to Figure 2 Step 230: Generate music events based on the music data of each type in the basic instrument digital interface data, sort the music events, and generate a music event sequence.

[0087] Specifically, a musical event represents a type of musical data. For example, measure data generates measure events, chord data generates chord events, and note data generates note events. By arranging these musical events in sequence, a musical event sequence can be generated.

[0088] In one embodiment of this application, when the basic music information is audio data, the process of generating a music event sequence is as follows: Figure 4 As shown, steps 410 to 440 are detailed below:

[0089] Step 410: Perform chord recognition on the basic instrument digital interface data to obtain chord data, and generate chord events based on the chord data.

[0090] Specifically, during chord recognition, the process uses time as a baseline, sliding a window of preset length (e.g., the length of two beats) across the basic instrument digital interface data. The chromaticity features within each window are then calculated, and the chord data is determined by the pitch intervals represented by the chromaticity features of each window. Chromaticity features are a collective term for chromaticity vectors and chromaticity spectra. A chromaticity vector is a vector containing 12 elements, each representing the energy of one of the 12 pitches within the time frame defined by the window; the energy of the same pitch across different octaves is summed. The chromaticity spectra are a sequence of chromaticity vectors. Pitch intervals refer to the intervals between notes; for example, the interval between 1 (do) and 2 (re) is 1, and the interval between 1 (do) and 3 (mi) is 2.

[0091] The calculation process of chromaticity features is as follows: perform Fourier transform on the data in the sliding window to transform it from the time domain to the frequency domain, record the energy of each pitch in each sliding window, and superimpose the energy (in loudness measure) of notes of the same pitch but different octaves to obtain chromaticity features.

[0092] Chord data includes chord type (or chord quality) and root note. Chord types include major (major triad), minor (minor triad), diminished (diminished chord), augmented (augmented chord), and dominant (dominant chord). The root note is the lowest note in the chord, such as C, C#, D, D#, E, F, F#, G, G#, A, A#, and B.

[0093] In one embodiment of this application, an event is represented as an event, and a chord event is a chord event. A chord event includes the chord type event and the chord root note event.

[0094] Step 420: Determine the measure data of the basic instrument digital interface data based on the beat detection results, and generate measure events based on the measure data.

[0095] As mentioned earlier, a measure in music usually starts with a strong beat. Therefore, the actual occurrence of the strong beat in the beat detection result is the measure start time. The measure is marked at the measure start time, and a measure event is generated.

[0096] Step 430: Detect the note data in the basic instrument digital interface data and generate note events based on the note data.

[0097] Specifically, the basic MIDI data records note data, which includes note position, note type, note duration, and note velocity. Correspondingly, note events include note position events, note type events, note duration events, and note velocity events.

[0098] In one embodiment of this application, the process of generating note events includes: generating note type events based on the note types in the basic instrument digital interface data; dividing the duration of each measure in the basic instrument digital interface data into multiple first moments, taking the first moment closest to the start time of the note as the start time of the note, and generating note position events corresponding to each note based on the start time of each note; dividing the duration of each measure in the basic instrument digital interface data into multiple second moments, taking the second moment closest to the end time of the note as the end time of the note, determining the note duration based on the start time and end time corresponding to each note, and generating note duration events corresponding to each note based on the note duration corresponding to each note; mapping the note velocity representation of each note in the basic instrument digital interface data to a target velocity representation based on a preset mapping rule, and generating note velocity events corresponding to each note based on the target velocity representation of each note.

[0099] Specifically, the basic MIDI data uses a 0-127 code to represent note types, meaning there are 128 note types in total. For example, 0 represents the lowest note C-1, and 127 represents the highest note G9. A note type event is generated based on each note type. Generally, the note type event is recorded as the start time position of the note in the basic MIDI data, but this embodiment quantizes the start time position of the note.

[0100] The basic MIDI data is used to divide a measure into multiple first moments. The start time of each note in the measure is then matched with these first moments, and the first moment closest to the note's start time is taken as the note's corresponding start moment. The note is then shifted so that its start time coincides with the corresponding first moment, and a note position event is generated at the position of that first moment. It's important to note that during the quantization of the note's start time, the shift is performed on the entire note; that is, the start and end times of the note are shifted synchronously. For example, if a measure is divided into 16 parts, i.e., 16 first moments (excluding the measure's start moment), then the note's start moment is one of these 16 first moments. For instance, if the note's start moment is in the first first moment, then the note position event is at the 1 / 16th position of the measure.

[0101] After quantizing the start time of a note, the next step is to quantize its end time. This quantization process is similar to that of the start time quantization: a measure identified from the basic MIDI data is divided into multiple second moments. The end time of each note in the measure is then matched with each of these second moments to determine the second moment closest to the note's end time. This closest second moment is the note's corresponding end time. The note's end time is then moved to this corresponding end time. Therefore, the duration of the note, or its length, can be determined from both the start and end times, thus generating the note duration event. It's important to note that the note's start time is fixed during the movement of its end time; therefore, only the end time is shifted. Generally, the shortest note is a 32nd note, so a measure can be divided into 32 parts, or 32 second moments. The ending moment of a note is one of these 32 second moments. For example, if the note ends in the 3rd second moment, it means the note ends at the 3 / 32 measure position. If the note begins at the 1 / 16 measure position, then the duration of the note is 3 / 32 - 1 / 16 = 1 / 32 measure. Sometimes, the longest note can be two measures long, so it's possible for a note to begin in the first measure and end in the second measure adjacent to it.

[0102] In basic MIDI data, note velocity is represented by an encoding between 0 and 127. In this embodiment, the note velocity representation in the basic MIDI data is mapped to the desired target velocity representation through a preset mapping rule, thereby generating a note velocity event. For example, the target velocity representation of the note is set to 32, that is, 0-127 is mapped to 1-32, 0-3 is mapped to 1, 4-6 is mapped to 2, 7-9 is mapped to 3, and so on.

[0103] In one embodiment of this application, the note event further includes a tempo event, which is recorded at the start time of each note. Tempo represents the number of beats per minute. During format conversion, the MIDI data has been calibrated, and the tempo information corresponding to each note can be obtained from the calibrated basic MIDI data to generate the tempo event. In this embodiment, there are 180 tempos, ranging from 30 to 209 bpm.

[0104] Based on the above processing, the musical events generated in this embodiment include: measure events, note position events, note type events, note duration events, note dynamics events, tempo events, chord type events, and chord root note events. In an exemplary embodiment, the specific content of each musical event is shown in Table 1 below:

[0105] Table 1

[0106] Event Type quantity Specific content Section 1 / Note position 16 1-16 Types of musical notes 128 0(C-1)-127(G9) Note duration 32 1-32 Note dynamics 32 1-32 speed 180 30–209 bpm chord root 12 C,C#,D,D#,E,F,F#,G,G#,A,A#,B Chord types 5 major,minor,diminished,augmented,dominant

[0107] It's important to note that the quantities in Table 1 refer to the types of events, not the maximum number of musical events that can be generated from the basic MIDI data. For example, a measure count of 1 means there is only one type of measure in the basic MIDI data, but multiple measure events can be generated. Similarly, a note type count of 128 means there are a maximum of 128 types of notes in the basic MIDI data, but multiple note type events can be generated for each type of note. For instance, if the basic MIDI data includes multiple G9 notes, multiple note type events corresponding to G9 notes can be generated.

[0108] Step 440: Arrange the chord events, measure events, and note events in time sequence to generate a music event sequence.

[0109] Specifically, the various musical events are arranged in a sequence to generate a musical event sequence. For example, the order of the musical events could be: first measure event, first note position event, note tempo event, chord type event, chord root note event, note type event, note duration event, note dynamics event, second note position event, and so on.

[0110] In one embodiment of this application, when the basic music information is a music data, the basic instrument digital interface data is also music data. Only one music event is generated based on the basic instrument digital interface data. This music event can then be sorted with other types of preset music events to generate a music event sequence. The preset music event can be null or one of the aforementioned types of music events. For example, if the music event generated from the basic instrument digital interface data is a tempo event, and all other types of preset music events are 0, then the tempo event is combined with the preset music events to generate a music event sequence. As another example, if the music event generated from the basic instrument digital interface data is a chord event (which can be a chord root note event, a chord type event, or a combination of a chord root note event and a chord type event), the preset tempo event can be 100 bpm, and the remaining preset tempo events are set to 0, thereby generating a music event sequence including the chord event and the preset tempo event.

[0111] Continue to refer to Figure 2 Step 240: Perform feature extraction and mapping processing on the music event sequence, and obtain the target music data based on the processing results.

[0112] In this embodiment, feature extraction and mapping of the musical event sequence can be achieved through a preset sequence prediction model. The musical event sequence is input into the preset sequence prediction model, which performs feature extraction and mapping to predict the next target musical event following the musical event in the time sequence. The predicted target musical events are also arranged in a time sequence. When the arrangement of the predicted target musical events reaches a specified length, it is equivalent to generating a target musical sequence of a specified duration. The specified duration can be determined by external input, or it can be a randomly generated parameter, or a parameter set by the preset sequence prediction model.

[0113] Since the target music sequence is actually an arrangement of multiple target music events, it cannot be recognized by a computer or audio playback device. Therefore, it needs to be converted into target instrument digital interface data, resulting in target music data that can be recognized by a computer. The process of converting the target music sequence into target instrument digital interface data is actually a conversion between event sequences and MIDI data, equivalent to the reverse process of generating a music event sequence from basic MIDI data. Therefore, based on the reverse process in step 230 above, the process of converting the target music sequence into target instrument digital interface data can be realized.

[0114] Specifically, the first step is to determine the type of each target music event. These types include: measure events, note position events, note type events, note duration events, note velocity events, tempo events, chord type events, and chord root note events. Then, the target music events are converted into MIDI data according to the conversion rules corresponding to each event type. For example, a 1 / 16 position event is converted into the corresponding note start time (expressed as minutes and seconds); another example is that if the note velocity event corresponds to a velocity of 32, then the converted MIDI data will have a velocity of 127.

[0115] After obtaining the target instrument's digital interface data, it can be used directly as the target music data, or it can be further processed through format conversion to obtain target audio data that can be played by an audio playback device. This format conversion process is equivalent to the reverse process in step 220 above.

[0116] In the technical solution provided in this application embodiment, basic instrument digital interface data is generated from basic musical information, which in turn generates a musical event sequence. Finally, the target musical data is obtained from the musical event sequence, realizing automatic composition of music and reducing the manual dependence in the composition process. Regardless of whether the basic musical information is a piece of audio data or a piece of musical data, the target musical data can be generated. The composition process is simple, allowing composers to create music even without familiarity with music theory, lowering the threshold and cost of composition. Furthermore, when the basic musical information is a piece of audio data, it is equivalent to continuing the composition based on that audio data; when the basic musical information is a piece of musical data, it is equivalent to generating a new piece of music from scratch based on a piece of musical data. Therefore, there are multiple modes of composition, and the duration of the target musical data can be specified, greatly improving the flexibility of composition.

[0117] In one embodiment of this application, the technical solution further includes a process for constructing a preset sequence prediction model, specifically: performing source separation processing on the sample audio data to extract sample audio track data; performing format conversion processing on the sample audio track data to obtain sample instrument digital interface data; generating sample music events based on each piece of music data in the sample instrument digital interface data; sorting a preset number of sample music events to generate a sample music event sequence, and training a prediction model based on the sample music event sequence to obtain the preset sequence prediction model.

[0118] Specifically, multiple sample audio data are acquired, and each sample audio data undergoes source separation processing to extract sample track data, typically piano track data. Then, MIDI transcription processing is performed on the sample track data, converting it into sample instrument digital interface data. The sample track data and sample MIDI data actually express the same musical content, only their music storage formats differ. Next, sample music events are generated based on the sample audio data. This involves processes such as beat detection, calibration, chord recognition, measure detection, and note data detection to generate multiple sample music events. This process can be referred to the previous description of generating music events from basic instrument digital interface data, and will not be repeated here. Finally, a sample music event sequence is generated based on the sample music events, and the prediction model is trained using this sequence to obtain a preset sequence prediction model.

[0119] The sample music event sequence is constructed by extracting a predetermined number of sample music events from the chronologically ordered sequence of the sample music events. For example, after arranging the sample music events in chronological order, the first 1-512 sample music events can be extracted to form one sample music event sequence, and the 513-1024 sample music events can be extracted to form another sample music event sequence, and so on. In this way, one sample audio data can generate multiple sample music event sequences. Compared with related technologies that use a large number of sample audio data for model training, the technical solution of this application achieves model training based on a small amount of sample audio data, which greatly reduces the amount of sample audio data required for predictive model training.

[0120] In one embodiment of this application, the prediction model uses a network capable of establishing dependencies on long-range segments, such as the Transformer-XL model. During the training process of the prediction model, the hidden layer weights obtained in each iteration are stored. In the next iteration, the calculated hidden layer weights are concatenated with the stored hidden layer weights before subsequent network operations. In this embodiment, a certain number of sample music events are used as a group of training samples. The hidden layer weights are cached once each time the model is trained on this group of training samples. For example, five sample music events are used as a group of training samples to cache the hidden layer weights.

[0121] In one embodiment of this application, the training objective of the prediction model is to minimize the musical difference between the predicted music output by the model and the sample audio. This musical difference can be reflected by musical elements such as melody, rhythm, timbre, dynamics, and harmony. Furthermore, these musical elements also define the musical style of a piece of music; therefore, the training objective of the model is to ensure that the musical style of the predicted music is as similar as possible to the musical style of the sample audio. Similarly, when generating target music data using a pre-trained preset sequence prediction model, if the base music information is a segment of audio data, the musical style of the generated target music data should be consistent with the musical style corresponding to that audio data; if the base music information is a single piece of music data, the musical style of the generated target music data will be consistent with the musical style of the sample audio.

[0122] For example, Figure 5 A flowchart illustrating a method for generating music according to an embodiment of this application is shown schematically, such as... Figure 5 As shown, the method includes:

[0123] S501. Obtain sample audio data.

[0124] S502. Perform source separation processing on the sample audio data and extract the piano track data from the sample audio data.

[0125] S503. Perform beat detection on the piano track data to obtain the beat detection results. The beat detection results include the actual occurrence time of each beat in the piano track data. Beats include strong beats and weak beats. The actual occurrence time of the strong beat indicates the start time of the measure.

[0126] S504. Perform format conversion processing on the piano track data to obtain the original sample MIDI data.

[0127] S505. Based on the beat detection results, the original sample MIDI data is calibrated to obtain sample MIDI data. The specific calibration procedures can be found in the description of step 320 above, and will not be repeated here.

[0128] S506. Perform chord recognition on the sample MIDI data to obtain sample chord data, and generate sample chord events based on the sample chord data. Sample chord events include sample chord type time and sample chord root note events.

[0129] S507. Perform measure data detection and note data detection on the sample MIDI data to generate sample measure events and sample note events; and generate multiple sample music event sequences based on all events arranged in chronological order. The sample note events include sample note position events, sample note type events, sample note duration events, sample note velocity events, and sample tempo events. The event generation process and the event sequence generation process can be referred to the relevant descriptions in steps 410-440 above, and will not be repeated here.

[0130] S508. Use the sample music event sequence to train the prediction model and obtain the trained preset sequence prediction model.

[0131] S509. Obtain basic musical information and convert it into basic instrument digital interface data. Generate a musical event sequence based on the basic instrument digital interface data, and process the musical event sequence using a preset sequence prediction model to generate the target musical sequence. The specific process of this step can be referred to the relevant description above, and will not be repeated here.

[0132] S510. Perform event reversal processing on the target music sequence to obtain the target MIDI data. The specific process of this step can be found in the previous description and will not be repeated here.

[0133] It should be noted that although the steps of the method in this application are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps.

[0134] The following describes an embodiment of the apparatus described in this application, which can be used to execute the music generation method described in the above embodiments of this application. Figure 6 A schematic block diagram of the musical composition generation apparatus provided in an embodiment of this application is shown. Figure 6 As shown, the music generation apparatus provided in this application embodiment includes:

[0135] The data acquisition module 610 is used to acquire basic music information for generating target music data, wherein the basic music information includes at least one type of music data;

[0136] The format conversion module 620 is used to perform format conversion processing on the basic music information to obtain the basic instrument digital interface data corresponding to the basic music information.

[0137] The music event generation module 630 is used to generate music events based on music data of various types in the basic instrument digital interface data, and to sort the music events to generate a music event sequence.

[0138] The target music generation module 640 is used to perform feature extraction and mapping processing on the music event sequence, and obtain target music data based on the processing results.

[0139] In one embodiment of this application, the basic music information is audio data composed of various music data; the format conversion module 620 includes:

[0140] The format conversion unit is used to perform format conversion processing on the audio data to obtain the original instrument digital interface data;

[0141] A beat detection unit is used to perform beat detection on the audio data and obtain a beat detection result, wherein the beat detection result includes the actual occurrence time of each beat in the audio data;

[0142] The calibration unit is used to calibrate the original instrument digital interface data according to the beat detection result, so as to obtain the basic instrument digital interface data corresponding to the basic music information.

[0143] In one embodiment of this application, the verification unit is specifically used for:

[0144] The number of beats per minute corresponding to the first beat is determined based on the time interval between the first beat and the second beat in the beat detection results, wherein the second beat is the beat that follows the first beat and is adjacent to the first beat;

[0145] The target duration of the first note corresponding to the first beat in the original instrument digital interface data is determined based on the number of beats per minute corresponding to the first beat.

[0146] If the recording duration of the first beat in the original instrument digital interface data is different from the target duration, then the recording duration is adjusted according to the target duration.

[0147] In one embodiment of this application, the various types of musical data include measure data, chord data, and note data; the musical event generation module 630 includes:

[0148] The chord event generation unit is used to perform chord recognition on the basic instrument digital interface data to obtain chord data, and generate chord events based on the chord data;

[0149] The measure event generation unit is used to determine the measure data of the basic instrument digital interface data based on the beat detection result, and generate measure events based on the measure data.

[0150] A note event generation unit is used to detect note data in the basic musical instrument digital interface data and generate note events based on the note data;

[0151] The event sequence generation unit is used to arrange the chord events, the measure events, and the note events in a time sequence to generate a musical event sequence.

[0152] In one embodiment of this application, the chord event generation unit is specifically used for:

[0153] Using time as a reference, the chord data in the basic instrument digital interface data is determined by sliding a window of preset length through the window and based on the chromaticity characteristics of each window.

[0154] In one embodiment of this application, the note data includes note position, note type, note duration, and note dynamics, and the note events include note position events, note duration events, and note dynamics events; the note event generation unit is specifically used for:

[0155] Generate a note type event based on the note type in the basic musical instrument digital interface data;

[0156] The duration of each measure in the basic instrument digital interface data is divided into multiple first moments. The first moment closest to the start time of the note is taken as the start time of the note, and note position events corresponding to each note are generated according to the start time of each note.

[0157] The duration of each measure in the basic instrument digital interface data is divided into multiple second moments. The second moment closest to the end time of the note is taken as the end time of the note. The note duration is determined according to the start time and end time of each note. The note duration event corresponding to each note is generated according to the note duration of each note.

[0158] Based on preset mapping rules, the note velocity representation of each note in the basic musical instrument digital interface data is mapped to the target velocity representation, and the note velocity event corresponding to each note is generated according to the target velocity representation of each note.

[0159] In one embodiment of this application, the basic musical information consists of one type of musical data; the format conversion module 620 is used for:

[0160] The music data is converted according to the data format of the basic instrument digital interface data to obtain the basic instrument digital interface data corresponding to the music data.

[0161] In one embodiment of this application, the target music generation module 640 is specifically used for:

[0162] The music event sequence is subjected to feature extraction and mapping processing by a preset sequence prediction model to obtain a target music sequence of a specified duration, wherein the target music sequence includes multiple target music events;

[0163] Multiple target music events in the target music sequence are converted into target instrument digital interface data to obtain target music data.

[0164] In one embodiment of this application, the apparatus further includes a model building module, which is specifically used for:

[0165] The sample audio data is processed by source separation to extract sample audio track data; the sample audio track data is processed by format conversion to obtain sample instrument digital interface data; sample music events are generated based on each piece of music data in the sample instrument digital interface data; a preset number of sample music events are sorted to generate a sample music event sequence, and a prediction model is trained based on the sample music event sequence to obtain a preset sequence prediction model.

[0166] The specific details of the music generation apparatus provided in the various embodiments of this application have been described in detail in the corresponding method embodiments, and will not be repeated here.

[0167] Figure 7 A schematic block diagram of a computer system architecture for implementing an electronic device according to embodiments of the present application is shown.

[0168] It should be noted that, Figure 7 The computer system 700 of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0169] like Figure 7 As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 702 or programs loaded from storage section 708 into random access memory (RAM) 703. The RAM 703 also stores various programs and data required for system operation. The CPU 701, ROM 702, and RAM 703 are interconnected via a bus 704. An input / output interface 705 (I / O interface) is also connected to the bus 704.

[0170] The following components are connected to the input / output interface 705: an input section 706 including a keyboard, mouse, etc.; an output section 707 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a local area network card, modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the input / output interface 705 as needed. A removable medium 711, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 710 as needed so that computer programs read from it can be installed into the storage section 708 as needed.

[0171] Specifically, according to embodiments of this application, the processes described in the various method flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 709, and / or installed from removable medium 711. When the computer program is executed by central processing unit 701, it performs various functions defined in the system of this application.

[0172] It should be noted that the computer-readable medium shown in the embodiments of this application can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such transmitted data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.

[0173] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0174] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of this application, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.

[0175] Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, touch terminal, or network device, etc.) to execute the method according to the embodiments of this application.

[0176] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein.

[0177] It should be understood that this application is not limited to the precise structure 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 application is limited only by the appended claims.

Claims

1. A method of generating a musical composition, characterized by, The method comprises the following steps: obtaining basic music information used for generating target music data, wherein the basic music information comprises at least one type of music data; the at least one type of music data comprises note data, chord data and note data; performing format conversion processing on the basic music information to obtain basic musical instrument digital interface data corresponding to the basic music information; generating note events according to the note data in the basic musical instrument digital interface data, generating chord events according to the chord data in the basic musical instrument digital interface data, generating note events according to the note data in the basic musical instrument digital interface data, and arranging the note events, the chord events and the note events in time sequence to generate a music event sequence; performing feature extraction and mapping processing on the music event sequence, and obtaining target music data based on the processing result.

2. The musical composition generation method according to claim 1, characterized by, The basic music information is audio data composed of multiple types of music data; performing format conversion processing on the audio data to obtain original musical instrument digital interface data; performing beat detection on the audio data to obtain a beat detection result, wherein the beat detection result comprises the actual occurrence time of each beat in the audio data; performing correction on the original musical instrument digital interface data according to the beat detection result to obtain the basic musical instrument digital interface data corresponding to the basic music information. performing correction on the original musical instrument digital interface data according to the beat detection result, comprising:

3. The musical composition generation method according to claim 2, wherein determining the number of beats per minute corresponding to the first beat according to the time interval between the first beat and the second beat in the beat detection result, wherein the second beat is the beat adjacent to the first beat after the first beat; determining the target duration of the first note corresponding to the first beat in the original musical instrument digital interface data according to the number of beats per minute corresponding to the first beat; if the recorded duration of the first beat in the original musical instrument digital interface data is different from the target duration, adjusting the recorded duration according to the target duration. generating note events according to the note data in the basic musical instrument digital interface data, comprising:

4. The musical composition generation method according to claim 2, characterized by, determining the note data of the basic musical instrument digital interface data according to the beat detection result, and generating note events according to the note data. generating chord events according to the chord data in the basic musical instrument digital interface data, comprising:

5. The musical composition generation method according to claim 1, wherein performing chord recognition on the basic musical instrument digital interface data to obtain chord data, and generating chord events according to the chord data. performing chord recognition on the basic musical instrument digital interface data to obtain chord data, comprising:

6. The musical composition generation method according to claim 5, wherein sliding in the basic musical instrument digital interface data through a window of a preset length based on the time dimension, and determining the chord data in the basic musical instrument digital interface data according to the chroma features of each window. generating note events according to the note data in the basic musical instrument digital interface data, comprising:

7. The musical composition generation method according to claim 1, wherein ​ Detecting note data in the MIDI data, and generating note events according to the note data.

8. The musical composition generation method according to claim 7, characterized by, The note data includes note position, note type, note duration and note intensity, and the note events include note position events, note duration events and note intensity events. Detecting note data in the MIDI data, and generating note events according to the note data, including: Generating note type events according to note types in the MIDI data; Dividing the duration of each measure in the MIDI data into a plurality of first time points, taking the first time point closest to the starting time of a note as the starting time of the note, and generating note position events corresponding to each note according to the starting time of each note; Dividing the duration of each measure in the MIDI data into a plurality of second time points, taking the second time point closest to the ending time of a note as the ending time of the note, determining note duration according to the starting time and ending time of each note, and generating note duration events corresponding to each note according to the note duration of each note; Mapping the note intensity representation of each note in the MIDI data to a target intensity representation based on a preset mapping rule, and generating note intensity events corresponding to each note according to the target intensity representation of each note.

9. The musical composition generation method according to claim 1, wherein The basic music information is composed of one type of music data; the format conversion processing is performed on the basic music information to obtain the MIDI data corresponding to the basic music information, including: Performing format conversion processing on the music data according to the data format of the MIDI data to obtain the MIDI data corresponding to the music data.

10. The musical composition generation method according to any one of claims 1 to 9, wherein Performing feature extraction and mapping processing on the music event sequence, and obtaining target music data based on the processing result, including: Performing feature extraction and mapping processing on the music event sequence through a preset sequence prediction model to obtain a target music sequence of a specified duration, the target music sequence including a plurality of target music events; Converting the plurality of target music events in the target music sequence into target MIDI data to obtain target music data.

11. The musical composition generation method according to claim 10, wherein The method further includes: Performing source separation processing on the sample audio data to extract sample track data of the sample audio data; Performing format conversion processing on the sample track data to obtain sample MIDI data; Generating sample music events according to each music data in the sample MIDI data; Sorting a preset number of sample music events to generate a sample music event sequence, and training a prediction model based on the sample music event sequence to obtain a preset sequence prediction model.

12. A musical composition generating apparatus characterized by comprising: including: A data acquisition module is configured to acquire basic music information used to generate target music data, the basic music information including at least one type of music data; The at least one type of music data includes measure data, chord data and note data; The format conversion module is configured to perform format conversion processing on the basic music information to obtain basic musical instrument digital interface data corresponding to the basic music information. The music event generation module is configured to generate a measure event according to measure data in the basic musical instrument digital interface data, generate a chord event according to chord data in the basic musical instrument digital interface data, generate a note event according to note data in the basic musical instrument digital interface data, and arrange the measure event, the chord event and the note event in sequence to generate a music event sequence. The target music generation module is configured to perform feature extraction and mapping processing on the music event sequence, and obtain target music data based on a processing result.

13. A computer readable medium having stored thereon a computer program, characterized in that The computer program is executed by a processor to implement the music generation method in any one of claims 1 to 11.

14. An electronic device, comprising: It comprises: a processor; and a memory for storing executable instructions of the processor; wherein the processor executes the executable instructions to enable the electronic device to perform the music generation method in any one of claims 1 to 11.

15. A computer program product, characterised in that, The computer program product or computer program comprises computer instructions stored in a computer readable storage medium; A processor of a computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions to enable the computer device to perform the music generation method in any one of claims 1 to 11.

Citation Information

Patent Citations

  • Method, device and equipment for generating arrangement, medium and computer program

    CN113838444A