CN113066456A - Berlin noise-based melody generation method, device, equipment and storage medium - Google Patents
Berlin noise-based melody generation method, device, equipment and storage medium Download PDFInfo
- Publication number
- CN113066456A CN113066456A CN202110284981.7A CN202110284981A CN113066456A CN 113066456 A CN113066456 A CN 113066456A CN 202110284981 A CN202110284981 A CN 202110284981A CN 113066456 A CN113066456 A CN 113066456A
- Authority
- CN
- China
- Prior art keywords
- melody
- music
- sequence
- pitch
- score data
- 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
- 238000000034 method Methods 0.000 title claims abstract description 46
- 230000033764 rhythmic process Effects 0.000 claims abstract description 105
- 238000004422 calculation algorithm Methods 0.000 claims abstract description 64
- 239000011295 pitch Substances 0.000 claims description 171
- 230000006870 function Effects 0.000 claims description 25
- 230000008569 process Effects 0.000 claims description 14
- 238000004364 calculation method Methods 0.000 claims description 5
- 230000001020 rhythmical effect Effects 0.000 claims description 4
- 238000004590 computer program Methods 0.000 claims 2
- 238000001228 spectrum Methods 0.000 abstract description 3
- 238000013473 artificial intelligence Methods 0.000 abstract 1
- 239000000284 extract Substances 0.000 description 9
- 210000003746 feather Anatomy 0.000 description 9
- 238000010586 diagram Methods 0.000 description 6
- 238000000605 extraction Methods 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000002085 persistent effect Effects 0.000 description 1
- 230000007480 spreading Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000001256 tonic effect Effects 0.000 description 1
- 230000001052 transient effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G10—MUSICAL INSTRUMENTS; ACOUSTICS
- G10H—ELECTROPHONIC MUSICAL INSTRUMENTS; INSTRUMENTS IN WHICH THE TONES ARE GENERATED BY ELECTROMECHANICAL MEANS OR ELECTRONIC GENERATORS, OR IN WHICH THE TONES ARE SYNTHESISED FROM A DATA STORE
- G10H1/00—Details of electrophonic musical instruments
- G10H1/0008—Associated control or indicating means
- G10H1/0025—Automatic or semi-automatic music composition, e.g. producing random music, applying rules from music theory or modifying a musical piece
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Acoustics & Sound (AREA)
- Multimedia (AREA)
- Electrophonic Musical Instruments (AREA)
Abstract
The invention relates to the technical field of artificial intelligence, and discloses a Berlin noise-based melody generation method, device, equipment and storage medium, which are used for improving the fit rate of a target music melody and a music theme and improving the reserve magnitude of a music spectrum database. The Berlin noise-based melody generation method comprises the following steps: obtaining music score data, and reading the music score data from the music score data to obtain the data volume of the music score; judging whether the score data is single note sequence data or not based on the score data amount; if the music score data is single note sequence data, generating an initial music melody based on a preset Berlin noise algorithm; if the music score data is not single note sequence data, generating an initial music melody based on a pitch sequence, a rhythm sequence and a Berlin noise algorithm; the method comprises the steps of obtaining a target music melody based on mode constraint on an initial music melody, converting the target music melody into electronic music score data and storing the electronic music score data.
Description
Technical Field
The invention relates to the technical field of audio processing, in particular to a Berlin noise-based melody generation method, device, equipment and storage medium.
Background
The Buddhist Fabei, which is an essential element of each temple institute in Han Dynasty in daily early and late class, important law meeting and other Buddhist events, is especially named as Buddhist Fabei. The Fan can understand that the Bei takes different scriptures as a singing form of the lyrics, integrates essence of Chinese traditional ethnic music on music, combines Buddhism content, and forms a complex and huge rule system and strong religious culture connotation. The study of the musical characteristics of Buddhist Fabei and the generation of music with related styles are key links for establishing a Buddhist good knowledge platform and are also important ways for popularizing and spreading Buddhist good knowledge.
Fan bei is mostly oral biography, the number of the reserved music scores is very small, and the digitized form is rather few and few, so that a database of the system is difficult to form. For the current situation that the number of the digitized music scores is small, the music melody of the Fan case is generally automatically generated based on the random algorithm, but the music melody of the Fan case automatically generated based on the random algorithm causes the pitch in the melody to trend unnaturally and deviate from the theme of the melody.
Disclosure of Invention
The Berlin noise-based melody generation method, the Berlin noise-based melody generation device, the Berlin noise-based melody generation equipment and the Berlin noise-based melody generation storage medium enable pitches in the target music melody to trend naturally, improve the fit rate of the target music melody and the music theme and improve the reserve magnitude of a music spectrum database.
The invention provides a Berlin noise-based melody generation method in a first aspect, which comprises the following steps: obtaining music score data, and reading the music score data to obtain the data volume of the music score; judging whether the score data is single note sequence data or not based on the score data amount; if the music score data is single note sequence data, generating an initial music melody based on a preset Berlin noise algorithm; if the music score data is not single note sequence data, extracting a pitch sequence and a rhythm sequence from the music score data, and generating an initial music melody based on the pitch sequence, the rhythm sequence and the Berlin noise algorithm; and performing mode constraint on the initial music melody based on preset expert rule constraint to obtain a target music melody, and converting the target music melody into electronic music score data for storage.
Optionally, in a first implementation manner of the first aspect of the present invention, if the score data is single note sequence data, the generating an initial music melody based on a preset berlin noise algorithm includes: if the music score data is single note sequence data, calling a preset random algorithm to process the music score data into a plurality of random numbers, and generating a first list length and a second list length based on the plurality of random numbers, wherein the value range of the random numbers is [ -1,1 ]; generating a first integer and a second integer based on a preset random integer algorithm and the plurality of random numbers; respectively calculating a first integer and a second integer by adopting a preset pseudo-random number algorithm and combining the first list length and the second list length to obtain a first pseudo-random number and a second pseudo-random number; generating a plurality of frequency Berlin noises based on a preset Berlin noise algorithm, the first pseudo random number and the second pseudo random number; superposing a plurality of frequencies of Berlin noise to obtain fractal noise; an initial musical melody is determined based on the typing noise.
Optionally, in a second implementation manner of the first aspect of the present invention, if the score data is not single note sequence data, extracting a pitch sequence and a rhythm sequence from the score data, and generating an initial music melody based on the pitch sequence, the rhythm sequence, and the berlin noise algorithm includes: if the music score data is not single note sequence data, extracting a pitch sequence and a rhythm sequence from the music score data; generating a pitch melody sequence based on the pitch sequence; generating a rhythm melody sequence based on the rhythm sequence; and splicing the pitch melody sequence and the rhythm melody sequence to obtain an initial music melody.
Optionally, in a third implementation manner of the first aspect of the present invention, the generating a pitch melody sequence based on the pitch sequence includes: calculating the pitch sequence based on the Berlin noise algorithm to obtain a pitch fractal noise; randomly distributing a plurality of weights to the pitch fractal noise by adopting a preset random distribution algorithm to obtain a plurality of weighted pitch fractal noises; and superposing a plurality of weighted pitch fractal noises on the pitch sequence respectively to obtain a pitch melody sequence.
Optionally, in a fourth implementation manner of the first aspect of the present invention, the generating a rhythm melody sequence based on the rhythm sequence includes: determining a plurality of target templates among a plurality of preset rhythm templates based on the rhythm sequence; and splicing the target templates by adopting a preset rhythm random function to generate a rhythm melody sequence.
Optionally, in a fifth implementation manner of the first aspect of the present invention, the performing a style constraint on the initial music melody based on a preset expert rule constraint to obtain a target music melody, and converting the target music melody into electronic score data for storage includes: extracting a preset melody mode and a preset melody tone from a preset expert rule constraint; calling a preset scale function to carry out scale constraint calculation on the melody mode and the melody tonality to generate melody scale constraint; extracting melody pitches from the initial music melody, and limiting the melody pitches in the melody scale constraint based on a preset tone type constraint function to obtain the music melody after the pitch constraint; and extracting melody rhythm fractal noise from the initial music melody, adding preset pitch constraint to the melody rhythm fractal noise to obtain a target music melody, and converting the target music melody into electronic score data for storage.
Optionally, in a sixth implementation manner of the first aspect of the present invention, the extracting melody pitch fractal noise from the initial music melody, and limiting the melody pitch fractal noise within the melody scale constraint based on a preset tone constraint function, where the tone constraint function in the music melody after the tone constraint is obtained is:
wherein ,p′generanteFor music melody, p, after pitch constraintgenerantePitch and p of melodyscaleIs the melody scale constraint.
A second aspect of the present invention provides a pitch noise-based melody generating device, including: the acquisition module is used for acquiring music score data and reading the music score data from the music score data to obtain the data volume of the music score; the judging module is used for judging whether the music score data is single note sequence data or not based on the music score data amount; the initial music melody generating module is used for generating an initial music melody based on a preset Berlin noise algorithm if the music score data is single note sequence data; if the music score data is not the single note sequence data, extracting a pitch sequence and a rhythm sequence from the music score data, and generating an initial music melody based on the pitch sequence, the rhythm sequence and the Berlin noise algorithm; and the mode-adjusting constraint module is used for performing mode-adjusting constraint on the initial music melody based on preset expert rule constraint to obtain a target music melody, and converting the target music melody into electronic music score data for storage.
Optionally, in a first implementation manner of the second aspect of the present invention, the initial music melody generating module is specifically configured to: if the music score data is single note sequence data, calling a preset random algorithm to process the music score data into a plurality of random numbers, and generating a first list length and a second list length based on the plurality of random numbers, wherein the value range of the random numbers is [ -1,1 ]; generating a first integer and a second integer based on a preset random integer algorithm and a plurality of random numbers; respectively calculating a first integer and a second integer by adopting a preset pseudo-random number algorithm and combining the length of the first list and the length of the second list to obtain a first pseudo-random number and a second pseudo-random number; generating a plurality of frequency Berlin noises based on a preset Berlin noise algorithm, a first pseudo-random number and a second pseudo-random number; superposing a plurality of frequencies of Berlin noise to obtain fractal noise; an initial musical melody is determined based on the parting noise.
Optionally, in a second implementation manner of the second aspect of the present invention, the initial musical tune generating module 303 includes: an extraction unit 3031 for extracting a pitch sequence and a rhythm sequence from the score data if the score data is not the single note sequence data; a pitch melody sequence generating unit 3032 for generating a pitch melody sequence based on the pitch sequence; a rhythm melody sequence generating unit 3033 for generating a rhythm melody sequence based on the rhythm sequence; and the splicing unit 3034 is configured to splice the pitch melody sequence and the rhythm melody sequence to obtain an initial music melody.
Optionally, in a third implementation manner of the second aspect of the present invention, the pitch melody sequence generating unit is specifically configured to: calculating a pitch sequence based on a Berlin noise algorithm to obtain pitch fractal noise; randomly distributing a plurality of weights for the pitch fractal noise by adopting a preset random distribution algorithm to obtain a plurality of weighted pitch fractal noises; and respectively superposing a plurality of weighted pitch fractal noises on the pitch sequence to obtain the pitch melody sequence.
Optionally, in a fourth implementation manner of the second aspect of the present invention, the rhythm melody sequence generating unit is specifically configured to: determining a plurality of target templates in a plurality of preset rhythm templates based on the rhythm sequence; and splicing the target templates by adopting a preset rhythm random function to generate a rhythm melody sequence.
Optionally, in a fifth implementation manner of the second aspect of the present invention, the mode-adjusting constraint module is specifically configured to: extracting a preset melody mode and a preset melody tone from a preset expert rule constraint; calling a preset scale function to perform scale constraint calculation on the melody mode and the melody tonality to generate melody scale constraints; extracting melody pitches from the initial music melody, and limiting the melody pitches in melody scale constraints based on a preset tone type constraint function to obtain the music melody after the pitch constraints are obtained; and extracting rhythm fractal noise from the initial music melody, adding preset pitch constraint to the rhythm fractal noise to obtain a target music melody, and converting the target music melody into electronic music score data for storage.
Optionally, in a sixth implementation manner of the second aspect of the present invention, the tuning constraint function is:
wherein ,p′generanteFor music melody, p, after pitch constraintgenerantePitch and p of melodyscaleIs the melody scale constraint.
A third aspect of the present invention provides a pitch noise-based melody generating device including: a memory having instructions stored therein and at least one processor, the memory and the at least one processor interconnected by a line; the at least one processor invokes the instructions in the memory to cause the Berlin noise-based melody generating device to perform the Berlin noise-based melody generating method described above.
A fourth aspect of the present invention provides a computer-readable storage medium having stored therein instructions, which when run on a computer, cause the computer to execute the above-described bowlin noise-based melody generating method.
According to the technical scheme provided by the invention, music score data are obtained and the data volume of the music score is read from the music score data; judging whether the score data is single note sequence data or not based on the score data amount; if the music score data is single note sequence data, generating an initial music melody based on a preset Berlin noise algorithm; if the music score data is not single note sequence data, extracting a pitch sequence and a rhythm sequence from the music score data, and generating an initial music melody based on the pitch sequence, the rhythm sequence and the Berlin noise algorithm; and performing mode constraint on the initial music melody based on preset expert rule constraint to obtain a target music melody, and converting the target music melody into electronic music score data for storage. In the embodiment of the invention, the initial music melody of Buddhist Fanji is generated based on Berlin noise, the expert rule constraint tone type initial music melody is introduced, the target music melody is generated and is converted into the electronic music score data for storage, so that the pitch in the target music melody is natural, the fit rate of the target music melody and the music theme is improved, and the storage magnitude of a music score database is improved by storing the electronic music score data.
Drawings
FIG. 1 is a diagram of an embodiment of a Berlin noise-based melody generation method according to an embodiment of the present invention;
FIG. 2 is a diagram of another embodiment of the Berlin noise-based melody generation method according to the embodiment of the present invention;
FIG. 3 is a diagram of an embodiment of a Berlin noise-based melody generating device according to an embodiment of the present invention;
FIG. 4 is a diagram of another embodiment of the Berlin noise-based melody generating device according to the embodiment of the present invention;
fig. 5 is a schematic diagram of an embodiment of the pitch noise-based melody generating apparatus according to the embodiment of the present invention.
Detailed Description
The embodiment of the invention provides a Berlin noise-based melody generation method, a Berlin noise-based melody generation device, equipment and a storage medium, wherein the Berlin noise and expert rule constraint are introduced to generate a music melody, so that the pitch trend in a target music melody is natural, the fit rate of the target music melody and a music theme is improved, and the reserve magnitude of a music spectrum database is improved.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims, as well as in the drawings, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced otherwise than as specifically illustrated or described herein. Furthermore, the terms "comprises," "comprising," or "having," and any variations thereof, are intended to cover non-exclusive inclusions, 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 expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
For easy understanding, a specific flow of the embodiment of the present invention is described below, and referring to fig. 1, an embodiment of the method for generating a melody based on berlin noise in the embodiment of the present invention includes:
101. obtaining music score data, and reading the music score data from the music score data to obtain the data volume of the music score;
the server acquires the music score data and reads the music score data volume of the music score data.
Note that the score data is Musical Instrument Digital Interface (MIDI) format data, and the score data may be electronic score data stored in advance in a database, or score data in MIDI format collected in real time by an audio collection device.
It is to be understood that the executing subject of the present invention may be the pitch noise-based melody generating device, and may also be a terminal or a server, which is not limited herein. The embodiment of the present invention is described by taking a server as an execution subject.
102. Judging whether the score data is single note sequence data or not based on the score data amount;
the server judges whether the score data is single note sequence data based on the score data amount.
The server compares the amount of the score data with a note data amount threshold, determines that the score data is not single note sequence data when the amount of the score data is greater than the note data amount threshold, and determines that the score data is single note sequence data when the amount of the score data is less than or equal to the note data amount threshold.
For example, assuming that the threshold value of the amount of note data is 2KB and the amount of score data a1 is 2KB, the server determines that the score data is single note sequence data; if the amount of the score data a2 is 10KB, the server determines that the score data is not single note sequence data.
If the music score data is judged to be the current note sequence data, the server executes the step 103, otherwise, executes the step 104.
103. If the music score data is single note sequence data, generating an initial music melody based on a preset Berlin noise algorithm;
and if the server judges that the music score data is single note sequence data, the server calculates the music score data based on a Berlin noise algorithm to obtain an initial music melody.
The Berlin noise algorithm is used for randomly generating messy and actually ordered contents based on certain parameters, in the embodiment, when the initial music melody is generated, the server firstly fixes a part of parameter points, then smoothes the amplitude among the parameter points, generates a plurality of smooth noises with different frequencies, then superposes the smooth noises to obtain fractal noises, and finally determines the initial music melody based on the fractal noises.
104. If the music score data is not single note sequence data, extracting a pitch sequence and a rhythm sequence from the music score data, and generating an initial music melody based on the pitch sequence, the rhythm sequence and a Berlin noise algorithm;
and if the server judges that the music score data is the sequence data of two or more notes, the server extracts a pitch sequence and a rhythm sequence from the music score data, and then calculates the pitch sequence and the rhythm sequence by combining a Berlin noise algorithm to obtain the initial music melody.
When the music score data is the sequence data of two or more notes, the server extracts a pitch sequence and a rhythm sequence from the music score data. Regarding the pitch sequence, the server generates fractal noise based on berlin noise, and then superimposes fractal noise of different weights thereon, thereby obtaining a pitch melody. And regarding the rhythm sequence, the server carries out random splicing based on a preset rhythm template to obtain rhythm melody, and finally splices pitch melody and rhythm melody to obtain initial music melody.
It should be noted that the finally generated music melody in the invention is the music melody of Buddhist Favorax, so the rhythm melody is more stable and less in change, and the rhythm melody can be generated by randomly splicing the rhythm template preset in advance.
105. And performing mode constraint on the initial music melody based on preset expert rule constraint to obtain a target music melody, and converting the target music melody into electronic music score data for storage.
The server carries out mode constraint on the initial music melody, the constraint standard is preset expert rule constraint, then the target music melody is obtained, and finally the target music melody is converted into the music score data in the MIDI format to be stored.
It should be noted that, for the musical melody in bei john, the musical melody is usually constructed based on the traditional five-tone scale of china, and occasionally constructed in combination with the six-tone scale and the seven-tone scale, the tone of the musical melody is usually dominated by the quotient tone and the feather tone, and the semitone distance or pitch data is used as the expression form of the quotient tone or the feather tone. For example, the quotient tone is [ 22323 ] and the feather tone is [ 32232 ].
The server performs tone type constraint on the initial music melody based on a quotient tone type, a feather tone type and pitch constraint corresponding to the rhythm in the expert rule constraint to obtain a target music melody, and then converts the target music melody into electronic music score data in a MIDI format for storage, so that the reserve magnitude of a music score database is improved.
In the embodiment of the invention, the initial music melody of Buddhist Fanji is generated based on Berlin noise, the expert rule constraint tone type initial music melody is introduced, the target music melody is generated and is converted into the electronic music score data for storage, so that the pitch in the target music melody is natural, the fit rate of the target music melody and the music theme is improved, and the storage magnitude of a music score database is improved by storing the electronic music score data.
Referring to fig. 2, another embodiment of the method for generating a melody based on berlin noise according to the embodiment of the present invention includes:
201. obtaining music score data, and reading the music score data from the music score data to obtain the data volume of the music score;
the server acquires the music score data and reads the music score data volume of the music score data.
Note that the score data is MIDI format data, and the score data may be electronic score data stored in a database in advance, or score data in MIDI format collected in real time by an audio collecting apparatus.
202. Judging whether the score data is single note sequence data or not based on the score data amount;
the server judges whether the score data is single note sequence data based on the score data amount.
The server compares the amount of the score data with a note data amount threshold, determines that the score data is not single note sequence data when the amount of the score data is greater than the note data amount threshold, and determines that the score data is single note sequence data when the amount of the score data is less than or equal to the note data amount threshold.
For example, assuming that the threshold value of the amount of note data is 2KB and the amount of score data a1 is 2KB, the server determines that the score data is single note sequence data; if the amount of the score data a2 is 10KB, the server determines that the score data is not single note sequence data.
If the music score data is determined to be the current note sequence data, the server performs step 203, otherwise performs step 204 and 207.
203. If the music score data is single note sequence data, generating an initial music melody based on a preset Berlin noise algorithm;
and if the server judges that the music score data is single note sequence data, the server calculates the music score data based on a Berlin noise algorithm to obtain an initial music melody.
The Berlin noise algorithm is used for randomly generating messy and actually ordered contents based on certain parameters, in the embodiment, when the initial music melody is generated, the server firstly fixes a part of parameter points, then smoothes the amplitude among the parameter points, generates a plurality of smooth noises with different frequencies, then superposes the smooth noises to obtain fractal noises, and finally determines the initial music melody based on the fractal noises.
Specifically, if the music score data is single note sequence data, the server calls a preset random algorithm to process the music score data into a plurality of random numbers, the value range of each random number is [ -1,1], the plurality of random numbers are grouped to obtain a first list and a second list, and then the length of the first list and the length of the second list are extracted to obtain the length of the first list and the length of the second list; secondly, the server generates a first integer and a second integer based on a plurality of random numbers and a preset random integer algorithm, wherein the preset random integer algorithm is as follows:
v0=[x]mod N,v1=(v0+1)mod N,
wherein ,v0Is a first integer, v1Is a second integer, N is a plurality of random numbers, and x is frequency; then the server adopts a preset pseudo-random number algorithm, and combines the length of the first list and the length of the second list to respectively calculate the first integer and the second integer to generate a first pseudo-random number and a second pseudo-random number, wherein the preset pseudo-random number algorithm is as follows:
pi=Li[p[vi]]
wherein ,piIs a first pseudo-random number or a second pseudo-random number, viIs a first integer or a second integer, LiEither the first list length or the second list length. Calculating based on a preset Berlin noise algorithm by combining the first pseudo random number and the second pseudo random number to obtain a plurality of frequency Berlin noises, wherein the preset Berlin noise algorithm is as follows:
PN(x)=(1-e(v0-x))*p0*(v0-x)+e(v0-x)*p1*(v1-x),
wherein e (t) is 6t5-15t4+10t3Is a relaxation curve, t is v0-x, x being the frequency. And then superposing the Berlin noises with a plurality of frequencies to obtain parting noises, wherein the specific process is as follows:
wherein fn (x) is a typing noise; finally, an initial musical melody is determined based on the parting noise.
204. If the music score data is not the single note sequence data, extracting a pitch sequence and a rhythm sequence from the music score data;
if the server judges the score data as two or more note sequence data, the server extracts a pitch sequence and a rhythm sequence from the score data.
Note that the music score data includes pitch data and rhythm data, so that the server can extract a pitch sequence and a rhythm sequence from the music score data.
205. Generating a pitch melody sequence based on the pitch sequence;
and the server calculates based on the pitch sequence to obtain the pitch melody sequence.
Specifically, the server calculates pitch fractal noise based on a Berlin noise algorithm, and then different weights are distributed to the pitch fractal noise by adopting a preset random distribution algorithm to obtain a plurality of weighted pitch fractal noises; then, superposing a plurality of weighted pitch fractal noises on the basis of the pitch melody sequence to obtain the pitch melody sequence, wherein the specific process is as follows:
Mgenerate(m)=Morigin(n)+wiFNj(m),
wherein ,Mgenerate(M) is the pitch melody sequence, Morigin(n)Is a sequence of pitches, wiFNj(m) is the weighted pitch fractal noise.
In addition, M isgenerate(M) a sequence of pitches of indefinite length, Morigin(n)A fixed-length pitch sequence. The method is used for modifying the original pitch sequence, if only one tonic Note is input as the initial pitch sequence, the pitch melody sequence is obtained by continuously superposing fractal noises with different weights, and the specific process is as follows:
Mgenerate(t)=Note+wFN(t),
wherein t is time.
206. Generating a rhythm melody sequence based on the rhythm sequence;
the server generates a rhythmic melody sequence based on the rhythmic sequence.
Since the rhythm of the Buddhist Fabei music melody is smooth, the server determines four target rhythm templates in the plurality of rhythm templates, wherein the four target rhythm templates are shown in the table 1.
Table 1: multiple rhythm templet
The server adopts a preset rhythm random function to splice a plurality of target templates to generate a rhythm melody sequence.
207. Splicing the pitch melody sequence and the rhythm melody sequence to obtain an initial music melody;
the server splices the pitch melody sequence and the rhythm melody sequence into an initial music melody.
It should be noted that the pitch melody sequence includes a plurality of pitch melodies, the rhythm melody sequence includes a plurality of rhythm melodies, different moments correspond to different pitch melodies and different rhythm melodies, the server splices the corresponding pitch melodies and the corresponding rhythm melodies based on the moments, and splices all the pitch melodies in the pitch melody sequence and all the rhythm melodies in the rhythm melody sequence one by one according to the splicing mode to obtain the initial music melody.
208. And performing mode constraint on the initial music melody based on preset expert rule constraint to obtain a target music melody, and converting the target music melody into electronic music score data for storage.
The server carries out mode constraint on the initial music melody, the constraint standard is preset expert rule constraint, then the target music melody is obtained, and finally the target music melody is converted into the music score data in the MIDI format to be stored.
It should be noted that, for the musical melody in bei john, the musical melody is usually constructed based on the traditional five-tone scale of china, and occasionally constructed in combination with the six-tone scale and the seven-tone scale, the tone of the musical melody is usually dominated by the quotient tone and the feather tone, and the semitone distance or pitch data is used as the expression form of the quotient tone or the feather tone. For example, the quotient tone is [ 22323 ] and the feather tone is [ 32232 ].
The server performs tone type constraint on the initial music melody based on a quotient tone type, a feather tone type and pitch constraint corresponding to the rhythm in the expert rule constraint to obtain a target music melody, and then converts the target music melody into electronic music score data in a MIDI format for storage, so that the reserve magnitude of a music score database is improved. Specifically, the server extracts a preset melody mode and a preset melody tonality from a preset expert rule constraint, wherein the preset melody tonality is a quotient tone [ 22323 ] or a feather tone [ 32232 ], and the preset tonality (key) is a C major tone taking C as a major tone and an A minor tone taking A as a major tone; then the server calls a preset scale function to carry out scale constraint calculation on the melody mode and the melody tonality to generate melody scale constraints; the server extracts melody pitches from the initial music melodies and limits the melody pitches in melody scale constraints based on preset tone type constraint functions to obtain music melodies after the pitches are constrained; the server extracts rhythm fractal noise from the initial music melody, adds preset pitch constraint to the rhythm fractal noise to obtain a target music melody, and converts the target music melody into electronic music score data for storage.
For ease of understanding, the following description is made in conjunction with specific application scenarios:
assume that the preset Mode is 32232]Where key is A, MIDI format value of A is 57, the server calls a preset scale function pair [ 32232 ]]And the key is calculated as A (57) to obtain the melody scale constraint pscale(ii) a The server extracts the melody pitch p from the original music melodygeneranteThen, the server limits the melody pitch within the melody scale constraint based on the preset tone constraint function to obtain the music melody after the pitch constraint, wherein the preset tone constraint function is
wherein ,p′generanteFor music melody, p, after pitch constraintgenerantePitch and p of melodyscaleIs the melody scale constraint. In the application scenario, the music melody with constrained pitch is [57,60,62,64,67,69,72,74,76,79,81 [ ]]。
The process is directed to pitch constraint, when the rhythm is constrained, the server firstly extracts rhythm fractal noise from the initial music melody, then adds preset pitch constraint to the rhythm fractal noise to obtain the target music melody, and converts the target music melody into electronic music score data for storage. This process is expressed in functional form as follows:
FN(tS)=KS,
wherein ,KSIs tSA particular pitch at a time.
In the embodiment of the invention, the initial music melody of Buddhist Fanji is generated based on Berlin noise, the expert rule constraint tone type initial music melody is introduced, the target music melody is generated and is converted into the electronic music score data for storage, so that the pitch in the target music melody is natural, the fit rate of the target music melody and the music theme is improved, and the storage magnitude of a music score database is improved by storing the electronic music score data.
In the above description of the pitch generation method based on the berlin noise in the embodiment of the present invention, referring to fig. 3, the following description of the pitch generation device based on the berlin noise in the embodiment of the present invention, an embodiment of the pitch generation device based on the berlin noise in the embodiment of the present invention includes:
the acquisition module 301 is configured to acquire music score data and read the music score data from the music score data to obtain a music score data volume;
a judging module 302, configured to judge whether the music score data is single note sequence data based on the music score data amount;
an initial music melody generating module 303, configured to generate an initial music melody based on a preset Berlin noise algorithm if the score data is single note sequence data;
if the music score data is not the single note sequence data, extracting a pitch sequence and a rhythm sequence from the music score data, and generating an initial music melody based on the pitch sequence, the rhythm sequence and the Berlin noise algorithm;
and the mode constraint module 304 is configured to perform mode constraint on the initial music melody based on preset expert rule constraint to obtain a target music melody, and convert the target music melody into electronic music score data for storage.
In the embodiment of the invention, the initial music melody of Buddhist Fanji is generated based on Berlin noise, the expert rule constraint tone type initial music melody is introduced, the target music melody is generated and is converted into the electronic music score data for storage, so that the pitch in the target music melody is natural, the fit rate of the target music melody and the music theme is improved, and the storage magnitude of a music score database is improved by storing the electronic music score data.
Referring to fig. 4, another embodiment of the pitch noise-based melody generating device according to the embodiment of the present invention includes:
the acquisition module 301 is configured to acquire music score data and read the music score data from the music score data to obtain a music score data volume;
a judging module 302, configured to judge whether the music score data is single note sequence data based on the music score data amount;
an initial music melody generating module 303, configured to generate an initial music melody based on a preset Berlin noise algorithm if the score data is single note sequence data;
if the music score data is not the single note sequence data, extracting a pitch sequence and a rhythm sequence from the music score data, and generating an initial music melody based on the pitch sequence, the rhythm sequence and the Berlin noise algorithm;
and the mode constraint module 304 is configured to perform mode constraint on the initial music melody based on preset expert rule constraint to obtain a target music melody, and convert the target music melody into electronic music score data for storage.
Optionally, the initial music melody generating module 303 may be further specifically configured to:
if the music score data is single note sequence data, calling a preset random algorithm to process the music score data into a plurality of random numbers, and generating a first list length and a second list length based on the plurality of random numbers, wherein the value range of the random numbers is [ -1,1 ];
generating a first integer and a second integer based on a preset random integer algorithm and a plurality of random numbers;
respectively calculating a first integer and a second integer by adopting a preset pseudo-random number algorithm and combining the length of the first list and the length of the second list to obtain a first pseudo-random number and a second pseudo-random number;
generating a plurality of frequency Berlin noises based on a preset Berlin noise algorithm, a first pseudo-random number and a second pseudo-random number;
superposing a plurality of frequencies of Berlin noise to obtain fractal noise;
an initial musical melody is determined based on the parting noise.
Optionally, the initial music melody generating module 303 includes:
an extraction unit 3031 for extracting a pitch sequence and a rhythm sequence from the score data if the score data is not the single note sequence data;
a pitch melody sequence generating unit 3032 for generating a pitch melody sequence based on the pitch sequence;
a rhythm melody sequence generating unit 3033 for generating a rhythm melody sequence based on the rhythm sequence;
and the splicing unit 3034 is configured to splice the pitch melody sequence and the rhythm melody sequence to obtain an initial music melody.
Optionally, the pitch melody sequence generating unit 3032 may be further specifically configured to:
calculating a pitch sequence based on a Berlin noise algorithm to obtain pitch fractal noise;
randomly distributing a plurality of weights for the pitch fractal noise by adopting a preset random distribution algorithm to obtain a plurality of weighted pitch fractal noises;
and respectively superposing a plurality of weighted pitch fractal noises on the pitch sequence to obtain the pitch melody sequence.
Optionally, the rhythm melody sequence generating unit 3033 may be further specifically configured to:
determining a plurality of target templates in a plurality of preset rhythm templates based on the rhythm sequence;
and splicing the target templates by adopting a preset rhythm random function to generate a rhythm melody sequence.
Optionally, the mode-adjusting constraint module 304 may be further specifically configured to:
extracting a preset melody mode and a preset melody tone from a preset expert rule constraint;
calling a preset scale function to perform scale constraint calculation on the melody mode and the melody tonality to generate melody scale constraints;
extracting melody pitches from the initial music melody, and limiting the melody pitches in melody scale constraints based on a preset tone type constraint function to obtain the music melody after the pitch constraints are obtained;
and extracting rhythm fractal noise from the initial music melody, adding preset pitch constraint to the rhythm fractal noise to obtain a target music melody, and converting the target music melody into electronic music score data for storage.
Optionally, the tuning constraint function is:
wherein ,p′generanteFor music melody, p, after pitch constraintgenerantePitch and p of melodyscaleIs the melody scale constraint.
In the embodiment of the invention, the initial music melody of Buddhist Fanji is generated based on Berlin noise, the expert rule constraint tone type initial music melody is introduced, the target music melody is generated and is converted into the electronic music score data for storage, so that the pitch in the target music melody is natural, the fit rate of the target music melody and the music theme is improved, and the storage magnitude of a music score database is improved by storing the electronic music score data.
Fig. 3 and 4 above describe the pitch noise-based melody generating device in the embodiment of the present invention in detail from the perspective of the modular functional entity, and the pitch noise-based melody generating device in the embodiment of the present invention is described in detail from the perspective of the hardware processing.
Fig. 5 is a schematic diagram of a structure of a berlin noise-based melody generating device 500 according to an embodiment of the present invention, which may have a relatively large difference due to different configurations or performances, and may include one or more processors (CPUs) 510 (e.g., one or more processors) and a memory 520, one or more storage media 530 (e.g., one or more mass storage devices) storing applications 533 or data 532. Memory 520 and storage media 530 may be, among other things, transient or persistent storage. The program stored in the storage medium 530 may include one or more modules (not shown), each of which may include a series of instruction operations in the Berlin noise-based melody generating device 500. Still further, the processor 510 may be configured to communicate with the storage medium 530 to execute a series of instruction operations in the storage medium 530 on the Berlin noise-based melody generating device 500.
The Berlin noise-based melody generating device 500 may also include one or more power supplies 540, one or more wired or wireless network interfaces 550, one or more input-output interfaces 560, and/or one or more operating systems 531, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc. Those skilled in the art will appreciate that the configuration of the Berlin noise-based melody generating device shown in FIG. 5 does not constitute a limitation of the Berlin noise-based melody generating device, and may include more or fewer components than shown, or some components in combination, or a different arrangement of components.
Further, the computer usable storage medium may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function, and the like; the storage data area may store data created according to the use of the blockchain node, and the like.
The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium, and which may also be a volatile computer-readable storage medium, having stored therein instructions, which, when run on a computer, cause the computer to perform the steps of the method for generating a Berlin noise-based melody.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present 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 solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.
Claims (10)
1. A Berlin noise-based melody generation method, comprising:
obtaining music score data, and reading the music score data to obtain the data volume of the music score;
judging whether the score data is single note sequence data or not based on the score data amount;
if the music score data is single note sequence data, generating an initial music melody based on a preset Berlin noise algorithm;
if the music score data is not single note sequence data, extracting a pitch sequence and a rhythm sequence from the music score data, and generating an initial music melody based on the pitch sequence, the rhythm sequence and the Berlin noise algorithm;
and performing mode constraint on the initial music melody based on preset expert rule constraint to obtain a target music melody, and converting the target music melody into electronic music score data for storage.
2. The Berlin noise-based melody generating method of claim 1, wherein the generating an initial music melody based on a preset Berlin noise algorithm if the score data is a single note sequence data comprises:
if the music score data is single note sequence data, calling a preset random algorithm to process the music score data into a plurality of random numbers, and generating a first list length and a second list length based on the plurality of random numbers, wherein the value range of the random numbers is [ -1,1 ];
generating a first integer and a second integer based on a preset random integer algorithm and the plurality of random numbers;
respectively calculating a first integer and a second integer by adopting a preset pseudo-random number algorithm and combining the first list length and the second list length to obtain a first pseudo-random number and a second pseudo-random number;
generating a plurality of frequency Berlin noises based on a preset Berlin noise algorithm, the first pseudo random number and the second pseudo random number;
superposing a plurality of frequencies of Berlin noise to obtain fractal noise;
an initial musical melody is determined based on the typing noise.
3. The Berlin noise-based melody generating method of claim 1, wherein the extracting a pitch sequence and a rhythm sequence from the score data if the score data is not the single note sequence data and generating an initial music melody based on the pitch sequence, the rhythm sequence and the Berlin noise algorithm comprises:
if the music score data is not single note sequence data, extracting a pitch sequence and a rhythm sequence from the music score data;
generating a pitch melody sequence based on the pitch sequence;
generating a rhythm melody sequence based on the rhythm sequence;
and splicing the pitch melody sequence and the rhythm melody sequence to obtain an initial music melody.
4. The Berlin noise-based melody generating method of claim 3, wherein the generating a pitch melody sequence based on the pitch sequence comprises:
calculating the pitch sequence based on the Berlin noise algorithm to obtain a pitch fractal noise;
randomly distributing a plurality of weights to the pitch fractal noise by adopting a preset random distribution algorithm to obtain a plurality of weighted pitch fractal noises;
and superposing a plurality of weighted pitch fractal noises on the pitch sequence respectively to obtain a pitch melody sequence.
5. The Berlin noise-based melody generating method of claim 3, wherein the generating a rhythmic melody sequence based on the rhythmic sequence comprises:
determining a plurality of target templates among a plurality of preset rhythm templates based on the rhythm sequence;
and splicing the target templates by adopting a preset rhythm random function to generate a rhythm melody sequence.
6. The Berlin noise-based melody generating method of any one of claims 1 to 5, wherein the tone-wise constraining the initial music melody based on the pre-set expert rules constraint to obtain the target music melody and converting the target music melody into the electronic score data for storage comprises:
extracting a preset melody mode and a preset melody tone from a preset expert rule constraint;
calling a preset scale function to carry out scale constraint calculation on the melody mode and the melody tonality to generate melody scale constraint;
extracting melody pitches from the initial music melody, and limiting the melody pitches in the melody scale constraint based on a preset tone type constraint function to obtain the music melody after the pitch constraint;
and extracting melody rhythm fractal noise from the initial music melody, adding preset pitch constraint to the melody rhythm fractal noise to obtain a target music melody, and converting the target music melody into electronic score data for storage.
7. The Berlin noise-based melody generation method of claim 6, wherein the melody pitch fractal noise is extracted from the initial music melody and is limited within the melody scale constraint based on a preset tonal constraint function, and the tonal constraint function in the music melody after pitch constraint is obtained as follows:
wherein ,p′generanteFor music melody, p, after pitch constraintgenerantePitch and p of melodyscaleIs the melody scale constraint.
8. A Berlin noise-based melody generating apparatus, characterized in that the Berlin noise-based melody generating apparatus comprises:
the acquisition module is used for acquiring music score data and reading the music score data from the music score data to obtain the data volume of the music score;
the judging module is used for judging whether the music score data is single note sequence data or not based on the music score data amount;
the initial music melody generating module is used for generating an initial music melody based on a preset Berlin noise algorithm if the music score data is single note sequence data;
if the music score data is not the single note sequence data, extracting a pitch sequence and a rhythm sequence from the music score data, and generating an initial music melody based on the pitch sequence, the rhythm sequence and the Berlin noise algorithm;
and the mode-adjusting constraint module is used for performing mode-adjusting constraint on the initial music melody based on preset expert rule constraint to obtain a target music melody, and converting the target music melody into electronic music score data for storage.
9. A Berlin noise-based melody generating apparatus, characterized in that the Berlin noise-based melody generating apparatus comprises: a memory having instructions stored therein and at least one processor, the memory and the at least one processor interconnected by a line;
the at least one processor invoking the instructions in the memory to cause the Berlin noise-based melody generating device to perform the Berlin noise-based melody generating method of any of claims 1-7.
10. A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the berlin noise-based melody generating method of any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110284981.7A CN113066456B (en) | 2021-03-17 | 2021-03-17 | Method, device, equipment and storage medium for generating melody based on Berlin noise |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110284981.7A CN113066456B (en) | 2021-03-17 | 2021-03-17 | Method, device, equipment and storage medium for generating melody based on Berlin noise |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113066456A true CN113066456A (en) | 2021-07-02 |
CN113066456B CN113066456B (en) | 2023-09-29 |
Family
ID=76560931
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110284981.7A Active CN113066456B (en) | 2021-03-17 | 2021-03-17 | Method, device, equipment and storage medium for generating melody based on Berlin noise |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113066456B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2001005455A (en) * | 1999-06-23 | 2001-01-12 | Ricoh Co Ltd | Melody sound generating device |
WO2018194456A1 (en) * | 2017-04-20 | 2018-10-25 | Universiteit Van Amsterdam | Optical music recognition omr : converting sheet music to a digital format |
CN109166564A (en) * | 2018-07-19 | 2019-01-08 | 平安科技(深圳)有限公司 | For the method, apparatus and computer readable storage medium of lyrics text generation melody |
CN112489606A (en) * | 2020-11-26 | 2021-03-12 | 北京有竹居网络技术有限公司 | Melody generation method, device, readable medium and electronic equipment |
-
2021
- 2021-03-17 CN CN202110284981.7A patent/CN113066456B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2001005455A (en) * | 1999-06-23 | 2001-01-12 | Ricoh Co Ltd | Melody sound generating device |
WO2018194456A1 (en) * | 2017-04-20 | 2018-10-25 | Universiteit Van Amsterdam | Optical music recognition omr : converting sheet music to a digital format |
CN109166564A (en) * | 2018-07-19 | 2019-01-08 | 平安科技(深圳)有限公司 | For the method, apparatus and computer readable storage medium of lyrics text generation melody |
CN112489606A (en) * | 2020-11-26 | 2021-03-12 | 北京有竹居网络技术有限公司 | Melody generation method, device, readable medium and electronic equipment |
Non-Patent Citations (1)
Title |
---|
王超: "母带制作若干技术对民族乐器音色渲染技巧探究", 中国优秀硕士学位论文全文数据库 哲学与人文科学辑, pages 140 - 654 * |
Also Published As
Publication number | Publication date |
---|---|
CN113066456B (en) | 2023-09-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109166564B (en) | Method, apparatus and computer readable storage medium for generating a musical composition for a lyric text | |
Pampalk | A Matlab Toolbox to Compute Music Similarity from Audio. | |
CN103902642B (en) | Utilize the music composition system of the correlation between the lyrics and melody | |
CN107123415B (en) | Automatic song editing method and system | |
US6225546B1 (en) | Method and apparatus for music summarization and creation of audio summaries | |
US20040181401A1 (en) | Method and apparatus for automatically generating a general extraction function calculable on an input signal, e.g. an audio signal to extract therefrom a predetermined global characteristic value of its contents, e.g. a descriptor | |
CN108766407B (en) | Audio connection method and device | |
JPWO2008062816A1 (en) | Automatic composition system | |
CN106375780A (en) | Method and apparatus for generating multimedia file | |
CN108257609A (en) | The modified method of audio content and its intelligent apparatus | |
EP2342708B1 (en) | Method for analyzing a digital music audio signal | |
US20170346573A1 (en) | Communicating data with audible harmonies | |
CN113066456A (en) | Berlin noise-based melody generation method, device, equipment and storage medium | |
CN112420003A (en) | Method and device for generating accompaniment, electronic equipment and computer-readable storage medium | |
JP2017058595A (en) | Automatic arrangement device and program | |
JP2002507009A (en) | Method for automatically controlling an electronic music device by real-time configuration and search of a multi-level data structure | |
Thul | Measuring the complexity of musical rhythm | |
CN113032615A (en) | Meditation music generation method, device, equipment and storage medium | |
CN113096624A (en) | Method, device, equipment and storage medium for automatically creating symphony music | |
CN114461885A (en) | Song quality evaluation method, device and storage medium | |
Wand | On the conception and measure of consonance | |
Prudente et al. | Towards Automated Counter-Melody Generation for Monophonic Melodies | |
JP4319805B2 (en) | Music data impression system and program | |
JPS6380299A (en) | Automatic rearrangement system and apparatus | |
JP6565529B2 (en) | Automatic arrangement device and program |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |