CN105374347A - A mixed algorithm-based computer-aided composition method for popular tunes in regions south of the Yangtze River - Google Patents
A mixed algorithm-based computer-aided composition method for popular tunes in regions south of the Yangtze River Download PDFInfo
- Publication number
- CN105374347A CN105374347A CN201510604881.2A CN201510604881A CN105374347A CN 105374347 A CN105374347 A CN 105374347A CN 201510604881 A CN201510604881 A CN 201510604881A CN 105374347 A CN105374347 A CN 105374347A
- Authority
- CN
- China
- Prior art keywords
- south
- melody
- river
- ditty
- trifle
- 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.)
- Granted
Links
Landscapes
- Auxiliary Devices For Music (AREA)
- Electrophonic Musical Instruments (AREA)
Abstract
The invention provides a mixed algorithm-based computer-aided composition method for popular tunes in regions south of the Yangtze River. The method specifically comprises the steps of establishing a music material library for popular tunes in regions south of the Yangtze River, establishing a composition knowledge rule base for popular tunes in regions south of the Yangtze River, formulating key rules of the genetic algorithm, extracting initial populations of the genetic algorithm and generating melodies of popular tunes in regions south of the Yangtze River. The music material library with 94 popular tunes in regions south of the Yangtze River is established for characteristic parameter extraction. The knowledge rule base is used for defining coding rules, genetic operators and a fitness function and a fitness function evaluation mechanism is used, so that the function of automatic computer composition for popular tunes in regions south of the Yangtze River is fulfilled; the knowledge rule base for popular tunes in regions south of the Yangtze River is used for establishing the fitness function in the genetic algorithm, so that the complexity of the interactive genetic algorithm is prevented, the accuracy of the fitness function is greatly improved, and thus the accuracy of a whole computer-aided composition system is improved.
Description
Technical field
The present invention relates to Computer Applied Technology field, the method for specifically a kind of south of the River ditty area of computer aided composition based on hybrid algorithm.
Background technology
Along with the application of computer technology on musical composition, Computer Music is arisen at the historic moment.Computer Music as an emerging subject, its fundamental purpose be appliance computer to imitate the cognition of people to music, carry out auxiliary creation and design.Can understand and simulate composer is being engaged in the mode of thinking in this particular procedure of musical composition on the one hand to explore area of computer aided composition problem; On the other hand, the multi-form musical works that the compositing system developed based on area of computer aided composition investigative technique is created can play the useful supplement to composer.
Current area of computer aided composition technology relative maturity abroad, sums up that main algorithm comprises that knowledge base system in Markov (Markov) conversion table (or claiming Markov chain), Algorithmic Composition research, music are grammatical, artificial neural network technology and genetic algorithm.
Markov (Markov) conversion table is just as a function.Its independent variable is current note, and functional value is then the possibility that note will appear in the next one.Musical works for a certain specific (as a certain composer or a certain period) style carries out collecting and adding up, and just can construct corresponding conversion table.The current Problems existing of this algorithm is the quality being difficult to judge to generate music, the fragment of stochastic generation in addition, and still there is gap between the entire music of standard.
The Algorithmic Composition of rule-based knowledge base system is that one is very naturally selected, particularly in defined perfect field Modling model or introduce clearly structure or rule time especially true.Its major advantage is: they have reasoning clearly, and can make explanations for the selection of behavior.The shortcoming of this algorithm is the foundation not only difficulty but also time-consuming of knowledge elicitation mechanism, and the music for comparatively specification easily sums up rule, but for impromptu changeable melody, is difficult to find specification.
As language has the syntax, music also has the music syntax.In conjunction with the method for statistics, use the music syntax can mate the probability distribution of the various music events (as interval, rhythm etc.) in (or catching) existing works, and the works of similar style can be generated based on these features.But this algorithm is difficult to find categorical grammar for the music of improvise, and then be difficult to decomposition and the restructuring of carrying out note, generate new music.
Perception and cognitive in, artificial neural network can from a model set learning, to avoid needing the formalization to rule.Particularly recurrent neural network successfully can obtain the surface structure of a melody through sentence, and based on the knowledge obtained like this, produces the melody made new advances.But the melody generated lacks the overall continuity of music, and namely it cannot obtain higher musical features.In principle, artificial neural network technology is more suitable for usually for analyzing musical works instead of creation.
Genetic algorithm is the computation model of the biological evolution process of the Darwinian heredity selection of simulation and natural selection, is a kind of method by simulating nature evolutionary process search optimum solution.Genetic algorithm uses fitness function to develop candidate (chromosome), thus obtains approximate optimal solution.But when using genetic algorithm to carry out the research of composition automatically, fitness function is very difficult accurate definition in fact.So occurred allowing people replace fitness function directly to assess a kind of chromosomal method, i.e. interactively genetic algorithm IGA.But at present the validity of interactive genetic algorithm is poor, user must hear likely potential solution, just can make the assessment with ubiquity.
In sum, various composition algorithm respectively has advantage and the Problems existing of himself.The area of computer aided compositing system setting up a kind of hybrid algorithm can be maximized favourable factors and minimized unfavourable ones, and carries out area of computer aided composition in optimized mode.In addition, start late about computer composing systematic research due to domestic, the Algorithmic Composition technology being directed to China National music unripe at present.Therefore will in the world existing Algorithmic Composition technology integrate, be applied to China National music analysis and creation in, and set up have the computer composing system of oneself national characters to be very necessary.
Summary of the invention
The method of the south of the River ditty area of computer aided composition based on hybrid algorithm that the object of the present invention is to provide a kind of fitness function accuracy high, easy to use, to solve the problem proposed in above-mentioned background technology.
For achieving the above object, the invention provides following technical scheme:
Based on a method for the south of the River ditty area of computer aided composition of hybrid algorithm, concrete steps are as follows:
(1) ditty SoundBreeze Clubtunes storehouse, the south of the River is set up: the ditty SoundBreeze Clubtunes storehouse, the south of the River setting up 94 head, for characteristic parameter extraction;
(2) south of the River ditty composition knowledge base is set up: extract acoustic feature and melody characteristics, set up knowledge base, for the formulation of genetic algorithm gordian technique;
(3) formulate the key rule of genetic algorithm: statistical study south of the River ditty material village, often used in village names being carried out to calculation of characteristic parameters and melody characteristics, formulate the coding rule of genetic algorithm, genetic operator and fitness function according to the feature extracted;
(4) extract the initial population of genetic algorithm: the mode selected according to user and speed, select corresponding melody from material database, and extract the initial population of the first trifle as genetic algorithm of melody;
(5) south of the River ditty melody is generated: by calculating fitness function, start to carry out to select, the genetic computation of crossover and mutation, through successive ignition until reach the condition of termination, then carry out the genetic computation of next trifle, the final melody generating the south of the River ditty of 12 trifles.
As the further scheme of the present invention: the mode in described step (4) is that G note of the ancient Chinese is adjusted, A plumage is in harmonious proportion the C mode of ancient Chinese music respectively, during speed is respectively at a slow speed and in fast.
As the further scheme of the present invention: when setting up south of the River ditty composition knowledge base in described step (2), acoustical characteristic parameters and the melody characteristics parameter of extracting south of the River ditty are respectively built, extract the method that acoustical characteristic parameters adopts time-frequency to calculate, extract and tone color, 11 characteristic parameters that pitch tunefulness is relevant, the Fourier transform length used when calculating frequency spectrum is 8192 sampled points, frequency resolution is 5.38Hz, the overlap of 75%, the frequency spectrum obtained is linear amplitude spectrum, the method of TrueEnvelope is used to calculate signal waveform envelope, all acoustical characteristic parameters are frame mean value, during frame, window is 0.05s, half is overlapping, melody characteristics parameter is obtained by the method for statistical study, melody characteristics parameter totally 7, comprises that special melody is advanced, rhythm and interval, and the statistical probability computing formula of melody characteristics parameter is as follows:
As the further scheme of the present invention: the fitness function in described step (3) carries out in two steps, first pass judgment on each trifle generated, then whole melody is carried out to the judge of fitness function, the fitness function of trifle is as follows:
(formula 2),
Wherein i represents i-th trifle, and j represents the jth note in i-th trifle, and N represents the number of note in trifle, and m represents the melodic interval number of interval amount >=48 in this trifle;
The fitness function of whole melody is as follows:
As the present invention's further scheme: when adopting genetic algorithm to generate the melody of south of the River ditty in described step (5), initial population is 10, take trifle as iteration unit, the trifle next round iteration that setting fitness function score is less than 4 points is given up, generate the south of the River ditty melody of 12 trifles, adopt the fitness function of whole melody to pass judgment on, melody the highest for score is considered as the melody generated.
Compared with prior art, the invention has the beneficial effects as follows:
The present invention defines coding rule, genetic operator and fitness function by knowledge base, fitness function is utilized to pass judgment on mechanism, thus realize the automatic music composing function of south of the River ditty computing machine, the knowledge base of south of the River ditty is used for the fitness function set up in genetic algorithm, both the complicacy of interactive genetic algorithm can have been avoided, also substantially increase the accuracy of fitness function, thus improve the accuracy of whole area of computer aided compositing system.
Accompanying drawing explanation
Fig. 1 is schematic flow sheet of the present invention.
Fig. 2 is the schematic flow sheet setting up fitness function in the present invention.
Fig. 3 be G note of the ancient Chinese that in the present invention, embodiment 1 generates adjust, in south of the River ditty melody spectrogram at a slow speed.
Embodiment
Be described in more detail below in conjunction with the technical scheme of embodiment to this patent.
Refer to Fig. 1-2, a kind of method of the south of the River ditty area of computer aided composition based on hybrid algorithm, concrete steps are as follows:
(1) ditty SoundBreeze Clubtunes storehouse, the south of the River is set up: the ditty SoundBreeze Clubtunes storehouse, the south of the River setting up 94 head, for characteristic parameter extraction;
(2) south of the River ditty composition knowledge base is set up: extract acoustic feature and melody characteristics, set up knowledge base, for the formulation of genetic algorithm gordian technique;
(3) formulate the key rule of genetic algorithm: statistical study south of the River ditty material database being carried out to calculation of characteristic parameters and melody characteristics, formulate the coding rule of genetic algorithm, genetic operator and fitness function according to the feature extracted;
(4) extract the initial population of genetic algorithm: the mode selected according to user and speed, select corresponding melody from material database, and extract the initial population of the first trifle as genetic algorithm of melody;
(5) south of the River ditty melody is generated: by calculating fitness function, start to carry out to select, the genetic computation of crossover and mutation, through successive ignition until reach the condition of termination, then carry out the genetic computation of next trifle, the final melody generating the south of the River ditty of 12 trifles.
When setting up ditty SoundBreeze Clubtunes storehouse, the south of the River, set up the material database of 94 first south of the River ditties, audio format comprises MIDI and Wave form two class, and midi format is used for extracting melody characteristics, and Wave form is used for extracting acoustical characteristic parameters, three class modes are comprised altogether in this material database, be that G note of the ancient Chinese is adjusted, A plumage is in harmonious proportion the C mode of ancient Chinese music respectively, speed of playing, from 50bpm to 160bpm, is limited with 90bpm, in by the speed definition lower than 90bpm being at a slow speed, in higher than the speed definition of 90bpm being fast.
Described when setting up south of the River ditty composition knowledge base, acoustical characteristic parameters and the melody characteristics parameter of extracting south of the River ditty are respectively built, extract the method that acoustical characteristic parameters adopts time-frequency to calculate, extract and tone color, 11 characteristic parameters that pitch tunefulness is relevant, as shown in table 1:
The acoustical characteristic parameters that table 1 calculates
The Fourier transform length used when calculating frequency spectrum is 8192 sampled points, frequency resolution is 5.38Hz, the overlap of 75%, the frequency spectrum obtained is linear amplitude spectrum, the method of TrueEnvelope is used to calculate signal waveform envelope, all acoustical characteristic parameters are frame mean value, and during frame, window is 0.05s, and half is overlapping.
Melody characteristics parameter is obtained by the method for statistical study, melody characteristics parameter totally 7, comprise that special melody is advanced, rhythm and interval, set up melody characteristics rule base by the ratio of adding up in 94 first south of the River ditties shared by each melody characteristics, the statistical probability computing formula of melody characteristics parameter is as follows:
The melody characteristics parameter calculated is as shown in table 2:
The melody characteristics parameter of table 2 south of the River ditty
Sequence number | Melody characteristics parameter |
1 | Music speed |
2 | Mode |
3 | Note duration |
4 | Special rhythm |
5 | The characteristic method of revolving-interval vector |
6 | The interval amount of melodic interval |
7 | Melody terminates the method for revolving |
The calculation procedure that genetic algorithm generates south of the River ditty is as follows:
1, initial population is set: after system obtains user's request, automatically the qualified melody of random choose in material database, and the first trifle of melody is extracted as initial population, adopt existing period, instead of computer random generates period, object allows compositing system search optimum solution faster, and the iteration unit of genetic algorithm is trifle, can keep complete happy think of so as much as possible, Population in Genetic Algorithms is set to 10.
2, genetic algorithm encoding rule is set: according to knowledge base setting coding rule, coding rule is encoded to each note, comprises duration, pitch and power.
(1) note duration: be that duration coding is carried out in 1 bat according to 4 dieresis, as shown in table 3:
The coding rule of table 3 duration
(2) note pitch: pitch comprises three octaves is altogether small character group, small character one group and small character two groups respectively.Be set to 0 with the pitch of small character group c, the encoded radio of its lingering sound is with a semitone for resolution increases progressively 1 successively, and the coding rule of pitch is as shown in table 4:
The coding rule of table 4 pitch
Musical alphabet | C3 | D3 | E3 | G3 | A3 | Rest |
Coding | 0 | 2 | 4 | 7 | 9 | -48 |
Musical alphabet | C4 | D4 | E4 | G4 | A4 | |
Coding | 12 | 14 | 16 | 19 | 21 | |
Musical alphabet | C5 | D5 | E5 | G5 | A5 | |
Coding | 24 | 26 | 28 | 31 | 33 |
(3) note intensity: 2/4 to clap the intensity comprising sound be strong beat and weak beat, the dynamics of rest is 0, and the dynamics of strong beat is 127, and the dynamics of weak beat is 100.
3, genetic operator mode is set: genetic operator comprises selection, crossover and mutation.
(1) selection opertor: adopt algorithm of tournament selection algorithm.
(2) crossover operator: intersect to the melody section that duration in trifle is a bat, crossover probability is 0.6.Stochastic choice two trifles, calculate each trifle duration, are crossover location when accumulation duration equals 1.
(3) mutation operator: mutation operator comprises interval variation, note division and note merge three kinds of variations.Make a variation according to trifle, and the probability according to 30% carries out, i.e. Stochastic choice 3 trifle variations in 10 trifles, 1 trifle carries out interval variation, 1 trifle carries out note merging, and last 1 trifle carries out note division, specifically which note variation in certain trifle, except head and the tail note constant different except, other note random variations:
A, interval make a variation: the pitch changing certain note, thus the front and back interval value affecting this note.When there is interval variation, before and after changing, the probability of interval is as shown in table 5 below.
Produce [0,1] random number, if random digit is in [0,0.947] in, be at the new interval interval of generation in the note in 5 and choose, if random digit in (0.947,0.973], interval interval≤5 before generation and choosing in the note of rear interval interval > 5; If random digit in (0.973,0.999], interval interval > 5 before generation and choosing in the note of rear interval interval≤5; If random digit in (0.999,1], interval interval > 5 before generation and choosing in the note of rear interval interval > 5.If do not have qualified note to occur in certain interval, then make a variation and directly terminate.
The probability distribution of table 5 interval variation
B, note divide: a note is split into two notes, and the duration that only makes a variation is 0.5,1, the note of 2.If note duration is 0.5, duration of a sound variation allocative decision is as shown in table 6, and the interval relation generating probability between two notes is as shown in table 7:
Duration of a sound combined scheme when table 6 note duration is 0.5
Allocative decision | 1/2+1/2 | 1/4+3/4 | 3/4+1/4 |
Probability | 0.8 | 0.1 | 0.1 |
The ratio of note duration shared by the data representation of wherein the first row.
Interval relation generating probability between table 7 two notes
If note duration is 1 or 2, then duration of a sound variation allocative decision is as shown in table 8, the still reference table 7 of the interval relation generating probability between two notes.
Duration of a sound combined scheme when table 8 note duration is 1 or 2
Allocative decision | 1/2+1/2 | 1/4+3/4 | 3/4+1/4 | 1/8+7/8 | 7/8+1/8 |
Probability | 0.8 | 0.08 | 0.08 | 0.02 | 0.02 |
C, note merge: two notes are merged into a sound, the note duration merged is identical with the duration of original two sounds, step is as follows: replace this two sounds with random note, duration is the duration summation of these two sounds, the pitch of note is selected to carry out according to such as lower probability: the first row represents pitch, second row represents the coding of pitch, and the third line is the probability occurred, still adopts the method for interval variation to carry out random selecting.
Table 9 note merges allocative decision
4, set fitness function: fitness function carries out in two steps, first pass judgment on each trifle generated, after all 12 trifles all generate, then whole melody is carried out to the judge of fitness function, the fitness function of trifle is as follows:
(formula 2),
Wherein i represents i-th trifle, and j represents the jth note in i-th trifle, and N represents the number of note in trifle, and m represents the melodic interval number of interval amount >=48 in this trifle;
A, Pitch: for detecting each note of appearance: the probability occurred according to the different pitch notes drawn in composition rule, can represent the fitness function of different pitch with Pitch (i), as shown in table 10:
Table 10 note pitch function table
Condition | Pitch(i) | Condition | Pitch(i) |
i=-48 | 0.049 | i=16 | 0.795 |
i=0,2,33 | 0 | i=19 | 1.000 |
i=4 | 0.01 | i=21 | 0.614 |
i=7 | 0.132 | i=24 | 0.456 |
i=9 | 0.272 | i=26 | 0.184 |
i=12 | 0.525 | i=28 | 0.089 |
i=14 | 0.653 | i=31 | 0.013 |
B, Duration: for detecting the duration that each note occurs: the probability occurred according to the note of the different durations drawn in composition rule, can represent the fitness function of different duration with Pitch (i), as shown in table 11:
Table 11 note duration function table
Condition | Duration(i) | Condition | Duration(i) |
i=0.5 | 1 | i=1 | 0.227 |
i=0.25 | 0.924 | i=1.5 | 0.046 |
i=0.75 | 0.086 | i=0.125 | 0.01 |
i=2 | 0.092 | i=0.375 | 0.005 |
C, Interval1: the assessment representing melodic interval in trifle: the melodic interval interval major part of south of the River ditty is all less than 7, if so the interval interval between adjacent two sounds is greater than 7, just think that interval is too large, do not meet south of the River ditty lyric portion feature.South of the River ditty is with 0, and the interval interval mode of advancing of 2,3 occupies overall about 88%, and add that pure fourth journey that the even interval had is spaced apart 5 is spaced apart 7 pure five degree and jumps into, these interval intervals occupy altogether about 93%.Therefore the fitness function of Interval1 is as shown in (formula 3):
(formula 3)
Wherein a represents the value that in a certain trifle, interval interval is less than 4, and b represents that interval interval equals the value of 4 or 5, and c represents other interval intervals.So when interval interval be less than 4 value more time, then this functional value is larger.
D, Melody3: the evaluation function of the characteristic interval vector of three sound formations, Melody3 will find out the interval vector of 3 sounds special in trifle, therefore before calculating Melody3, first do and judge: 3 sounds are formed duration and picks out as 2 bats or the 1 special interval vector clapped, if there is no interval vector, then directly do not calculate Melody3, the evaluation function of the characteristic interval vector of three sound formations is as shown in table 12:
The interval vector evaluation function that table 12 three sounds are formed
Condition | Melody3 |
P i+2>P i+1>P i | 0.6 |
P i+2<P i+1<P i | 0.92 |
P i+2=P i+1≠P i | 0.08 |
P i+1=P i≠P i+2 | 0.86 |
P i=P i+1=P i+2 | 0.17 |
(P i+2-P i+1)(P i+1-P i) < 0 and | P i+2-P i+1|=|(P i+1-P i)|≠0 | 1 |
E, Melody4: the evaluation function of the characteristic interval vector of four sound formations: the same with Melody3, first did before this function of calculating and judge, be that 2 bats or the 1 special interval vector clapped are found out by duration, the evaluation function of the characteristic interval vector of four sound formations is as shown in table 13:
The interval vector evaluation function that table 13 four sounds are formed
Condition | Melody4 |
P i+3>P i+2>P i+1>P i | 0.30 |
P i+3<P i+2<P i+1<P i | 0.21 |
(P i+2-P i+1)(P i+1-P i) < 0 and | P i+2-P i+1|=|(P i+1-P i)|≠|P i+3-P i+2|≠0 | 1 |
(P i+2-P i+1)(P i+1-P i) < 0 and | P i+2-P i+1|=|(P i+1-P i)|=|P i+3-P i+2|≠0 | 0.15 |
P i+3=P i+2Or P i+2=P i+1Or P i+1=P i | 0.50 |
(P i+2-P i+1)(P i+3-P i+2) < 0 and | P i+2-P i+1|=|(P i+3-P i+2)|≠|P i+1-P i|≠0 | 0.21 |
F, Rhythm: the evaluation function of characteristic rhythm: from contained rhythm, mainly comprise two large classes, and a class is the duration of rhythm is 2 bats, and another kind of be rhythm is 1 bat.Therefore rhythm function will be divided into two parts and calculate, one is Rhythm1 (calculating the rhythm that duration is 1 bat) function, another is Rhythm2 (calculating the rhythm that duration is 2 bats) function, and rhythm Rhythm2 evaluation function is as shown in table 14:
Table 14 rhythm Rhythm2 evaluation function
Condition | Rhythm2 |
N=3 | 0.16 |
N=2 and D 1>D 2 | 0.26 |
N=2 and D 1<D 2 | 0.04 |
N=1 | 0.56 |
Other | 0 |
In this table, D
1represent the duration coding of first sound level in a certain trifle, D
2represent this trifle second sound level duration coding, N represents the note quantity of this rhythm, and rhythm Rhythm1 evaluation function is as shown in Table 15:
Table 15 rhythm Rhythm1 evaluation function
Condition | Rhythm1 | Condition | Rhythm1 |
N=1 | 0.63 | N=3 and D 1=D 2 | 0.14 |
N=2 and D 1=D 2 | 1 | N=3 and D 1>D 2 | 0.38 |
N=2 and D 1<D 2 | 0.01 | N=3 and D 1<D 2 | 0.03 |
N=2 and D 1>D 2 | 0.28 | N=4 | 0.44 |
In this table, D
1represent the duration coding of first sound level in a certain trifle, D
2represent this trifle second sound level duration coding, N represents the note quantity in this rhythm.
The fitness function of overall melody:
(formula 4)
G, Interval2 represent the judge of little internode melodic interval
According to composition rule before, the judge of little internode melodic interval is shown in table 16:
Table 16Interval2 evaluation function
Interval difference | Interval2 | Interval difference | Interval2 |
0 | 0.329 | 10 | 0.012 |
2 | 1.000 | 12 | 0.017 |
3 | 0.990 | 14 | 0.001 |
4 | 0.134 | 15 | 0.003 |
5 | 0.201 | 17 | 0.001 |
7 | 0.034 | 19 | 0.001 |
8 | 0.014 | Rest | 0.009 |
9 | 0.012 | Other | 0 |
When adopting genetic algorithm to generate the melody of south of the River ditty, initial population is 10, take trifle as iteration unit, the trifle next round iteration that setting fitness function score is less than 4 points is given up, generate the south of the River ditty melody of 12 trifles, adopt the fitness function of whole melody to pass judgment on, melody the highest for score is considered as the melody generated.
Embodiment 1
Refer to Fig. 3, a kind of method of the south of the River ditty area of computer aided composition based on hybrid algorithm, concrete steps are as follows:
(1) generation of initial music population: first user selects mode and speed, such as select G note of the ancient Chinese mode and at a slow speed.After system acceptance to the demand of user, meet 10 song materials of this condition at SoundBreeze Clubtunes storehouse random choose, and using the first trifle of per song material as initial population;
(2) generate south of the River ditty knowledge base: the characteristic parameter extracting south of the River ditty, generate knowledge base.Characteristic parameter comprises by calculating 11 acoustic features and 7 melody characteristicses of Corpus--based Method that obtain, for the coding rule of genetic algorithm, fitness function and genetic operator provide algorithm foundation;
(3) coding rule of music is formulated: coding rule is encoded to each note, comprises duration, pitch and power.All coding rules are all with reference to the coding rule of midi format.Note duration is that duration coding is carried out in 1 bat according to 4 dieresis; The pitch of south of the River ditty comprises three octaves altogether, is small character group, small character one group and small character two groups respectively, is set to 0 with the pitch of small character group c, the encoded radio of its lingering sound with a semitone for resolution increases progressively 1 or successively decrease 1 successively; Note intensity comprises strong beat and weak beat, and the dynamics of setting strong beat is 127, and the dynamics of weak beat is 100, and the dynamics of rest is 0.
(4) setting of fitness function: the generation of fitness function mainly proposes based on the composition knowledge base of south of the River ditty.The judge of fitness function in two steps, first the fitness function of each trifle is only calculated when each trifle of iteration, trifle second from the bottom due to melody will have special end to revolve method, therefore for fitness function and the function slightly difference passing judgment on other trifles of this trifle; After all 12 trifles all generate, calculate the fitness function of whole melody.Relevant fitness function function is calculated as follows:
1) fitness function
(formula 1)
Wherein i represents i-th trifle, and j represents the jth note in i-th trifle, and N represents the number of note in trifle, and m represents the melodic interval number of interval amount >=48 in this trifle.
The musical features passed judgment in fitness function has the pitch of note, duration, interval relation, the characteristic of 3 sounds revolves method, the characteristic of 4 sounds revolves method and characteristic rhythm.
2) fitness function of trifle second from the bottom
(formula 5),
Fitness function adds terminating to revolve the requirement of method, requires that the interval interval of this trifle latter two sound and mode keynote is less than 5;
3) fitness function of melody:
The interval relation that the fitness function of whole melody adds between trifle is passed judgment on;
(5) setting of genetic operator: genetic operator comprises selection, crossover and mutation.Selection opertor adopts algorithm of tournament selection algorithm; The algorithm of crossover operator is that the melody section being a bat for duration in trifle is intersected, and crossover probability is 0.6; Mutation operator comprises interval variation, and note division and note merge three kinds, and mutation probability is 0.3.
(6) music rhythm is generated based on genetic algorithm: genetic iteration is carried out according to trifle, initial population is selected, the operation of crossover and mutation, then with fitness function, newly-generated trifle is passed judgment on, the trifle next round iteration that setting fitness function score is less than 4 points is given up, the south of the River ditty melody of final generation 12 trifles, adopt the fitness function of whole melody to pass judgment on, melody the highest for score is considered as the melody generated.
(7) south of the River ditty area of computer aided compositing system is completed according to above scheme, first south of the River ditty material database is carried out to extraction and the calculating of characteristic parameter, feature mainly comprises pitch, duration, interval, characteristic are revolved method and characteristic rhythm, and generated the composition knowledge base of south of the River ditty thus.Secondly according to knowledge base, coding rule, genetic operator and the fitness function of setting genetic algorithm.Then according to the demand of user to generation melody, from material database, call corresponding melody, and generate initial population.Eventually pass genetic algorithm successive ignition, generate the melody of the south of the River ditty of 12 trifles.
Utilize the method in the present embodiment, suppose user wish to generate G note of the ancient Chinese adjust, in south of the River ditty melody at a slow speed, through computer calculate, the melody of generation is as shown in Figure 3.
Experimental result shows, the fitness function setting genetic algorithm is removed based on south of the River ditty knowledge base, can ensure that generation melody meets the feature of south of the River ditty preferably, the melody such as generated is five-tone scale, the melody of major second and minor third is grading is main, contain scale formula, circulating type, fixed-point type and winding type four kinds of characteristics and revolve method, formed based on the melody of regular rhythm.
The present invention is by genetic algorithm and knowledge base two kinds of algorithm mixing, first according to musical features and the melody characteristics of south of the River ditty, adopt the method for calculation of characteristic parameters and statistical study, be extracted tone color, pitch, interval, characteristic revolve the composition knowledge base that the feature such as method and characteristic rhythm summarizes south of the River ditty, and set up the fitness function of genetic algorithm thus, coding rule and genetic operator, improve the accuracy of fitness function greatly, generates the melody of south of the River ditty preferably.
The present invention defines coding rule, genetic operator and fitness function by knowledge base, fitness function is utilized to pass judgment on mechanism, thus realize the automatic music composing function of south of the River ditty computing machine, the knowledge base of south of the River ditty is used for the fitness function set up in genetic algorithm, both the complicacy of interactive genetic algorithm can have been avoided, also substantially increase the accuracy of fitness function, thus improve the accuracy of whole area of computer aided compositing system.
Above the better embodiment of this patent is explained in detail, but this patent is not limited to above-mentioned embodiment, in the ken that one skilled in the relevant art possesses, various change can also be made under the prerequisite not departing from this patent aim.
Claims (5)
1., based on a method for the south of the River ditty area of computer aided composition of hybrid algorithm, it is characterized in that, concrete steps are as follows:
(1) ditty SoundBreeze Clubtunes storehouse, the south of the River is set up: the ditty SoundBreeze Clubtunes storehouse, the south of the River setting up 94 head, for characteristic parameter extraction:
(2) south of the River ditty composition knowledge base is set up: extract acoustic feature and melody characteristics, set up knowledge base, for the formulation of genetic algorithm gordian technique;
(3) formulate the key rule of genetic algorithm: statistical study south of the River ditty material database being carried out to calculation of characteristic parameters and melody characteristics, formulate the coding rule of genetic algorithm, genetic operator and fitness function according to the feature extracted;
(4) extract the initial population of genetic algorithm: the mode selected according to user and speed, select corresponding melody from material database, and extract the initial population of the first trifle as genetic algorithm of melody;
(5) south of the River ditty melody is generated: by calculating fitness function, start to carry out to select, the genetic computation of crossover and mutation, through successive ignition until reach the condition of termination, then carry out the genetic computation of next trifle, the final melody generating the south of the River ditty of 12 trifles.
2. the method for the composition of the south of the River ditty area of computer aided based on hybrid algorithm according to claim 1, is characterized in that, the mode in described step (4) is that G note of the ancient Chinese is adjusted, A plumage is in harmonious proportion the C mode of ancient Chinese music respectively, during speed is respectively at a slow speed and in fast.
3. the method for the south of the River ditty area of computer aided composition based on hybrid algorithm according to claim 1, it is characterized in that, when setting up south of the River ditty composition knowledge base in described step (2), acoustical characteristic parameters and the melody characteristics parameter of extracting south of the River ditty are respectively built, extract the method that acoustical characteristic parameters adopts time-frequency to calculate, extract and tone color, 11 characteristic parameters that pitch tunefulness is relevant, the Fourier transform length used when calculating frequency spectrum is 8192 sampled points, frequency resolution is 5.38Hz, the overlap of 75%, the frequency spectrum obtained is linear amplitude spectrum, the method of TrueEnvelope is used to calculate signal waveform envelope, all acoustical characteristic parameters are frame mean value, during frame, window is 0.05s, half is overlapping, melody characteristics parameter is obtained by the method for statistical study, melody characteristics parameter totally 7, comprises that special melody is advanced, rhythm and interval, and the statistical probability computing formula of melody characteristics parameter is as follows:
4. the method for the south of the River ditty area of computer aided composition based on hybrid algorithm according to claim 1, it is characterized in that, fitness function in described step (3) carries out in two steps, first each trifle generated is passed judgment on, then whole melody is carried out to the judge of fitness function, the fitness function of trifle is as follows:
Wherein i represents i-th trifle, and j represents the jth note in i-th trifle, and N represents the number of note in trifle, and m represents the melodic interval number of interval amount >=48 in this trifle;
The fitness function of whole melody is as follows:
5. the method for the south of the River ditty area of computer aided composition based on hybrid algorithm according to claim 1, it is characterized in that, when adopting genetic algorithm to generate the melody of south of the River ditty in described step (5), initial population is 10, take trifle as iteration unit, the trifle next round iteration that setting fitness function score is less than 4 points is given up, generate the south of the River ditty melody of 12 trifles, adopt the fitness function of whole melody to pass judgment on, melody the highest for score is considered as the melody generated.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510604881.2A CN105374347B (en) | 2015-09-22 | 2015-09-22 | A method of the Jiangnan ditty area of computer aided composition based on hybrid algorithm |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510604881.2A CN105374347B (en) | 2015-09-22 | 2015-09-22 | A method of the Jiangnan ditty area of computer aided composition based on hybrid algorithm |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105374347A true CN105374347A (en) | 2016-03-02 |
CN105374347B CN105374347B (en) | 2019-07-23 |
Family
ID=55376479
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510604881.2A Expired - Fee Related CN105374347B (en) | 2015-09-22 | 2015-09-22 | A method of the Jiangnan ditty area of computer aided composition based on hybrid algorithm |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105374347B (en) |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107045867A (en) * | 2017-03-22 | 2017-08-15 | 科大讯飞股份有限公司 | Automatic composing method, device and terminal device |
CN109215626A (en) * | 2018-10-26 | 2019-01-15 | 广东电网有限责任公司 | Method for automatically composing words and music |
CN109326270A (en) * | 2018-09-18 | 2019-02-12 | 平安科技(深圳)有限公司 | Generation method, terminal device and the medium of audio file |
CN109903744A (en) * | 2019-01-28 | 2019-06-18 | 平安科技(深圳)有限公司 | Melody generation method, device, computer readable storage medium and computer equipment |
CN110517655A (en) * | 2019-08-28 | 2019-11-29 | 广州艾颂智能科技有限公司 | A kind of melody generation method and system |
CN111613198A (en) * | 2020-05-12 | 2020-09-01 | 浙江大学 | MIDI rhythm type identification method and application |
WO2023024717A1 (en) * | 2021-08-25 | 2023-03-02 | 安徽华米健康科技有限公司 | Method and apparatus for generating sleep-aid music |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP0722163A2 (en) * | 1990-11-20 | 1996-07-17 | Yamaha Corporation | Electronic musical apparatus |
US6362409B1 (en) * | 1998-12-02 | 2002-03-26 | Imms, Inc. | Customizable software-based digital wavetable synthesizer |
CN101727892A (en) * | 2009-12-03 | 2010-06-09 | 北京中星微电子有限公司 | Method and device for generating reverberation model |
CN102063292A (en) * | 2009-11-18 | 2011-05-18 | 华为技术有限公司 | Harmony compiling method and device |
CN103631758A (en) * | 2013-11-21 | 2014-03-12 | 陕西理工学院 | Method for solving non-linear programming and absolute value equation through improved harmony search algorithm |
-
2015
- 2015-09-22 CN CN201510604881.2A patent/CN105374347B/en not_active Expired - Fee Related
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP0722163A2 (en) * | 1990-11-20 | 1996-07-17 | Yamaha Corporation | Electronic musical apparatus |
US6362409B1 (en) * | 1998-12-02 | 2002-03-26 | Imms, Inc. | Customizable software-based digital wavetable synthesizer |
CN102063292A (en) * | 2009-11-18 | 2011-05-18 | 华为技术有限公司 | Harmony compiling method and device |
CN101727892A (en) * | 2009-12-03 | 2010-06-09 | 北京中星微电子有限公司 | Method and device for generating reverberation model |
CN103631758A (en) * | 2013-11-21 | 2014-03-12 | 陕西理工学院 | Method for solving non-linear programming and absolute value equation through improved harmony search algorithm |
Non-Patent Citations (1)
Title |
---|
BIN-DA LIU ET AL: "Design of Adaptive Fuzzy Logic Controller Based on Linguistic-Hedge Concepts and Genetic Algorithms", 《IEEE TRANSACTIONS ON SYSTEMS》 * |
Cited By (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107045867A (en) * | 2017-03-22 | 2017-08-15 | 科大讯飞股份有限公司 | Automatic composing method, device and terminal device |
CN107045867B (en) * | 2017-03-22 | 2020-06-02 | 科大讯飞股份有限公司 | Automatic composition method and device and terminal equipment |
CN109326270A (en) * | 2018-09-18 | 2019-02-12 | 平安科技(深圳)有限公司 | Generation method, terminal device and the medium of audio file |
CN109215626A (en) * | 2018-10-26 | 2019-01-15 | 广东电网有限责任公司 | Method for automatically composing words and music |
CN109903744A (en) * | 2019-01-28 | 2019-06-18 | 平安科技(深圳)有限公司 | Melody generation method, device, computer readable storage medium and computer equipment |
WO2020155762A1 (en) * | 2019-01-28 | 2020-08-06 | 平安科技(深圳)有限公司 | Melody generation method and apparatus, computer readable storage medium and computer device |
CN110517655A (en) * | 2019-08-28 | 2019-11-29 | 广州艾颂智能科技有限公司 | A kind of melody generation method and system |
CN110517655B (en) * | 2019-08-28 | 2023-03-14 | 广州艾颂智能科技有限公司 | Melody generation method and system |
CN111613198A (en) * | 2020-05-12 | 2020-09-01 | 浙江大学 | MIDI rhythm type identification method and application |
CN111613198B (en) * | 2020-05-12 | 2023-09-08 | 浙江大学 | Rhythm type identification method and application of MIDI |
WO2023024717A1 (en) * | 2021-08-25 | 2023-03-02 | 安徽华米健康科技有限公司 | Method and apparatus for generating sleep-aid music |
Also Published As
Publication number | Publication date |
---|---|
CN105374347B (en) | 2019-07-23 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105374347A (en) | A mixed algorithm-based computer-aided composition method for popular tunes in regions south of the Yangtze River | |
CN106652984B (en) | Method for automatically composing songs by using computer | |
CN103456295B (en) | Sing synthetic middle base frequency parameters and generate method and system | |
Eigenfeldt et al. | Considering Vertical and Horizontal Context in Corpus-based Generative Electronic Dance Music. | |
CN107301857A (en) | A kind of method and system to melody automatically with accompaniment | |
CN111583891A (en) | Automatic musical note vector composing system and method based on context information | |
CN109346043A (en) | A kind of music generating method and device based on generation confrontation network | |
CN110120212A (en) | Piano auxiliary compositing system and method based on user's demonstration audio genre | |
EP2342708A1 (en) | Method for analyzing a digital music audio signal | |
Wang et al. | An intelligent music generation based on Variational Autoencoder | |
Garoufis et al. | Multi-Source Contrastive Learning from Musical Audio | |
Takada et al. | Genélive! generating rhythm actions in love live! | |
Zhu et al. | Grey wolf optimizer based deep learning mechanism for music composition with data analysis | |
CN110517655B (en) | Melody generation method and system | |
Sun et al. | Composing music with grammar argumented neural networks and note-level encoding | |
Zheng et al. | Chinese folk music composition based on genetic algorithm | |
Nikolaidis et al. | Playing with the masters: A model for improvisatory musical interaction between robots and humans | |
CN110853457A (en) | Interactive music teaching guidance method | |
CN113096624B (en) | Automatic creation method, device, equipment and storage medium for symphony music | |
Chakrabarty et al. | Quality measure model of music rhythm using genetic algorithm | |
CN104464702B (en) | Harmony accompaniment generation method based on genetic algorithm | |
Chang et al. | Fusing creative operations into evolutionary computation for composition: From a composer’s perspective | |
CN110211553B (en) | Music generation method based on variable neighborhood search and masking effect | |
Vargas et al. | Artificial musical pattern generation with genetic algorithms | |
Hastuti et al. | Gamelan composer: a rule-based interactive melody generator for Gamelan music |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20190723 Termination date: 20210922 |
|
CF01 | Termination of patent right due to non-payment of annual fee |