Method and device for identifying MIDI sequence chord

文档序号:1186279 发布日期:2020-09-22 浏览:10次 中文

阅读说明:本技术 一种midi序列和弦进行识别方法和装置 (Method and device for identifying MIDI sequence chord ) 是由 计紫豪 李晨啸 于 2020-06-17 设计创作,主要内容包括:本发明公开了一种MIDI序列和弦进行识别方法和装置,属于智能作曲领域,具体包括步骤:获取MIDI文件和目标轨道;根据MIDI文件识别目标轨道上的音乐调性;确定和弦识别的多个细粒度,根据MIDI文件和音乐调性确定每个细粒度下和弦进行;融合多个细粒度下的和弦进行,获得MIDI序列的最终和弦进行。该MIDI序列和弦进行识别方法和装置能够根据不同细粒度进行和弦进行识别以提高和弦进行识别的准确性,且方法简单,可以工业应用。(The invention discloses a method and a device for identifying MIDI sequence chord, belonging to the field of intelligent music composition, and specifically comprising the following steps: acquiring MIDI files and target tracks; identifying the music tonality on the target track according to the MIDI file; determining a plurality of fine granularities of chord identification, and determining chord progression under each fine granularity according to the MIDI file and the music tonality; and fusing the chord progression under a plurality of fine granularities to obtain the final chord progression of the MIDI sequence. The method and the device for identifying the MIDI sequence chord can identify the chord according to different fine granularities so as to improve the accuracy of identifying the chord, and the method is simple and can be applied to industry.)

1. A method for identifying a MIDI sequence chord, comprising the steps of:

acquiring MIDI files and target tracks;

identifying the music tonality on the target track according to the MIDI file;

determining a plurality of fine granularities of chord identification, and determining chord progression under each fine granularity according to the MIDI file and the music tonality;

and fusing the chord progression under a plurality of fine granularities to obtain the final chord progression of the MIDI sequence.

2. A method for identifying a MIDI sequence chord as claimed in claim 1 wherein the identifying the key on the target track from the MIDI file comprises:

aiming at all notes of the MIDI file on a target track, constructing a pitch distribution histogram with the abscissa as a pitch category and the ordinate as the number of pitches;

screening out the pitch categories with the number being not 0 from the pitch distribution histogram to form an original pitch set;

when the length of the original pitch set is equal to 7, performing tonal hard matching, namely matching the same matched pitch set from a pitch set library to determine tonal main tones, determining tonal modes according to the tonal pitch sets with the relation sizes, and determining the tonal performance by combining the tonal main tones and the tonal modes;

when the length of the original pitch set is not equal to 7 or the same matched pitch set is not matched from the pitch set library, performing tonal soft matching, namely determining tonal according to the correlation between the matched pitch set and the original pitch set in the pitch set library.

3. A method of identifying a MIDI sequence chord as claimed in claim 2, wherein, in the event of a tonal hard match, a matching set of pitches identical to the original set of pitches is matched from the library of pitch sets, and the tonal tonic of the matching pitch set is taken as the tonal tonic of the original pitch set;

calculating the cross correlation coefficients of the original pitch set and the pitch sets with the relationship of major and minor keys respectively, and taking the major key or the minor key corresponding to the major cross correlation coefficients as the tone modulation of the original pitch set;

the tonality of the original pitch set is determined in combination with the tonal dominant and tonal mode.

4. A method for identifying a MIDI sequence chord as claimed in claim 2, wherein the cross-correlation coefficient between each matched pitch set in the library of pitch sets and the original pitch set is calculated during the soft-matching of the tonality, and the tonality of the matched pitch set corresponding to the largest cross-correlation coefficient is taken as the tonality of the original pitch set.

5. A MIDI sequence chord identification method as claimed in claim 2 or 4, characterized in that, in the tonal soft matching, after determining the original tonality of the original pitch set according to the correlation between the matched pitch set and the original pitch set, the upper quintudegree tonality of the original tonality is obtained;

comparing an original pitch set corresponding to the original tone with a fifth-degree pitch set corresponding to the fifth-degree tone, finding a first pitch category which does not belong to the fifth-degree pitch set from the original pitch set, and finding a second pitch category which does not belong to the original pitch set from the fifth-degree pitch set;

