CN118072698A - Chord sequence generation method, device, terminal and storage medium - Google Patents

Chord sequence generation method, device, terminal and storage medium Download PDF

Info

Publication number
CN118072698A
CN118072698A CN202410042686.4A CN202410042686A CN118072698A CN 118072698 A CN118072698 A CN 118072698A CN 202410042686 A CN202410042686 A CN 202410042686A CN 118072698 A CN118072698 A CN 118072698A
Authority
CN
China
Prior art keywords
sequence
melody
chord
sequences
pitch
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410042686.4A
Other languages
Chinese (zh)
Inventor
何其锜
黄安麒
王燕凤
刘华平
陈锦海
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Netease Cloud Music Technology Co Ltd
Original Assignee
Hangzhou Netease Cloud Music Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Netease Cloud Music Technology Co Ltd filed Critical Hangzhou Netease Cloud Music Technology Co Ltd
Priority to CN202410042686.4A priority Critical patent/CN118072698A/en
Publication of CN118072698A publication Critical patent/CN118072698A/en
Pending legal-status Critical Current

Links

Landscapes

  • Electrophonic Musical Instruments (AREA)

Abstract

The application discloses a chord sequence generation method, a chord sequence generation device, a chord sequence generation terminal and a chord sequence storage medium, wherein the chord sequence generation method comprises the following steps: determining m first pitch sequences corresponding to the m first melody sequences based on the m first melody sequences; determining a second pitch sequence corresponding to the second melody sequence based on the second melody sequence; determining a first chord sequence based on the m first pitch sequences and the similarity of the second pitch sequences; and carrying out post-processing on the first chord sequence to obtain a target chord sequence, wherein the post-processing at least comprises judgment of the music theory rule. The application determines the first chord sequence by calculating the similarity between m first melody sequences in the target music and the second melody sequence input by the user, and then carries out post-processing such as music theory judgment and the like on the first chord sequence, thereby obtaining rich and vivid chord sequences.

Description