and taking the original tone or the upper five-degree tone corresponding to the pitch set to which the first pitch category or the second pitch category with the largest number of pitch categories belongs as the final tone.

6. A method for identifying a MIDI sequence chord progression as claimed in claim 1 wherein the determining each fine grained lower chord progression from MIDI files and tonality comprises:

analyzing the MIDI file to obtain the MIDI playing speed, the time interval of two adjacent playing speeds and a piano rolling graph;

carrying out statistical processing on the piano roller shutter graph according to the fine granularity to obtain a pitch statistical array;

when the pitch statistic array is within the length range, obtaining a chord uniquely matched with the pitch statistic array from a chord database, determining the chord as a determined chord of the MIDI file under the current fine granularity, wherein the corresponding correlation degree is 100;

when the pitch statistic array is larger than the maximum value of the length range, calculating the correlation degree of all chords and the original pitch set in the chord database according to the music key property, and further determining the determined chord and the corresponding correlation degree of the MIDI file under the current fine granularity;

when the pitch statistical array is smaller than the minimum value of the length range, directly outputting the chord determined by the MIDI file under the current fine granularity as the musical key, wherein the corresponding correlation degree is-1;

the determined chord and the corresponding duration are combined into a chord progression.

7. The method for identifying MIDI sequence chords as set forth in claim 6 wherein the statistically processing the piano shutter graph according to the fine granularity to obtain the pitch statistics array comprises:

compressing the piano rolling screen image into a pre-statistical array according to the fine granularity;

after normalization processing is carried out on the pre-statistical array, the maximum normalization value of each pitch category is extracted, and each pitch category and the corresponding maximum normalization value form an intermediate statistical array;

and extracting the pitch categories which are larger than the threshold value in the intermediate statistical array to form a pitch statistical array.

8. A method of identifying MIDI sequence chords as claimed in claim 6, wherein when the pitch statistics array is greater than the maximum of the length range, all chords in the chord database are traversed and the same set of pitch class groupings as the pitch statistics array is obtained for each chord;

when the length of the set is smaller than the minimum value of the length range, directly outputting the chord determined by the MIDI file under the current fine granularity to be the musical tone, wherein the corresponding correlation degree is-1;

when the length of the set is larger than the minimum value of the length range, calculating a first correlation degree of each chord and musical key in the chord database, and simultaneously calculating a second correlation degree of each chord and the original tone pitch set, wherein the sum of the first correlation degree and the second correlation degree is used as the total correlation degree of each chord;

and when the maximum total correlation degree is greater than the correlation degree threshold value, selecting the chord corresponding to the maximum total correlation degree as the determined chord of the MIDI file under the current fine granularity, wherein the corresponding total correlation degree is the final correlation degree of the determined chord.

9. A method for MIDI sequence chord progression identification as claimed in claim 6 wherein the fusing the plurality of chord progressions at the fine granularity to obtain a final chord progression for the MIDI sequence comprises:

for each beat, the chord with the greatest correlation and the corresponding duration are selected to constitute the final chord progression of the MIDI sequence.

10. A MIDI sequence chord progression identification apparatus, a computer memory, a computer processor and a computer program stored in and executable on the computer memory, wherein the computer memory has stored therein a set of relational size key pitches, the computer processor when executing the computer program implementing a MIDI sequence chord progression identification method as claimed in any one of claims 1 to 9.

Technical Field

The invention relates to the field of artificial intelligence composition, in particular to a method and a device for identifying a MIDI sequence chord.

Background

MIDI is an industry standard electronic communication protocol that describes communication protocols, digital interfaces, and specifications for connecting various electronic musical instruments, computers, and associated audio equipment to play, edit, and record music. Is a way of symbolizing music and is also the most commonly used way of representing music in computer composition.

A chord is a tone of two or more tones combined together, and a chord progression is an ordered set of a series of chords over time. From the age of common practice of classical music to today, chord progression has been the basis for western pop styles and classical music. In music style, chord progression is a decisive feature for creating melodies and rhythms. Different chord progression gives a different sense of hearing to the person playing the music. Generally, the chord is divided into three major functions, wherein the first-level chord is the main function, the third-level, fifth-level and seventh-level chords are subordinate functions, and the second-level, fourth-level and sixth-level chords are subordinate functions. The chord of the main function sounds most stable among the three, and the chord of the common music is designed from stable to unstable and then is solved to stable. Knowing the chord progression of a piece of music allows one to understand the structural skeleton of the piece of music, while understanding the emotional flow of the entire piece of music.

With the increasing development of computer music composition, people hope that the computer can more deeply understand the music style, structure, emotion and style, and chord progression is the basis for different possibilities of music. Most of the existing work is chord recognition based on waveform music.

Currently, two types of chord recognition methods are generally used: one is to perform spectrum analysis on the waveform at the waveform level, such as obtaining the rhythm starting point, mel cepstrum coefficient and the like of the waveform file, and then train the spectrum characteristics through a neural network to predict the chord progression of the unknown frequency spectrum. The problems with this type of approach are: it is a difficult matter to obtain a waveform file with a fine-labeled chord progression, and due to the black-box nature of neural networks, accuracy is often improved, and can only be significantly improved by increasing the amount of data. Therefore, this method stays at the laboratory level and has no way to be applied directly to the floor.

The other method is to carry out chord reasoning on the MIDI level, the most classical method is the chord identification method in Google Magenta, a hidden Markov chain is constructed, the Viterbi algorithm is utilized to obtain the chord with the maximum probability in a period of time, and the process is iterated to finally obtain the chord progression. The problems with this type of approach are: the fine granularity of chord progression is not controllable, and there is no way to accurately identify chord progression among many MIDI sequences with variations in speed or pitch.

In summary, none of the chord recognition methods available today reach an industrially useful level. And the existing method for identifying the MIDI sequence chord is extremely limited. Therefore, a technical solution for recognizing MIDI sequence chord progression that can be applied to the field in industry is urgently needed.

Disclosure of Invention

The invention aims to provide a method and a device for identifying a MIDI sequence chord, which can solve the problems that the existing chord identification is inaccurate and cannot be applied industrially.

In order to achieve the purpose of the invention, the technical scheme provided by the invention is as follows:

a method for recognizing a MIDI sequence chord comprising the steps of:

acquiring MIDI files and target tracks;

identifying the music tonality on the target track according to the MIDI file;

determining a plurality of fine granularities of chord identification, and determining chord progression under each fine granularity according to the MIDI file and the music tonality;

and fusing the chord progression under a plurality of fine granularities to obtain the final chord progression of the MIDI sequence.

A MIDI sequence chord progression identification apparatus, a computer memory, a computer processor and a computer program stored in and executable on the computer memory, wherein a set of relational-size key pitches is stored in the computer memory, the computer processor when executing the computer program implementing a MIDI sequence chord progression identification method as described above.

Compared with the prior art, the invention has the beneficial effects that at least:

the method and the device for identifying the MIDI sequence chord provided by the invention can identify the chord according to different fine granularities so as to improve the accuracy of identifying the chord, and the method is simple and can be applied to industry.

Drawings

In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.

FIG. 1 is a flow chart of a method for identifying a chord in a MIDI sequence according to an embodiment of the present invention;

FIG. 2 is a flow chart of music key identification provided by an embodiment of the present invention;

FIG. 3 is a line drawing of a pitch set distribution of major pitches provided by an embodiment of the present invention;

FIG. 4 is a line drawing of a tone pitch set distribution provided by an embodiment of the present invention;

FIG. 5 is a flow diagram of chord identification provided by an embodiment of the present invention;

fig. 6 is a schematic diagram of chord merging at multiple fine granularities according to an embodiment of the present invention.

Detailed Description

In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the detailed description and specific examples, while indicating the scope of the invention, are intended for purposes of illustration only and are not intended to limit the scope of the invention.

The method aims to solve the problem that deep learning cannot be directly applied to industry because of few data samples in the conventional MIDI sequence chord recognition method, and simultaneously, the problem that the recognition result is inaccurate due to uncontrollable fine granularity in the conventional MIDI sequence chord recognition method. The embodiment of the invention provides a method and a device for recognizing a MIDI sequence chord, which are described in detail below.

Fig. 1 is a flow chart of a method for recognizing a chord in a MIDI sequence according to an embodiment of the present invention. As shown in fig. 1, the method for identifying a MIDI sequence chord includes the steps of:

step 1, acquiring MIDI files and target tracks.