Chord sequence generation method, device, terminal and storage medium
Technical Field
The present application relates to the field of audio processing technologies, and in particular, to a chord sequence generating method, device, terminal, and storage medium.
Background
With the development of audio processing technology, harmony chords can be generated based on matching the set melody with an appropriate chord.
At present, a model prediction mode is adopted to obtain a chord sequence, for example, a user inputs a melody, melody attributes such as a melody mode, a root sound, a bar initial sound, a pressing sound and the like are extracted, the attributes are input into a model, and the chord sequence corresponding to the melody is calculated through a music theory rule and a dynamic programming method.
However, the chord sequences obtained by the above method have serious problems of hardness and homogenization.
Disclosure of Invention
The application mainly aims to provide a chord sequence generation method, a chord sequence generation device, a chord sequence generation terminal and a chord sequence storage medium, so as to solve the problems of hardness and serious homogenization of a chord sequence obtained in the related technology.
To achieve the above object, in a first aspect, the present application provides a chord sequence generation method, including:
Determining m first pitch sequences corresponding to the m first melody sequences based on the m first melody sequences, wherein the m first melody sequences and the m first pitch sequences are in one-to-one correspondence, and m is an integer greater than 1, and the m first melody sequences are formed by m sub-melodies in the target music, and the m sub-melodies are sub-melodies stored in a database;
Determining a second pitch sequence corresponding to a second melody sequence based on the second melody sequence, wherein the second melody sequence is formed by sub-melodies input by a user;
determining a first chord sequence based on the m first pitch sequences and the similarity of the second pitch sequences;
and carrying out post-processing on the first chord sequence to obtain a target chord sequence, wherein the post-processing at least comprises judgment of the music theory rule.
In one possible implementation, determining m first pitch sequences corresponding to the m first melody sequences based on the m first melody sequences includes:
Obtaining m first melody sequences;
establishing a target beat sequence corresponding to each first melody sequence aiming at each first melody sequence in m first melody sequences;
If the notes in each first melody sequence and the beats in the target beat sequence meet a first preset condition, assigning a value by taking the pitch of the notes as the beats in the target beat sequence, and obtaining a first pitch sequence corresponding to each first melody sequence;
And summarizing the first pitch sequences corresponding to each first melody sequence to obtain m first pitch sequences corresponding to m first melody sequences.
In one possible implementation, obtaining m first melody sequences includes:
Identifying a voice track in the first file, and taking the voice track as a melody track;
Extracting starting points, ending points and pitch values of all notes in the melody track, and sequentially summarizing the starting points, ending points and pitch values of all notes in the melody track to obtain a starting sequence, a ending sequence and a pitch sequence;
Summarizing the initial sequence, the termination sequence and the pitch sequence to obtain each first melody sequence;
and summarizing each first melody sequence to obtain m first melody sequences.
In one possible implementation manner, establishing a target beat sequence corresponding to each first melody sequence includes:
calculating the length of an initial beat sequence corresponding to each first melody sequence;
And establishing an initial beat sequence according to the length of the initial beat sequence, and initializing all beats in the initial beat sequence to obtain a target beat sequence corresponding to each first melody sequence.
In one possible implementation manner, calculating the length of the initial beat sequence corresponding to each first melody sequence includes:
extracting the corresponding beat number and speed of each first melody sequence;
The time is obtained by taking the mark and the speed as the quotient;
Calculating time points and numbers of beats in an initial beat sequence based on time and preset melody granularity;
Taking the maximum value of the quotient of the number of beats and the preset melody granularity as the length of the initial beat sequence.
In one possible implementation manner, if the notes in each first melody sequence and the beats in the target beat sequence meet a first preset condition, assigning a value to the beats in the target beat sequence by taking the pitch of the notes as the beat in the target beat sequence, to obtain a first pitch sequence corresponding to each first melody sequence, including:
Acquiring a time point of beats in a target beat sequence;
extracting a starting point and an ending point of notes in each first melody sequence;
If the absolute value of the difference between the starting point of the note in each first melody sequence and the time point of the beat in the target beat sequence is smaller than a first preset threshold, and the time point of the beat in the target beat sequence is between the starting point and the ending point of the note in each first melody sequence, assigning a value by taking the pitch of the note as the beat in the target beat sequence, and obtaining a first pitch sequence corresponding to each first melody sequence.
In one possible implementation, determining the first chord sequence based on the similarity of the m first pitch sequences and the second pitch sequences includes:
Calculating the similarity between the second pitch sequence and each of the m first pitch sequences to obtain m similarity distances;
Extracting n candidate melody sequences corresponding to n similarity meeting a second preset threshold value from m similarity distances, wherein the n similarity corresponds to the n candidate melody sequences one by one, and n is an integer smaller than or equal to m;
Determining scores of n second chord sequences corresponding to the n candidate melody sequences based on the n candidate melody sequences, wherein the n candidate melody sequences are in one-to-one correspondence with the scores of the n second chord sequences;
The first chord sequence is determined based on the n candidate melody sequences, the scores of the n second chord sequences, and the second pitch sequence.
In one possible implementation, determining the scores of the n second chord sequences corresponding to the n candidate melody sequences based on the n candidate melody sequences includes:
Establishing a target chord sequence list corresponding to each candidate melody sequence aiming at each candidate melody sequence in the n candidate melody sequences;
if the chords in the target chord sequence list and the beats in the target beat sequence meet a second preset condition, taking the chord type value as the chord assignment in the target chord sequence list, and obtaining a second chord sequence corresponding to each candidate melody sequence;
Calculating the score of a second chord sequence corresponding to each candidate melody sequence;
And summarizing the scores of the second chord sequences corresponding to each candidate melody sequence to obtain the scores of the n second chord sequences.
In one possible implementation manner, the establishing a target chord sequence list corresponding to each candidate melody sequence includes:
calculating the length of an initial chord sequence list corresponding to each candidate melody sequence;
And establishing an initial chord sequence list according to the length of the initial chord sequence list, and initializing all elements in the initial chord sequence list to obtain a target chord sequence list corresponding to each candidate melody sequence.
In one possible implementation, calculating the length of the initial chord sequence list corresponding to each candidate melody sequence includes:
extracting the corresponding beat number and speed of each candidate melody sequence;
The time is obtained by taking the mark and the speed as the quotient;
Calculating time points and numbers of beats in a target beat sequence based on time and preset chord granularity;
The maximum value of the quotient of the number of beats and the preset chord granularity is taken as the length of the initial chord sequence list.
In one possible implementation manner, if the chord in the target chord sequence list and the beat in the target beat sequence meet the second preset condition, the chord assignment in the target chord sequence list is performed by using the chord type value as the chord assignment in the target chord sequence list, so as to obtain a second chord sequence corresponding to each candidate melody sequence, including:
Acquiring a time point of beats in a target beat sequence;
Extracting a starting point and an ending point of a chord in the target chord sequence list;
If the absolute value of the difference between the starting point of the chord in the target chord sequence list and the time point of the beat in the target beat sequence is smaller than a third preset threshold, and the time point of the beat in the target beat sequence is between the starting point and the ending point of the chord in the target chord sequence list, assigning a chord type value as the beat in the target beat sequence to obtain a second chord sequence corresponding to each candidate melody sequence.
In one possible implementation, calculating the score of the second chord sequence corresponding to each candidate melody sequence includes:
Acquiring a preset chord sequence set;
Calculating Levin Stent distance between a third chord sequence and a second chord sequence in a preset chord sequence set;
a score for the second chord sequence is calculated based on Levin stats distance, length of the second chord sequence, length of the third chord sequence.
In one possible implementation, determining the first chord sequence based on the n candidate melody sequences, the scores of the n second chord sequences, and the second pitch sequence includes:
Determining n candidate pitch sequences based on the n candidate melody sequences, wherein the n candidate melody sequences are in one-to-one correspondence with the n candidate pitch sequences;
calculating the similarity between the second pitch sequence and each candidate pitch sequence in the n candidate pitch sequences to obtain n similarity distances;
Determining scores of n candidate melody sequences based on the n similarity distances and the scores of n second chord sequences, wherein the n similarity distances, the scores of the n second chord sequences and the scores of the n candidate melody sequences are in one-to-one correspondence;
and selecting the chord sequence corresponding to the maximum candidate melody sequence score from the scores of the n candidate melody sequences as a first chord sequence.
In one possible implementation, the post-processing is performed on the first chord sequence to obtain a target chord sequence, including:
judging whether the first chord sequence accords with a preset music theory rule or not;
and if the first chord sequence accords with the preset music theory rule, judging a termination formula of the first chord sequence to obtain a target chord sequence.
In one possible implementation manner, determining whether the first chord sequence meets a preset music theory rule includes:
Acquiring a third melody sequence corresponding to the first chord sequence;
It is determined whether or not the accent in the first chord sequence coincides with the accent in the pitch in the third melody sequence.
In one possible implementation manner, if the first chord sequence meets a preset music theory rule, performing termination formula judgment on the first chord sequence to obtain a target chord sequence, including:
if the accent in the first chord sequence is coincident with the accent in the pitch in the third chord sequence, judging whether a termination sequence exists in the first chord sequence;
And if the termination sequence exists in the first chord sequence, taking the first chord sequence as a target chord sequence.
In a second aspect, an embodiment of the present invention provides a chord sequence generating device, including:
The first pitch sequence determining module is used for determining m first pitch sequences corresponding to the m first melody sequences based on the m first melody sequences, wherein the m first melody sequences and the m first pitch sequences are in one-to-one correspondence, m is an integer greater than 1, the m first melody sequences are formed by m sub-melodies in the target music, and the m sub-melodies are sub-melodies stored in the database;
The second pitch sequence determining module is used for determining a second pitch sequence corresponding to the second melody sequence based on the second melody sequence, wherein the second melody sequence is formed by sub-melodies input by a user;
A chord sequence determination module for determining a first chord sequence based on the similarity of the m first pitch sequences and the second pitch sequences;
And the chord sequence generation module is used for carrying out post-processing on the first chord sequence to obtain a target chord sequence, wherein the post-processing at least comprises judgment of the music theory rule.
In a third aspect, an embodiment of the present invention provides a terminal, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of any one of the chord sequence generation methods described above when the computer program is executed.
In a fourth aspect, embodiments of the present invention provide a computer-readable storage medium storing a computer program which, when executed by a processor, implements the steps of any of the chord sequence generation methods described above.
The embodiment of the invention provides a chord sequence generation method, a chord sequence generation device, a chord sequence generation terminal and a chord sequence storage medium, wherein the chord sequence generation method comprises the following steps: and determining m first pitch sequences corresponding to the m first melody sequences based on the m first melody sequences, wherein the m first melody sequences and the m first pitch sequences are in one-to-one correspondence, m is an integer larger than 1, the m first melody sequences are formed by m sub-melodies in the target music, the m sub-melodies are sub-melodies stored in a database, and then determining a second pitch sequence corresponding to the second melody sequences based on the second melody sequences, wherein the second melody sequences are formed by sub-melodies input by a user, and then determining the first chord sequences based on the similarity of the m first pitch sequences and the second pitch sequences, and finally performing post-processing on the first chord sequences to obtain the target chord sequences, wherein the post-processing at least comprises judgment of a music rule. The invention determines the first chord sequence by calculating the similarity between m first melody sequences in the target music and the second melody sequence input by the user, and then carries out post-processing such as music theory judgment and the like on the first chord sequence, thereby obtaining rich and vivid chord sequences.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application, are incorporated in and constitute a part of this specification. The drawings and their description are illustrative of the application and are not to be construed as unduly limiting the application. In the drawings:
FIG. 1 is a flowchart of an implementation of a chord sequence generation method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a melody track information interface according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a chord sequence provided by an embodiment of the present invention;
Fig. 4 is a schematic structural diagram of a chord sequence generating device according to an embodiment of the present invention;
fig. 5 is a schematic diagram of a terminal according to an embodiment of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The terms "first," "second," "third," "fourth" and the like in the description and in the claims and in the above drawings, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein.
It should be understood that, in various embodiments of the present invention, the sequence number of each process does not mean that the execution sequence of each process should be determined by its functions and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
It should be understood that in the present invention, "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements that are expressly listed or inherent to such process, method, article, or apparatus.
It should be understood that in the present invention, "plurality" means two or more. "and/or" is merely an association relationship describing an association object, and means that three relationships may exist, for example, and/or B may mean: a exists alone, A and B exist together, and B exists alone. The character "/" generally indicates that the context-dependent object is an "or" relationship. "comprising A, B and C", "comprising A, B, C" means that all three of A, B, C are comprised, "comprising A, B or C" means that one of A, B, C is comprised, "comprising A, B and/or C" means that any 1 or any 2 or 3 of A, B, C are comprised.
It should be understood that in the present invention, "B corresponding to a", "a corresponding to B", or "B corresponding to a" means that B is associated with a, from which B can be determined. Determining B from a does not mean determining B from a alone, but may also determine B from a and/or other information. The matching of A and B is that the similarity of A and B is larger than or equal to a preset threshold value.
As used herein, the term "if" may be interpreted as "at … …" or "at … …" or "in response to a determination" or "in response to a detection", depending on the context.
The technical scheme of the invention is described in detail below by specific examples. The following embodiments may be combined with each other, and some embodiments may not be repeated for the same or similar concepts or processes.
In order to make the purposes, technical schemes and advantages of the invention more clear, the professional vocabulary in the invention is explained as follows:
Pitch: measured by frequency, i.e. the frequency of the sonic vibrations. The higher the frequency, the higher the pitch; the lower the frequency, the lower the pitch. The frequency is expressed in hertz (Hz), i.e. the number of vibrations produced per second.
Melody: is composed of a series of notes in a certain pitch order. Each note has a particular pitch, duration and intensity. The notes are arranged in a certain musical rhythm to form a rhythmic pattern of the melody.
Chord: a set of notes played simultaneously or sounded simultaneously by a plurality of notes. In music, a chord is typically made up of three or more notes that are simultaneously emitted according to a particular musical interval relationship. The composition of the chord depends on the interval relationship between notes. The most common chord type is the tri chord (Triad), consisting of root (base), third and fifth. For example, in the C major key, the C chord is composed of C (root), E (third) and G (fifth).
Sequence: refers to a group of elements or objects arranged in a certain order. In the fields of mathematics, computer science, and statistics, sequences generally refer to a finite or infinite series of consecutive elements. Each element in the sequence has a particular position or index, which is typically expressed in integer form. The elements of the sequence may be numbers, characters, bytes, objects, or other types of data.
Beat: the basic time units in music are used for organizing and measuring the time in music. It is a regular, repetitive pulse or beat that is used to determine the steady temporal feel of music.
And (3) marking: special symbols in the music staff are used to prompt the player how many beats are in each bar, and the duration of each beat. Common beats include 4/4 beats (common four beats), 3/4 beats (three beats), 6/8 beats, etc. Beats may be represented by a beat (time signature).
Particle size: refers to the degree of fine or coarse grain of an object or data and may also be understood as the degree of division or decomposition of an object or data. It is used to describe the relationship between levels of detail and components in things or data. In programming, granularity represents the degree of modularity of code or the degree of splitting of functionality. The coarser granularity modules represent larger functional blocks, while the finer granularity modules represent smaller functional units.
The following description will proceed with reference being made to the accompanying drawings.
With the development of audio processing technology, harmony chords can be generated based on matching the set melody with an appropriate chord.
At present, a model prediction mode is adopted to acquire a chord sequence, which comprises the following three modes:
The first way is: the user inputs a section of melody, extracts melody attributes such as melody mode, root, bar initial tone, pressing tone and the like, inputs the attributes into the model, and calculates a chord sequence corresponding to the melody through a music theory rule and a dynamic programming method.
The second way is: after the existing melody data is quantized into notes (sixteen notes, eighth notes and the like) with unified time measurement, the melody sequence is input as a model, the corresponding chord sequence is output as the model, a deep learning neural network is trained, and the mapping from the melody sequence to the chord sequence is realized.
Third mode: the user gives a string of the sequence of the previous chords and the number of the required subsequent chords, calculates through a deep learning model or a music theory rule model, outputs the subsequent chord required by the user, and is juxtaposed in the existing input sequence; the existing sequence is used as a new input and the next subsequent chord is calculated. And so on until the user's desired number of chords is generated.
However, the chord sequences obtained by the above method have serious problems of hardness and homogenization.
Referring to fig. 1, fig. 1 is a chord sequence generating method according to an embodiment of the present application, including the following steps:
Step S110: and determining m first pitch sequences corresponding to the m first melody sequences based on the m first melody sequences.
The m first melody sequences and the m first pitch sequences are in one-to-one correspondence, and m is an integer greater than 1.
For m first melody sequences based on m first melody sequences, m first pitch sequences corresponding to the m first melody sequences are determined, the m first melody sequences are required to be acquired first, then, for each first melody sequence in the m first melody sequences, a target beat sequence corresponding to each first melody sequence is established, if notes in each first melody sequence and beats in the target beat sequence meet a first preset condition, the pitch of the notes is used as beats in the target beat sequence to obtain first pitch sequences corresponding to each first melody sequence, and the first pitch sequences corresponding to each first melody sequence are summarized to obtain m first pitch sequences corresponding to the m first melody sequences.
Wherein obtaining m first melody sequences includes: identifying a voice track in the first file, and taking the voice track as a melody track; extracting starting points, ending points and pitch values of all notes in the melody track, and sequentially summarizing the starting points, ending points and pitch values of all notes in the melody track to obtain a starting sequence, a ending sequence and a pitch sequence; summarizing the initial sequence, the termination sequence and the pitch sequence to obtain each first melody sequence; and summarizing each first melody sequence to obtain m first melody sequences. The m first melody sequences are formed by m sub-melodies in the target music, and the m sub-melodies are stored in a database.
Wherein the target music is any type of music among classical music, popular music and country music, and the target music can be configured in a database or an external storage device.
The first file in the present application adopts a mid file format, and the mid file contains information such as separate tracks of various musical instruments, chord marks, music structure marks, lyrics, etc. The application selects the 'vocal' track of each mid file as the melody track.
As shown in fig. 2, for each melody track, a starting point, an ending point, and a pitch value of each note in the melody track are recorded, such as a first note 001: note (start) =13.461525, end (end point) =13.557679, pitch (pitch value) =49, and velocity) = 78.00007800007796.
The starting point, ending point and pitch values of all notes in the melody track may be summarized to obtain a starting sequence, a ending sequence and a pitch sequence, and if all the pitch values in notes 001-010 are summarized, a pitch sequence 49, 54, 51, 54, 56 may be formed, and the starting sequence and ending sequence are formed in a similar manner to the pitch sequence, which is not repeated herein.
And then summarizing the initial sequence, the termination sequence and the pitch sequence of the same melody to obtain a first melody sequence, and summarizing m first melody sequences to obtain m first melody sequences.
The method for establishing the target beat sequence corresponding to each first melody sequence comprises the following steps: calculating the length of an initial beat sequence corresponding to each first melody sequence; and establishing an initial beat sequence according to the length of the initial beat sequence, and initializing all beats in the initial beat sequence to obtain a target beat sequence corresponding to each first melody sequence.
The calculating the length of the initial beat sequence corresponding to each first melody sequence comprises the following steps: extracting the corresponding beat number and speed of each first melody sequence; the time is obtained by taking the mark and the speed as the quotient; calculating time points and numbers of beats in an initial beat sequence based on time and preset melody granularity; taking the maximum value of the quotient of the number of beats and the preset melody granularity as the length of the initial beat sequence.
Each mid file in the previous implementation, in which the corresponding beat number and speed of the melody are also recorded, can calculate the time by the following formula (1):
SecondPerBeat=60/BPM(1)
Wherein, the sign is 60, the second period is the time, i.e. the time elapsed by one beat, and the BPM is the speed.
The melody granularity (melody granularity, MG) of a given note, also called preset melody granularity, can calculate the time point and the number of the beat through the time calculated by the formula and the preset melody granularity, and the calculation formula is as follows:
the time point of each beat and the beat number (beat_num) are calculated.
BeatTimestamp=SecondPerBeat*beat_num*MG(2)
Wherein SecondPerBeat is time, i.e. time elapsed by one beat, beatTimestamp is time point of beat, bean_num is number of beat, and MG is preset melody granularity.
The maximum value of the quotient of the number of beats and the preset melody granularity is then taken as the length of the initial beat sequence, i.e., the length l=max (beat_num/MG).
And establishing an initial beat sequence according to the length L of the initial beat sequence, wherein the initial beat sequence is an all-0 sequence, initializing the all-0 sequence, and searching a starting point and an ending point of each beat in the initial beat sequence through each note in the obtained melody sequence to obtain a target beat sequence corresponding to each first melody sequence.
After the target beat sequence corresponding to each first melody sequence is obtained, judging that if the notes in each first melody sequence and the beats in the target beat sequence meet a first preset condition, assigning a value to the beats in the target beat sequence by taking the pitch of the notes to obtain a first pitch sequence corresponding to each first melody sequence, specifically, obtaining the time points of the beats in the target beat sequence, extracting the starting point and the ending point of the notes in each first melody sequence, judging that if the absolute value of the difference between the starting point of the notes in each first melody sequence and the time points of the beats in the target beat sequence is smaller than a first preset threshold value, assigning a value to the beats in the target beat sequence by taking the pitch of the notes to obtain the first pitch sequence corresponding to each first melody sequence.
And traversing the target beat sequence, wherein if one beat and Note pair (i, note k) exists, the first preset condition is met, and the first preset condition is any one of the formula (3) and the formula (4).
abs(Notek.start-BeatTimestampi)≤μ (3)
Notek.start<BeatTimestampi<Notek.end (4)
Note k, start is a starting point of a Note, beatTimestamp i is a time point of a beat, note k, end is an ending point of the Note, a first preset threshold is μ, the first preset threshold can be set according to requirements, a Note k in a melody sequence, and a beat i in a beat sequence.
And assigning the ith beat in the beat sequence to the pitch of the note, acquiring a first pitch sequence corresponding to each first melody sequence when all beat assignment in the beat sequence is finished, and then summarizing the first pitch sequences corresponding to each first melody sequence to acquire m first pitch sequences corresponding to m first melody sequences.
Step S120: based on the second melody sequence, a second pitch sequence corresponding to the second melody sequence is determined.
The second melody sequence is formed by the sub-melody input by the user, and is stored in mid file format, and the mid file contains information such as separation tracks, chord marks, music structure marks, lyrics and the like of various musical instruments. The application selects the 'vocal' track of each mid file as the melody track.
The manner of obtaining the second pitch sequence based on the second melody sequence is similar to the manner of obtaining the first pitch sequence based on the first melody sequence in step S110, and will not be repeated here.
Step S130: the first chord sequence is determined based on the m first pitch sequences and the similarity of the second pitch sequences.
For the similarity based on m first pitch sequences and second pitch sequences, determining a first chord sequence, calculating the similarity between the second pitch sequence and each first pitch sequence in the m first pitch sequences to obtain m similarity distances, extracting n candidate melody sequences corresponding to n similarities meeting a second preset threshold from the m similarity distances, wherein the n similarities are in one-to-one correspondence with the n candidate melody sequences, n is an integer smaller than or equal to m, determining the scores of n second chord sequences corresponding to the n candidate melody sequences based on the n candidate melody sequences, wherein the n candidate melody sequences are in one-to-one correspondence with the scores of the n second chord sequences, and finally determining the first chord sequence based on the n candidate melody sequences, the scores of the n second chord sequences and the second pitch sequences.
Calculating the similarity between the second pitch sequence and each of the m first pitch sequences to obtain m similarity distances, wherein the calculation formula is as follows:
where M user represents the second pitch sequence and M k represents the kth first pitch sequence of the M first pitch sequences.
After calculating the similarity distance, n candidate melody sequences corresponding to n similarities satisfying a second preset threshold may be extracted from the m similarity distances, where the second preset threshold is set according to the requirement, and is not specifically limited herein.
Wherein determining scores of n second chord sequences corresponding to the n candidate melody sequences based on the n candidate melody sequences includes: establishing a target chord sequence list corresponding to each candidate melody sequence aiming at each candidate melody sequence in the n candidate melody sequences; if the chords in the target chord sequence list and the beats in the target beat sequence meet a second preset condition, taking the chord type value as the chord assignment in the target chord sequence list, and obtaining a second chord sequence corresponding to each candidate melody sequence; calculating the score of a second chord sequence corresponding to each candidate melody sequence; and summarizing the scores of the second chord sequences corresponding to each candidate melody sequence to obtain the scores of the n second chord sequences.
The method for establishing the target chord sequence list corresponding to each candidate melody sequence comprises the following steps: calculating the length of an initial chord sequence list corresponding to each candidate melody sequence; and establishing an initial chord sequence list according to the length of the initial chord sequence list, and initializing all elements in the initial chord sequence list to obtain a target chord sequence list corresponding to each candidate melody sequence. The calculating the length of the initial chord sequence list corresponding to each candidate melody sequence comprises the following steps: extracting the corresponding beat number and speed of each candidate melody sequence; the time is obtained by taking the mark and the speed as the quotient; calculating time points and numbers of beats in a target beat sequence based on time and preset chord granularity; the maximum value of the quotient of the number of beats and the preset chord granularity is taken as the length of the initial chord sequence list.
For each of the mid files, the initial chord sequence list is represented by a tuple of (type, start, end), wherein type represents a chord category, start represents a chord start point, end represents a chord end point, and each element forms a corresponding sequence of chord start point sequence, chord end point sequence, and chord category sequence, respectively.
The initial chord sequence list has a length of q=max (beat_num/CG), where beat_num is the number of beats, and the number of beats is calculated in a similar manner to that of formula (2), and not described in detail herein, CG is a given chord granularity (chord granularity).
The initial chord sequence list may be established according to the length Q of the initial chord sequence list, and the ice woman initializes the initial chord list to form the target chord sequence list chord_list.
If the chords in the target chord sequence list and the beats in the target beat sequence meet a second preset condition, the chord assignment in the target chord sequence list is performed by taking the chord type value as the chord assignment, and a second chord sequence corresponding to each candidate melody sequence is obtained, including: acquiring a time point of beats in a target beat sequence; extracting a starting point and an ending point of a chord in the target chord sequence list; if the absolute value of the difference between the starting point of the chord in the target chord sequence list and the time point of the beat in the target beat sequence is smaller than a third preset threshold, and the time point of the beat in the target beat sequence is between the starting point and the ending point of the chord in the target chord sequence list, assigning a chord type value as the beat in the target beat sequence to obtain a second chord sequence corresponding to each candidate melody sequence.
Traversing the beat sequence, if there is one beat and note pair (i, chord k) in the target Chord sequence list chord_list, satisfying a second preset condition, wherein the second preset condition is any one of the following formulas (6) and (7),
abs(Chordk.start-BeatTimestampi)≤μ (6)
Chordk.start<BeatTimestampi<Chordk.end (7)
The Chord k. Start is the Chord start point, beatTimestamp i is the time point of the beat, chord k. End is the Chord end point, the first preset threshold is μ, and the first preset threshold can be set according to the requirement, chord category k, and beat i in the beat sequence.
Assigning the ith element in the chord_list as the type (type) of the chord to obtain a second chord sequence corresponding to each candidate melody sequence; when one chord mark does not satisfy any one of the following formulas, it is discarded.
After the second chord sequence corresponding to each candidate melody sequence is obtained, calculating the score of the second chord sequence corresponding to each candidate melody sequence, and specifically, obtaining a preset chord sequence set; calculating Levin Stent distance between a third chord sequence and a second chord sequence in a preset chord sequence set; a score for the second chord sequence is calculated based on Levin stats distance, length of the second chord sequence, length of the third chord sequence.
A given set of common chord sets C (i.e., preset sum-rotation sequence sets C) consisting of n third chord sequences are set, wherein all third chord sequences are the same length.
The minimum rice Wen Sitan distance D (C i) of each third chord sequence from the second chord sequence in the preset sum rotation sequence set C is calculated by the formula (8):
D(ci)=min(LevenShteinDistance(ci,Ck)) (8)
Where C i represents the ith second chord sequence, C k represents the kth third chord sequence in the set of rotation sequences C.
Then, the score C score of the second chord sequence can be calculated by the following formula (9):
Where D (C i) represents the minimum le Wen Sitan distance, len (C i) represents the length of the ith second chord sequence, len (C j) represents the length of the jth third chord sequence, and α is a random number.
After calculating the score of each second chord sequence, determining a first chord sequence based on the n candidate melody sequences, the scores of the n second chord sequences and the second pitch sequences, specifically, determining n candidate pitch sequences based on the n candidate melody sequences, wherein the n candidate melody sequences are in one-to-one correspondence with the n candidate pitch sequences; calculating the similarity between the second pitch sequence and each candidate pitch sequence in the n candidate pitch sequences to obtain n similarity distances; determining scores of n candidate melody sequences based on the n similarity distances and the scores of n second chord sequences, wherein the n similarity distances, the scores of the n second chord sequences and the scores of the n candidate melody sequences are in one-to-one correspondence; and selecting the chord sequence corresponding to the maximum candidate melody sequence score from the scores of the n candidate melody sequences as a first chord sequence.
For the obtained candidate pitch sequence M song and the second pitch sequence M user, a similarity distance (similarity distance) to the second pitch sequence M user is calculated at the start position of each candidate pitch sequence M song, as shown in the following formula:
Mtarget=sim(Muser,Mk)>t,t∈(0,1) (10)
Where M target is the similarity distance, M user is the second pitch sequence, and M k represents the kth candidate pitch sequence of the n candidate pitch sequences.
After calculating the n similarity distances, the Score i of each candidate melody sequence in the n candidate melody sequences may be determined based on the n similarity distances and the scores of the n second chord sequences, as follows:
Scorei=β×sim(Muser,Mi)+γ×Cscore(ci) (11)
β+γ=1 (12)
Wherein, M i represents the i-th candidate melody sequence in the n candidate melody sequences, M user represents the second pitch sequence, C score(ci) represents the score of the second chord sequence, and beta and gamma are random numbers which can be set according to requirements.
After Score i of each candidate melody sequence is calculated, the candidate chord sequence having the largest value may be selected therefrom as the first chord sequence.
Step S140: and carrying out post-processing on the first chord sequence to obtain the target chord sequence.
The post-processing at least comprises judgment of the music theory rule.
And carrying out post-processing on the first chord sequence to obtain a target chord sequence, judging whether the first chord sequence accords with a preset music theory rule, and if so, carrying out termination type judgment on the first chord sequence to obtain the target chord sequence.
The judging whether the first chord sequence accords with a preset music theory rule comprises the following steps: acquiring a third melody sequence corresponding to the first chord sequence; it is determined whether or not the accent in the first chord sequence coincides with the accent in the pitch in the third melody sequence.
For each set of third melody sequences m ik corresponding to the first chord sequence c ik, a music theory rule F (m, c) is used to judge the music theory rule for the first chord sequence c ik corresponding to each set of third melody sequences m ik, wherein the music theory rule is used to judge whether the accents in the first chord sequence are coincident with the accents in the pitches in the third melody sequences.
If the chord meets the music theory rule, reserving the chord, namely c ik=cik, and continuing to traverse the next chord; if the music theory rule is not met, the chord is changed into the chord existing in the music theory rule, namely c ik=mik
If the first chord sequence accords with a preset music theory rule, judging termination of the first chord sequence to obtain a target chord sequence, wherein the method comprises the following steps: if the accent in the first chord sequence is coincident with the accent in the pitch in the third chord sequence, judging whether a termination sequence exists in the first chord sequence; and if the termination sequence exists in the first chord sequence, taking the first chord sequence as a target chord sequence.
If the user inputs a melody of a complete song, such as the second melody sequence described above, then more than one melody must be terminated. Therefore, if the accent in the first chord sequence overlaps with the accent in the pitch in the third melody sequence, the termination formula is also determined.
The termination formula for a chord sequence is expressed by the following formula:
Mstopi=ChordSet(ClefM) (13)
Wherein, the ith termination sequence denoted by M stopi, clef M denotes the regulator.
When the first chord sequence corresponding to each section of the melody sequence is judged and processed through the formula, the chord sequence with the final output shown in fig. 3, namely the target chord sequence, is obtained, and the part in the visible rectangle frame represents the termination sequence.
The embodiment of the invention provides a chord sequence generation method, which comprises the following steps: and determining m first pitch sequences corresponding to the m first melody sequences based on the m first melody sequences, wherein the m first melody sequences and the m first pitch sequences are in one-to-one correspondence, m is an integer larger than 1, the m first melody sequences are formed by m sub-melodies in the target music, the m sub-melodies are sub-melodies stored in a database, and then determining a second pitch sequence corresponding to the second melody sequences based on the second melody sequences, wherein the second melody sequences are formed by sub-melodies input by a user, and then determining the first chord sequences based on the similarity of the m first pitch sequences and the second pitch sequences, and finally performing post-processing on the first chord sequences to obtain the target chord sequences, wherein the post-processing at least comprises judgment of a music rule. The invention determines the first chord sequence by calculating the similarity between m first melody sequences in the target music and the second melody sequence input by the user, and then carries out post-processing such as music theory judgment and the like on the first chord sequence, thereby obtaining rich and vivid chord sequences.
It should be understood that the sequence number of each step in the foregoing embodiment does not mean that the execution sequence of each process should be determined by the function and the internal logic, and should not limit the implementation process of the embodiment of the present invention.
The following are device embodiments of the invention, for details not described in detail therein, reference may be made to the corresponding method embodiments described above.
Fig. 4 shows a schematic structural diagram of a chord sequence generating device according to an embodiment of the present invention, and for convenience of explanation, only parts related to the embodiment of the present invention are shown, where the chord sequence generating device includes a first pitch sequence determining module 401, a second pitch sequence determining module 402, a chord sequence determining module 403, and a chord sequence generating module 404, specifically as follows:
The first pitch sequence determining module 401 is configured to determine m first pitch sequences corresponding to the m first melody sequences based on the m first melody sequences, where the m first melody sequences and the m first pitch sequences are in one-to-one correspondence, and m is an integer greater than 1, where the m first melody sequences are formed by m sub-melodies in the target music, and the m sub-melodies are sub-melodies stored in the database;
A second pitch sequence determining module 402, configured to determine a second pitch sequence corresponding to a second melody sequence based on the second melody sequence, where the second melody sequence is formed by a sub-melody inputted by the user;
A chord sequence determination module 403 for determining a first chord sequence based on the similarity of the m first pitch sequences and the second pitch sequences;
and the chord sequence generation module 404 is configured to post-process the first chord sequence to obtain a target chord sequence, where the post-process at least includes a determination of an music theory rule.
In a possible implementation, the first pitch sequence determining module 401 is further configured to obtain m first melody sequences;
establishing a target beat sequence corresponding to each first melody sequence aiming at each first melody sequence in m first melody sequences;
If the notes in each first melody sequence and the beats in the target beat sequence meet a first preset condition, assigning a value by taking the pitch of the notes as the beats in the target beat sequence, and obtaining a first pitch sequence corresponding to each first melody sequence;
And summarizing the first pitch sequences corresponding to each first melody sequence to obtain m first pitch sequences corresponding to m first melody sequences.
In one possible implementation, the first pitch sequence determination module 401 is further configured to identify a vocal track in the first file, and use the vocal track as the melody track;
Extracting starting points, ending points and pitch values of all notes in the melody track, and sequentially summarizing the starting points, ending points and pitch values of all notes in the melody track to obtain a starting sequence, a ending sequence and a pitch sequence;
Summarizing the initial sequence, the termination sequence and the pitch sequence to obtain each first melody sequence;
and summarizing each first melody sequence to obtain m first melody sequences.
In a possible implementation manner, the first pitch sequence determining module 401 is further configured to calculate a length of an initial beat sequence corresponding to each first melody sequence;
And establishing an initial beat sequence according to the length of the initial beat sequence, and initializing all beats in the initial beat sequence to obtain a target beat sequence corresponding to each first melody sequence.
In a possible implementation, the first pitch sequence determining module 401 is further configured to extract a beat number and a tempo corresponding to each first melody sequence;
The time is obtained by taking the mark and the speed as the quotient;
Calculating time points and numbers of beats in an initial beat sequence based on time and preset melody granularity;
Taking the maximum value of the quotient of the number of beats and the preset melody granularity as the length of the initial beat sequence.
In one possible implementation, the first pitch sequence determining module 401 is further configured to obtain a time point of a beat in the target beat sequence;
extracting a starting point and an ending point of notes in each first melody sequence;
If the absolute value of the difference between the starting point of the note in each first melody sequence and the time point of the beat in the target beat sequence is smaller than a first preset threshold, and the time point of the beat in the target beat sequence is between the starting point and the ending point of the note in each first melody sequence, assigning a value by taking the pitch of the note as the beat in the target beat sequence, and obtaining a first pitch sequence corresponding to each first melody sequence.
In a possible implementation manner, the chord sequence determination module 403 is further configured to calculate a similarity between the second pitch sequence and each of the m first pitch sequences, to obtain m similarity distances;
Extracting n candidate melody sequences corresponding to n similarity meeting a second preset threshold value from m similarity distances, wherein the n similarity corresponds to the n candidate melody sequences one by one, and n is an integer smaller than or equal to m;
Determining scores of n second chord sequences corresponding to the n candidate melody sequences based on the n candidate melody sequences, wherein the n candidate melody sequences are in one-to-one correspondence with the scores of the n second chord sequences;
The first chord sequence is determined based on the n candidate melody sequences, the scores of the n second chord sequences, and the second pitch sequence.
In a possible implementation manner, the chord sequence determination module 403 is further configured to, for each candidate melody sequence of the n candidate melody sequences, establish a target chord sequence list corresponding to each candidate melody sequence;
if the chords in the target chord sequence list and the beats in the target beat sequence meet a second preset condition, taking the chord type value as the chord assignment in the target chord sequence list, and obtaining a second chord sequence corresponding to each candidate melody sequence;
Calculating the score of a second chord sequence corresponding to each candidate melody sequence;
And summarizing the scores of the second chord sequences corresponding to each candidate melody sequence to obtain the scores of the n second chord sequences.
In a possible implementation manner, the chord sequence determination module 403 is further configured to calculate a length of an initial chord sequence list corresponding to each candidate melody sequence;
And establishing an initial chord sequence list according to the length of the initial chord sequence list, and initializing all elements in the initial chord sequence list to obtain a target chord sequence list corresponding to each candidate melody sequence.
In a possible implementation manner, the chord sequence determination module 403 is further configured to extract a beat number and a speed corresponding to each candidate melody sequence;
The time is obtained by taking the mark and the speed as the quotient;
Calculating time points and numbers of beats in a target beat sequence based on time and preset chord granularity;
The maximum value of the quotient of the number of beats and the preset chord granularity is taken as the length of the initial chord sequence list.
In one possible implementation, the chord sequence determination module 403 is further configured to obtain a time point of a beat in the target beat sequence;
Extracting a starting point and an ending point of a chord in the target chord sequence list;
If the absolute value of the difference between the starting point of the chord in the target chord sequence list and the time point of the beat in the target beat sequence is smaller than a third preset threshold, and the time point of the beat in the target beat sequence is between the starting point and the ending point of the chord in the target chord sequence list, assigning a chord type value as the beat in the target beat sequence to obtain a second chord sequence corresponding to each candidate melody sequence.
In a possible implementation manner, the chord sequence determining module 403 is further configured to obtain a preset chord sequence set;
Calculating Levin Stent distance between a third chord sequence and a second chord sequence in a preset chord sequence set;
a score for the second chord sequence is calculated based on Levin stats distance, length of the second chord sequence, length of the third chord sequence.
In a possible implementation manner, the chord sequence determination module 403 is further configured to determine n candidate pitch sequences based on the n candidate melody sequences, where the n candidate melody sequences are in one-to-one correspondence with the n candidate pitch sequences;
calculating the similarity between the second pitch sequence and each candidate pitch sequence in the n candidate pitch sequences to obtain n similarity distances;
Determining scores of n candidate melody sequences based on the n similarity distances and the scores of n second chord sequences, wherein the n similarity distances, the scores of the n second chord sequences and the scores of the n candidate melody sequences are in one-to-one correspondence;
and selecting the chord sequence corresponding to the maximum candidate melody sequence score from the scores of the n candidate melody sequences as a first chord sequence.
In one possible implementation manner, the chord sequence generation module 404 is further configured to determine whether the first chord sequence meets a preset music theory rule;
and if the first chord sequence accords with the preset music theory rule, judging a termination formula of the first chord sequence to obtain a target chord sequence.
In one possible implementation manner, the chord sequence generation module 404 is further configured to obtain a third melody sequence corresponding to the first chord sequence;
It is determined whether or not the accent in the first chord sequence coincides with the accent in the pitch in the third melody sequence.
In one possible implementation, the chord sequence generation module 404 is further configured to determine whether a termination sequence exists in the first chord sequence if the accent in the first chord sequence coincides with the accent in the pitch in the third melody sequence;
And if the termination sequence exists in the first chord sequence, taking the first chord sequence as a target chord sequence.
Fig. 5 is a schematic diagram of a terminal according to an embodiment of the present invention. As shown in fig. 5, the terminal 5 of this embodiment includes: a processor 501, a memory 502 and a computer program 503 stored in the memory 502 and executable on the processor 501. The processor 501, when executing the computer program 503, implements the steps in the above-described respective chord sequence generation method embodiments, for example, steps S110 to S140 shown in fig. 1. Or the processor 501 when executing the computer program 503 implements the functions of the modules/units in the above-described respective chord sequence generation device embodiments, such as the functions of the modules/units 401 and 404 shown in fig. 4.
The present invention also provides a readable storage medium having stored therein a computer program for implementing the chord sequence generation method provided by the above-mentioned various embodiments when the computer program is executed by a processor.
The program product provided by the embodiment of the invention realizes the steps in the above chord sequence generation method embodiments. Wherein the program product may employ any combination of one or more readable storage media. The readable storage medium may be a computer storage medium or a communication medium. Communication media includes any medium that facilitates transfer of a computer program from one place to another. Computer storage media can be any available media that can be accessed by a general purpose or special purpose computer. For example, a readable storage medium is coupled to the processor such that the processor can read information from, and write information to, the readable storage medium. In the alternative, the readable storage medium may be integral to the processor. The processor and the readable storage medium may reside in an Application SPECIFIC INTEGRATED Circuits (ASIC). In addition, the ASIC may reside in a user device. The processor and the readable storage medium may reside as discrete components in a communication device. The readable storage medium may be read-only memory (ROM), random-access memory (RAM), CD-ROMs, magnetic tape, floppy disk, optical data storage device, etc.
The present invention also provides a program product comprising execution instructions stored in a readable storage medium. The at least one processor of the apparatus may read the execution instructions from the readable storage medium, and execution of the execution instructions by the at least one processor causes the apparatus to implement the chord sequence generation method provided by the various embodiments described above.
In the above embodiment of the apparatus, it should be understood that the Processor may be a central processing unit (english: central Processing Unit, abbreviated as CPU), but may also be other general purpose processors, digital signal processors (english: DIGITAL SIGNAL Processor, abbreviated as DSP), application specific integrated circuits (english: application SPECIFIC INTEGRATED Circuit, abbreviated as ASIC), and the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the present invention may be embodied directly in a hardware processor for execution, or in a combination of hardware and software modules in a processor for execution.
The above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. A chord sequence generation method, comprising:
Determining m first pitch sequences corresponding to m first melody sequences based on the m first melody sequences, wherein the m first melody sequences and the m first pitch sequences are in one-to-one correspondence, and m is an integer greater than 1, wherein the m first melody sequences are formed by m sub-melodies in target music, and the m sub-melodies are sub-melodies stored in a database;
determining a second pitch sequence corresponding to a second melody sequence based on the second melody sequence, wherein the second melody sequence is formed by sub-melodies input by a user;
Determining a first chord sequence based on the similarity of the m first pitch sequences and the second pitch sequences;
And carrying out post-processing on the first chord sequence to obtain a target chord sequence, wherein the post-processing at least comprises judgment of the music theory rule.
2. The chord sequence generation method according to claim 1, wherein the determining m first pitch sequences corresponding to the m first melody sequences based on the m first melody sequences includes:
Obtaining m first melody sequences;
Establishing a target beat sequence corresponding to each first melody sequence aiming at each first melody sequence in the m first melody sequences;
if the notes in each first melody sequence and the beats in the target beat sequence meet a first preset condition, assigning a value to the beats in the target beat sequence by using the pitch of the notes to obtain a first pitch sequence corresponding to each first melody sequence;
And summarizing the first pitch sequences corresponding to each first melody sequence to obtain m first pitch sequences corresponding to the m first melody sequences.
3. The chord sequence generation method according to claim 2, wherein the obtaining m first melody sequences includes:
identifying a voice track in a first file, and taking the voice track as a melody track;
Extracting starting points, ending points and pitch values of all notes in the melody track, and sequentially summarizing the starting points, ending points and pitch values of all notes in the melody track to obtain a starting sequence, a ending sequence and a pitch sequence;
Summarizing the starting sequence, the ending sequence and the pitch sequence to obtain each first melody sequence;
and summarizing each first melody sequence to obtain m first melody sequences.
4. The chord sequence generation method according to claim 2, wherein the establishing the target beat sequence corresponding to each first melody sequence includes:
Calculating the length of an initial beat sequence corresponding to each first melody sequence;
And establishing the initial beat sequence according to the length of the initial beat sequence, and initializing all beats in the initial beat sequence to obtain a target beat sequence corresponding to each first melody sequence.
5. The chord sequence generation method according to claim 4, wherein the calculating the length of the initial beat sequence corresponding to each first melody sequence includes:
Extracting the corresponding mark and speed of each first melody sequence;
The time is obtained by the quotient of the sign and the speed;
calculating the time point and the number of beats in the initial beat sequence based on the time and the preset melody granularity;
Taking the maximum value of the quotient of the number of the beats and the preset melody granularity as the length of the initial beat sequence.
6. The chord sequence generation method according to claim 5, wherein if the notes in the first melody sequence and the beats in the target beat sequence satisfy a first preset condition, assigning a pitch of the notes to the beats in the target beat sequence to obtain a first pitch sequence corresponding to the first melody sequence, includes:
Acquiring time points of beats in the target beat sequence;
extracting a starting point and an ending point of notes in each first melody sequence;
if the absolute value of the difference between the starting point of the note in each first melody sequence and the time point of the beat in the target beat sequence is smaller than a first preset threshold, and the time point of the beat in the target beat sequence is between the starting point and the ending point of the note in each first melody sequence, assigning a value to the beat in the target beat sequence by using the pitch of the note to obtain a first pitch sequence corresponding to each first melody sequence.
7. The chord sequence generation method according to claim 1, wherein the determining a first chord sequence based on the similarity of the m first pitch sequences and the second pitch sequences includes:
calculating the similarity between the second pitch sequence and each first pitch sequence in the m first pitch sequences to obtain m similarity distances;
Extracting n candidate melody sequences corresponding to n similarity meeting a second preset threshold from the m similarity distances, wherein the n similarity corresponds to the n candidate melody sequences one by one, and n is an integer smaller than or equal to m;
Determining scores of n second chord sequences corresponding to the n candidate melody sequences based on the n candidate melody sequences, wherein the n candidate melody sequences are in one-to-one correspondence with the scores of the n second chord sequences;
The first chord sequence is determined based on the n candidate melody sequences, the scores of the n second chord sequences, and the second pitch sequence.
8. A chord sequence generation device, comprising:
The first pitch sequence determining module is used for determining m first pitch sequences corresponding to m first melody sequences based on the m first melody sequences, wherein the m first melody sequences and the m first pitch sequences are in one-to-one correspondence, and m is an integer greater than 1, wherein the m first melody sequences are formed by m sub-melodies in target music, and the m sub-melodies are sub-melodies stored in a database;
The second pitch sequence determining module is used for determining a second pitch sequence corresponding to a second melody sequence based on the second melody sequence, wherein the second melody sequence is formed by sub-melodies input by a user;
a chord sequence determination module for determining a first chord sequence based on the similarity of the m first pitch sequences and the second pitch sequences;
and the chord sequence generation module is used for carrying out post-processing on the first chord sequence to obtain a target chord sequence, wherein the post-processing at least comprises judgment of the music theory rule.
9. A terminal comprising a memory and one or more processors communicatively coupled to the memory;
stored in the memory are instructions executable by the one or more processors to cause the one or more processors to implement the chord sequence generation method as recited in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized by comprising a program or instructions that, when run on a computer, implements the chord sequence generation method of any of claims 1 to 7.
CN202410042686.4A 2024-01-11 2024-01-11 Chord sequence generation method, device, terminal and storage medium Pending CN118072698A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410042686.4A CN118072698A (en) 2024-01-11 2024-01-11 Chord sequence generation method, device, terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410042686.4A CN118072698A (en) 2024-01-11 2024-01-11 Chord sequence generation method, device, terminal and storage medium