MIDI files refer to files suffixed with 'mid' or 'MIDI'. The invention provides chord identification, which is to identify single track data in MIDI, the processed track is regarded as target track, and when reading data, the data of target track in MIDI file is read directly according to target track.

And 2, identifying the music tonality on the target track according to the MIDI file.

The tonality is a general term for the dominant tone and the mode category of the key. For example, a major mode with C as the dominant tone may have a tonality of "C major", and a minor mode with a as the dominant tone may have a tonality of "a minor". There are mainly 24 key features in general music.

The step 2 is mainly used for the tonal modification identification, namely, the overall tonal modification of the target track is identified, and the tonal modification is not changed in the middle of the target track by default. If so, the recognition result is tone with a large number of continuous small nodes.

Fig. 2 is a flowchart of music key recognition according to an embodiment of the present invention. As shown in fig. 2, in one embodiment, identifying a key on a target track from a MIDI file comprises:

(a) and constructing a pitch distribution histogram with the abscissa as the pitch category and the ordinate as the number of pitches for all notes of the MIDI file on the target track.

In the standard MIDI music system, it specifies a pitch range of 128 values in total, from 0 to 127. Each pitch may be divided into 12 pitch classes, each corresponding to a pitch of the same chromatic feature, according to its chromatic feature, which may also be called a pitch class feature.

Classifying all notes of the MIDI file on the target track according to the pitch class of each note, counting the number of each pitch class, and forming a pitch distribution histogram with 12 pitch classes on the abscissa and the number of each pitch class on the ordinate.

(b) And screening the pitch categories with the number being not 0 from the pitch distribution histogram to form an original pitch set.

When a MIDI file appears on a target track, that is, a statistical track does not use the pitch category, the number of the pitch categories in a pitch distribution histogram is 0, such pitch categories are invalid for tone identification and chord identification, and therefore the pitch categories are excluded, and the pitch categories other than 0 are taken to form an original pitch set, where the original pitch set includes the pitch categories and the numbers corresponding to the pitch categories, and a histogram or a broken line diagram with the abscissa as the pitch category and the ordinate as the number corresponding to the pitch category can be constructed to represent the original pitch set.

(c) And when the length of the original pitch set is equal to 7, performing tonal hard matching, namely matching the same matched pitch set from a pitch set library to determine tonal main tones, determining tonal modes according to the tonal pitch sets with the relation sizes, and determining the tonal performance by combining the tonal main tones and the tonal modes.

One basic pitch tonality is composed of 7 pitch categories, therefore, when identifying the tonality of the original pitch set, firstly, the length of the original pitch set, that is, the number of the pitch categories in the original pitch set is judged whether to be equal to 7, when being equal to 7, hard matching is adopted, that is, the original pitch set is directly tonal-matched with the matched pitch set in the pitch set library, and if the matching is successful, the tonality identification is 100% correct.

The slave pitch set library is a database establishing a one-to-one mapping relation between the key tone and the matched pitch sets, each matched pitch set in the pitch set library consists of 7 pitch categories, and each matched pitch set has unique key tone containing the master tone and the key tone. The pitch set library comprises 12 major tones and 12 minor tones in total, and the pitch set library has 24 tones in total, is strong in expansibility, and can directly add more complex tones, such as favorable-place sub-tones, Dorah tones and the like, into the pitch set library when detecting some more complex MIDIs.

The relationship major-minor is also called parallel major-minor, and refers to a pair of major-minor with the same tone number, which are the relationship major or minor of each other. The relational major-minor is a major-minor and a minor-major with the same tone number, the same sound column relation and different major tone height. For example, a matching pitch set I in the pitch set library constitutes pitch categories of { "C", "D", "E", "F", "G", "a", "B" }, and the key tone is C major key; and matching a pitch set II to form pitch categories of { "A", "B", "C", "D", "E", "F", "G" }, wherein the tone is A minor tone. Therefore, the C major key and the A minor key corresponding to the matching pitch set I and the matching pitch set II are in a relationship with each other.

In one embodiment, when the key is matched hard, matching a matched pitch set which is the same as the original pitch set from a pitch set library, and taking the key of the matched pitch set as the key of the original pitch set;

calculating the cross correlation coefficients of the original pitch set and the pitch sets with the relationship of major and minor keys respectively, and taking the major key or the minor key corresponding to the major cross correlation coefficients as the tone modulation of the original pitch set;

the tonality of the original pitch set is determined in combination with the tonal dominant and tonal mode.

Fig. 3 is a line drawing of a pitch set distribution of major pitches provided by an embodiment of the present invention. Fig. 4 is a fold line of a tone pitch set distribution provided by an embodiment of the present invention. When the cross correlation coefficient is calculated, the cross correlation between the histogram or the line graph of the original pitch set and the major key pitch set distribution line graph is calculated to obtain one cross correlation coefficient, meanwhile, the cross correlation between the histogram or the line graph of the original pitch set and the minor key pitch set distribution line graph is calculated to obtain another cross correlation coefficient, and then the major key or the minor key corresponding to the larger cross correlation coefficient is selected from the two cross correlation coefficients to be the key mode of the original pitch set. For example, if the cross-correlation coefficient between the histogram or the line graph of the original pitch set and the distribution line graph of the minor pitch set is 0.9, and the cross-correlation coefficient between the histogram or the line graph of the original pitch set and the distribution line graph of the minor pitch set is 0.8, the corresponding minor key of 0.8 is the tonal mode of the original pitch set, and the tonal mode and the tonal main tone form the tonal mode.

Because the histogram of the original pitch set of the target track and the pitch distribution set broken line graph of the relation size are both arrays with the dimension of 12, a correlate function of a numpy library is called to respectively calculate the cross correlation coefficients of the pitch distribution broken line graph of the large pitch set and the histogram of the original pitch set and the cross correlation coefficients of the pitch distribution broken line graph of the small pitch set and the histogram of the original pitch set.

(d) When the length of the original pitch set is not equal to 7 or the same matched pitch set is not matched from the pitch set library, performing tonal soft matching, namely determining tonal according to the correlation between the matched pitch set and the original pitch set in the pitch set library.

The soft tonal matching is the method by which the original pitch set of the target track cannot be matched to the corresponding tone by the hard matching method, and determines the final tonal by calculating the correlation of the pitch distribution set histogram of the original pitch set of the target track and the matching pitch distribution set line graphs of all known tonalities in the pitch set library.

In another embodiment, in soft fitting, cross-correlation coefficients of each matched pitch set in the pitch set library and the original pitch set are calculated, and the fitting of the matched pitch set corresponding to the maximum cross-correlation coefficient is used as the fitting of the original pitch set.

And in the soft matching of the tone, also calling a correct function of a numpy library, and calculating the cross correlation coefficient of the original pitch set distribution histogram of the target track and all tone matching pitch set broken lines in the pitch set library, wherein the tone of the matching pitch set corresponding to the maximum cross correlation coefficient is used as the tone of the original pitch set.

In practical applications, since a MIDI is easily determined as the key with the dominant tone, after determining the most relevant key, it is necessary to add a key of five degrees to improve the accuracy of key recognition. In other embodiment, in the soft matching of the tone, after determining the original tone of the original pitch set according to the correlation between the matched pitch set and the original pitch set, the upper five-degree tone of the original tone is obtained;

comparing an original pitch set corresponding to the original tone with a fifth-degree pitch set corresponding to the fifth-degree tone, finding a first pitch category which does not belong to the fifth-degree pitch set from the original pitch set, and finding a second pitch category which does not belong to the original pitch set from the fifth-degree pitch set;

and taking the original tone or the upper five-degree tone corresponding to the pitch set to which the first pitch category or the second pitch category with the largest number of pitch categories belongs as the final tone.

For example, assuming that the original pitch set is { "C", "D", "E", "F", "G", "a", "B" }, and the upper five-degree pitch set is { "E", "F #", "G #", "a", "B", "C #", "D #" }, the first pitch class not belonging to the upper five-degree pitch set is found to be { "C", "D", "F", "G" }, and the second pitch class not belonging to the original pitch set is found to be { "F #", "G #", "C #," D # "}. If the total number of notes in the MIDI file containing the first pitch category is 44, the total number of notes in the MIDI file containing the second pitch category is 37; the original tone corresponding to the original pitch set to which the first pitch class belongs is taken as the final tone.

And step 3, determining a plurality of fine granularities of chord identification, and determining chord progression under each fine granularity according to the MIDI file and the music tonality, namely step chord labeling.

14页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种内置集成电路驱动芯片的有源蜂鸣器

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!