Publications (1)

Publication Number Publication Date
CN118072698A true CN118072698A (en) 2024-05-24

Family

ID=91099657

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410042686.4A Pending CN118072698A (en) 2024-01-11 2024-01-11 Chord sequence generation method, device, terminal and storage medium

Country Status (1)

Country Link
CN (1) CN118072698A (en)

Similar Documents

Publication Publication Date Title
Barbancho et al. Automatic transcription of guitar chords and fingering from audio
Lee et al. Acoustic chord transcription and key extraction from audio using key-dependent HMMs trained on synthesized audio
CN109979488B (en) System for converting human voice into music score based on stress analysis
CN112382257B (en) Audio processing method, device, equipment and medium
Lee et al. A Unified System for Chord Transcription and Key Extraction Using Hidden Markov Models.
CN111613199B (en) MIDI sequence generating device based on music theory and statistical rule
CN108305604A (en) Music visualization, device and computer readable storage medium
CN108257588A (en) One kind is set a song to music method and device
CN113010730A (en) Music file generation method, device, equipment and storage medium
CN110867174A (en) Automatic sound mixing device
CN109841203B (en) Electronic musical instrument music harmony determination method and system
CN110910714A (en) Piano learning system
Lerch Software-based extraction of objective parameters from music performances
CN112634841B (en) Guitar music automatic generation method based on voice recognition
Boenn Computational models of rhythm and meter
CN113763913A (en) Music score generation method, electronic device and readable storage medium
CN112837698A (en) Singing or playing evaluation method and device and computer readable storage medium
CN110134823B (en) MIDI music genre classification method based on normalized note display Markov model
CN110853457B (en) Interactive music teaching guidance method
JP3716725B2 (en) Audio processing apparatus, audio processing method, and information recording medium
CN108922505B (en) Information processing method and device
CN118072698A (en) Chord sequence generation method, device, terminal and storage medium
CN112420003A (en) Method and device for generating accompaniment, electronic equipment and computer-readable storage medium
WO2022038958A1 (en) Musical piece structure analysis device and musical piece structure analysis method
JP2019109357A (en) Feature analysis method for music information and its device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination