CN113066456B - Method, device, equipment and storage medium for generating melody based on Berlin noise - Google Patents

Method, device, equipment and storage medium for generating melody based on Berlin noise Download PDF

Info

Publication number
CN113066456B
CN113066456B CN202110284981.7A CN202110284981A CN113066456B CN 113066456 B CN113066456 B CN 113066456B CN 202110284981 A CN202110284981 A CN 202110284981A CN 113066456 B CN113066456 B CN 113066456B
Authority
CN
China
Prior art keywords
melody
sequence
pitch
music
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.)
Active
Application number
CN202110284981.7A
Other languages
Chinese (zh)
Other versions
CN113066456A (en
Inventor
蔡梓丰
韩宝强
肖京
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN202110284981.7A priority Critical patent/CN113066456B/en
Publication of CN113066456A publication Critical patent/CN113066456A/en
Application granted granted Critical
Publication of CN113066456B publication Critical patent/CN113066456B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G10MUSICAL INSTRUMENTS; ACOUSTICS
    • G10HELECTROPHONIC 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/00Details of electrophonic musical instruments
    • G10H1/0008Associated control or indicating means
    • G10H1/0025Automatic 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 method, a device, equipment and a storage medium for generating melodies based on Berlin noise, which are used for improving the fitting rate of target music melodies and musical themes and improving the reserve level of a music score database. The berlin noise-based melody generation method comprises the following steps: obtaining music score data and reading the music score data to obtain music score data volume; judging whether the score data is single note sequence data 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 score data is not single note sequence data, generating an initial musical melody based on a pitch sequence, a rhythm sequence and a Berlin noise algorithm; based on the adjustment constraint of the initial music melody, the target music melody is obtained and converted into electronic music score data for storage, and the invention further relates to a blockchain technology, wherein the electronic music score data can be stored in the blockchain.

Description

Method, device, equipment and storage medium for generating melody based on Berlin noise
Technical Field
The present invention relates to the field of audio processing technologies, and in particular, to a method, an apparatus, a device, and a storage medium for generating a melody based on berlin noise.
Background
Buddhism Buddhist, especially Han-pass Buddhist, is an essential element of every temple in Han and Di in every Buddha's event such as daily early and late lessons, important law meeting, etc. Vat is understood as a singing form taking different banners as singing words, musically integrates essence of Chinese traditional national music, and combines Buddhism content to form a complex and huge rule system and strong religious cultural connotation. The research of the characteristics of the music of Buddhist and the generation of the music with relevant styles is a key link for establishing the Buddhism knowledge platform, and is also an important way for popularizing and spreading Buddhism knowledge.
Vat is always a dictation, the number of the remained music scores is small in a digital form, and a database of the system is difficult to form. Aiming at the current situation that the number of the data score is small, the Sanskrit bar music melody is usually automatically generated based on a random algorithm, but the Sanskbar music melody is automatically generated based on the random algorithm, so that the pitch trend in the melody is unnatural and deviates from the theme of the melody.
Disclosure of Invention
According to the method, the device, the equipment and the storage medium for generating the melody based on the Berlin noise, provided by the invention, the pitch trend in the target music melody is natural, the fitting rate of the target music melody and a music theme is improved, and the reserve level of a music score database is improved.
The first aspect of the present invention provides a method for generating a melody based on berlin noise, comprising: obtaining music score data and reading the music score data from the music score data to obtain music score data quantity; judging whether the score data is single note sequence data 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 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; and performing adjustable 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 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, generating the initial musical melody based on a preset berlin noise algorithm includes: if the music score data is single note sequence data, a preset random algorithm is called to process the music score data into a plurality of random numbers, and a first list length and a second list length are generated based on the 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; 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 frequency Berlin noises to obtain fractal noises; an initial musical melody is determined based on the fractal 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 musical melody based on the pitch sequence, the rhythm sequence and the berlin noise algorithm includes: if the score data is not single note sequence data, extracting a pitch sequence and a rhythm sequence from the 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 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 weight pitch fractal noise; and respectively superposing a plurality of weighted pitch fractal noises on the pitch sequence to obtain a pitch melody sequence.
Optionally, in a fourth implementation manner of the first aspect of the present invention, the generating a rhythmic melody sequence based on the rhythmic sequence includes: determining a plurality of target templates from 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, based on a preset expert rule constraint, an adjustment constraint on the initial music melody to obtain a target music melody, and converting the target music melody into electronic score data for storage includes: extracting preset melody adjustment and preset melody adjustment from preset expert rule constraint; calling a preset musical scale function to perform musical scale constraint calculation on the melody mode and the melody mode so as to generate melody musical scale constraint; extracting melody pitch from the initial music melody, and limiting the melody pitch within the melody scale constraint based on a preset adjustment constraint function to obtain a music melody with limited pitch; 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 a melody pitch from the initial music melody, and restricting the melody pitch within the melody scale constraint based on a preset tuning constraint function, where the tuning constraint function in the melody after constraining the pitch is obtained is:
wherein ,for constraining musical melody behind pitch, +.>Is melody pitch +.>Is a melody scale constraint.
A second aspect of the present invention provides a berlin noise-based melody generating apparatus, comprising: the acquisition module is used for acquiring music score data and reading music score data from the music score data to obtain music score data quantity; a judging module for judging whether the score data is single note sequence data based on the score data amount; the initial music melody generation module is used for generating initial music melody based on a preset Berlin noise algorithm if the music score data are single note sequence data; 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 the adjustment constraint module is used for carrying out adjustment 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 musical melody generating module is specifically configured to: if the music score data is single note sequence data, a preset random algorithm is called to process the music score data into a plurality of random numbers, and a first list length and a second list length are generated 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; 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, a first pseudo-random number and a second pseudo-random number; superposing a plurality of frequency Berlin noises to obtain fractal noises; an initial musical melody is determined based on the fractal noise.
Optionally, in a second implementation manner of the second aspect of the present invention, the initial musical melody generating module 303 includes: an extracting unit 3031 for extracting a pitch sequence and a rhythm sequence from the score data if the score data is not single note sequence data; a pitch melody sequence generation 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 used for splicing the pitch melody sequence and the rhythm melody sequence to obtain the 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 weight pitch fractal noise; and respectively superposing a plurality of weighted pitch fractal noises on the pitch sequence to obtain a pitch melody sequence.
Optionally, in a fourth implementation manner of the second aspect of the present invention, the rhythmic melody sequence generating unit is specifically configured to: determining a plurality of target templates from a plurality of preset rhythm templates based on the rhythm sequence; and splicing a plurality of 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 adjustable constraint module is specifically configured to: extracting preset melody adjustment and preset melody adjustment from preset expert rule constraint; calling a preset musical scale function to perform musical scale constraint calculation on the melody tuning and the melody tuning, and generating melody musical scale constraint; extracting melody pitch from the initial music melody, and limiting the melody pitch within melody scale constraint based on a preset adjustable constraint function to obtain the music melody with limited pitch; 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 second aspect of the present invention, the adjustable constraint function is:
wherein ,for constraining musical melody behind pitch, +.>Is melody pitch +.>Is a melody scale constraint.
A third aspect of the present invention provides a berlin noise-based melody generating apparatus comprising: a memory and at least one processor, the memory having instructions stored therein, the memory and the at least one processor being 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 instructions stored therein, which when run on a computer, cause the computer to perform the above-described berlin noise-based melody generation method.
In the technical scheme provided by the invention, music score data are acquired, and the music score data amount is read from the music score data; judging whether the score data is single note sequence data 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 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; and performing adjustable 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 score data for storage. In the embodiment of the invention, the initial music melody of Buddhist is generated based on Berlin noise, expert rule constraint mode is introduced to the initial music melody, the target music melody is generated and converted into the electronic music score data for storage, so that the pitch trend in the target music melody is natural, the fitting rate of the target music melody and a music theme is improved, and the storage level of a music score database is improved by storing the electronic music score data.
Drawings
FIG. 1 is a schematic diagram of an embodiment of a Berlin noise-based melody generating method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of another embodiment of a Berlin noise-based melody generating method according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of an embodiment of a Berlin noise-based melody generating apparatus according to the present invention;
FIG. 4 is a schematic diagram of another embodiment of a Berlin noise-based melody generating apparatus according to an embodiment of the present invention;
fig. 5 is a schematic diagram of an embodiment of a berlin noise-based melody generating apparatus in an embodiment of the present invention.
Detailed Description
The embodiment of the invention provides a method, a device, equipment and a storage medium for generating melodies based on Berlin noise, which are used for generating music melodies by introducing Berlin noise and expert rule constraint, so that the pitch trend in a target music melody is natural, the fitting rate of the target music melody and a music theme is improved, and the reserve level of a music score database is improved.
The terms "first," "second," "third," "fourth" and the like in the description and in the claims and in the above drawings, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments described herein may be implemented in other sequences than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed or inherent to such process, method, article, or apparatus.
For easy understanding, the following describes a specific flow of an embodiment of the present invention, referring to fig. 1, and an embodiment of a berlin noise-based melody generating method in an embodiment of the present invention includes:
101. obtaining music score data and reading the music score data to obtain music score data volume;
the server acquires score data and reads a score data amount of the score data.
Note that, the score data is musical instrument digital interface (musical instrument digital interface, MIDI) format data, and the score data may be electronic score data stored in advance in a database, or MIDI format score data collected in real time by an audio collecting device.
It is to be understood that the execution subject of the present invention may be a berlin noise-based melody generating device, or may be a terminal or a server, which is not limited herein. The embodiment of the invention is described by taking a server as an execution main body as an example.
102. Judging whether the score data is single note sequence data 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 score data amount with the note data amount threshold, determines that the score data is not single note sequence data when the score data amount is greater than the note data amount threshold, and determines that the score data is single note sequence data when the score data amount is less than or equal to the note data amount threshold.
For example, assuming that the threshold value of the note data amount is 2KB, the score data amount of the score data A1 is 2KB, and the server determines that the score data is single note sequence data; if the score data amount of the score data A2 is 10KB, the server determines that the score data is not single note sequence data.
If it is determined that the score data is the current note sequence data, the server performs step 103, otherwise, performs 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;
if the server determines that the score data is single note sequence data, the server calculates the score data based on the Berlin noise algorithm to obtain an initial musical melody.
The berlin noise algorithm is used for randomly generating a content which looks disordered but is actually ordered based on certain parameters, when generating an initial musical melody in the embodiment, a 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 superimposes the smooth noises to obtain a fractal noise, and finally determines the initial musical melody based on the fractal noise.
104. 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 a Berlin noise algorithm;
If the server judges that the music score data is two or more note sequence data, 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 with a Berlin noise algorithm to obtain an initial music melody.
When the score data is two or more note sequence data, the server extracts a pitch sequence and a rhythm sequence from the score data. Regarding the pitch sequence, the server generates a fractal noise based on the berlin noise, and then superimposes the fractal noise of different weights thereto, thereby obtaining a pitch melody. Regarding the rhythm sequence, the server performs random splicing based on a rhythm template preset in advance to obtain rhythm melodies, and finally splices pitch melodies and rhythm melodies to obtain initial music melodies.
It should be noted that the music melody finally generated by the invention is Buddhist Van, so the rhythm melody is stable and has less variation, and the rhythm melody can be generated by randomly splicing the rhythm templates preset in advance.
105. And performing adjustable 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 score data for storage.
The server carries out adjustment 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 musical score data in MIDI format for storage.
It should be noted that, for the Buddhist, the musical melody is usually constructed based on five-tone scales of traditional Chinese, and occasionally is constructed by combining six-tone scales and seven-tone scales, the musical melody is usually mainly in terms of quotient mode and feather mode, and the semitone interval distance or pitch data is used as the expression form of quotient mode or feather mode. For example, the quotient-style is [2 2 3 2 3] and the feather-style is [3 2 2 3 2].
The server performs adjustment constraint on the initial music melody based on the adjustment constraint, the feather adjustment constraint and the 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 MIDI format to store, so that the reserve level of a music score database is improved.
In the embodiment of the invention, the initial music melody of Buddhist is generated based on Berlin noise, expert rule constraint mode is introduced to the initial music melody, the target music melody is generated and converted into the electronic music score data for storage, so that the pitch trend in the target music melody is natural, the fitting rate of the target music melody and a music theme is improved, and the storage level of a music score database is improved by storing the electronic music score data.
Referring to fig. 2, another embodiment of the berlin noise-based melody generating method according to the present invention includes:
201. obtaining music score data and reading the music score data to obtain music score data volume;
the server acquires score data and reads a score data amount of the score data.
Note that, the score data is MIDI format data, and the score data may be electronic score data stored in advance in a database, or MIDI format score data collected in real time by an audio collection device.
202. Judging whether the score data is single note sequence data 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 score data amount with the note data amount threshold, determines that the score data is not single note sequence data when the score data amount is greater than the note data amount threshold, and determines that the score data is single note sequence data when the score data amount is less than or equal to the note data amount threshold.
For example, assuming that the threshold value of the note data amount is 2KB, the score data amount of the score data A1 is 2KB, and the server determines that the score data is single note sequence data; if the score data amount of the score data A2 is 10KB, the server determines that the score data is not single note sequence data.
If it is determined that the score data is the current note sequence data, the server performs step 203, otherwise steps 204-207.
203. If the music score data is single note sequence data, generating an initial music melody based on a preset Berlin noise algorithm;
if the server determines that the score data is single note sequence data, the server calculates the score data based on the Berlin noise algorithm to obtain an initial musical melody.
The berlin noise algorithm is used for randomly generating a content which looks disordered but is actually ordered based on certain parameters, when generating an initial musical melody in the embodiment, a 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 superimposes the smooth noises to obtain a fractal noise, and finally determines the initial musical melody based on the fractal noise.
Specifically, if the music score data is single note sequence data, the server invokes a preset random algorithm to process the music score data into a plurality of random numbers, wherein the value range of each random number is [ -1,1], the 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:
,/>
wherein ,is a first integer>Is a second integer>For a plurality of random numbers->Is frequency; then the server calculates the first integer and the second integer by adopting a preset pseudo-random number algorithm and combining the first list length and the second list length to generate a first pseudo-random number and a second pseudo-random number, wherein the preset pseudo-random algorithm is as follows:
wherein ,is a first pseudo-random number or a second pseudo-random number, +.>Is a first integer or a second integer, +.>Either the first list length or the second list length. Calculating based on a preset Berlin noise algorithm and 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:
wherein ,to alleviate the curve t is +.>,/>Is the frequency. Then, superposing a plurality of pieces of frequency Berlin noise to obtain fractal noise, wherein the specific process is as follows:
wherein ,is fractal noise; and finally determining the initial music melody based on the fractal noise.
204. If the score data is not single note sequence data, extracting a pitch sequence and a rhythm sequence from the score data;
if the server determines that the score data is two or more note sequence data, the server extracts a pitch sequence and a rhythm sequence from the score data.
Note that the score data includes pitch data and rhythm data, so that the server can extract a pitch sequence and a rhythm sequence from the score data.
205. Generating a pitch melody sequence based on the pitch sequence;
the server calculates based on the pitch sequence, and obtains a pitch melody sequence.
Specifically, the server calculates pitch fractal noise based on a Berlin noise algorithm, and then adopts a preset random allocation algorithm to allocate different weights for the pitch fractal noise so as to obtain a plurality of weight pitch fractal noise; then, a plurality of weighted pitch fractal noises are superimposed on the basis of the pitch melody sequence to obtain the pitch melody sequence, and the specific process is as follows:
wherein ,for pitch melody sequence>For pitch sequence, < > for>The noise is fractal for the weighted pitches.
It should be noted that the number of the substrates,for a pitch melody sequence of indefinite length, +.>Is a fixed-length pitch sequence. The method is used for modifying the original pitch sequence, and if only one dominant 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:
wherein t is time.
206. Generating a rhythmic melody sequence based on the rhythmic sequence;
The server generates a rhythmic melody sequence based on the rhythmic sequence.
Since the rhythm of the Buddhist Van is relatively smooth, the server determines four target rhythm templates among the plurality of rhythm templates, the four target rhythm templates being shown in Table 1.
Table 1: multiple rhythm template table
The server adopts a preset rhythm random function to splice a plurality of target templates and generates a rhythm melody sequence.
207. A pitch melody sequence and a rhythm melody sequence are spliced to obtain an initial music melody;
the server concatenates the pitch melody sequence and the rhythm melody sequence into an initial musical 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 according to the splicing mode, all pitch melodies in the pitch melody sequence and all rhythm melodies in the rhythm melody sequence are spliced one by one, so as to obtain the initial music melody.
208. And performing adjustable 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 score data for storage.
The server carries out adjustment 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 musical score data in MIDI format for storage.
It should be noted that, for the Buddhist, the musical melody is usually constructed based on five-tone scales of traditional Chinese, and occasionally is constructed by combining six-tone scales and seven-tone scales, the musical melody is usually mainly in terms of quotient mode and feather mode, and the semitone interval distance or pitch data is used as the expression form of quotient mode or feather mode. For example, the quotient-style is [2 2 3 2 3] and the feather-style is [3 2 2 3 2].
The server performs adjustment constraint on the initial music melody based on the adjustment constraint, the feather adjustment constraint and the 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 MIDI format to store, so that the reserve level of a music score database is improved.
Specifically, the server extracts a preset melody adjustment and a preset melody adjustment from preset expert rule constraints, wherein the preset melody adjustment is a quotient formula [2 2 3 2 3] or a feather adjustment is [3 2 2 3 2], and the preset adjustment (key) is a major C adjustment taking C as a main sound and a minor A adjustment taking A as a main sound; then, the server calls a preset scale function to perform scale constraint calculation on the melody tuning and the melody tonality, and melody scale constraint is generated; the server extracts melody pitch from the initial music melody, and limits the melody pitch within melody scale constraint based on a preset regulation constraint function to obtain the music melody with limited pitch; the server extracts melody rhythm fractal noise from the initial music melody, adds preset pitch constraint to the melody rhythm fractal noise to obtain target music melody, and converts the target music melody into electronic score data to store the electronic score data.
For ease of understanding, the following description is provided in connection with a specific application scenario:
let preset Mode be [3 2 2 3 2 ]]MIDI format value of 57 for tonal key A, server calls preset scale function pair [3 2 2 3 2 ]]And key=a (57) to obtain melody scale constraintThe method comprises the steps of carrying out a first treatment on the surface of the The server extracts melody pitch +.>Then the server limits the melody pitch to the melody scale constraint based on a preset tuning constraint function to obtain a music melody with a constraint pitch, wherein the preset tuning constraint function is that
wherein ,for constraining musical melody behind pitch, +.>Is melody pitch +.>Is a melody scale constraint. In the application scene, the music melody after the constraint of the pitch is obtained as [57, 60, 62, 64, 67, 69, 72, 74, 76, 79, 81] 。
The process is aimed at the constraint of pitch, when the rhythm is constrained, the server firstly extracts the rhythm fractal noise of the melody from the initial music melody, then adds the preset pitch constraint to the rhythm fractal noise of the melody to obtain the target music melody, and converts the target music melody into electronic music score data for storage. The process is expressed in the form of a function as follows:
wherein ,is->A particular pitch of the moment.
In the embodiment of the invention, the initial music melody of Buddhist is generated based on Berlin noise, expert rule constraint mode is introduced to the initial music melody, the target music melody is generated and converted into the electronic music score data for storage, so that the pitch trend in the target music melody is natural, the fitting rate of the target music melody and a music theme is improved, and the storage level of a music score database is improved by storing the electronic music score data.
The method for generating the berlin noise-based melody in the embodiment of the present invention is described above, and the following describes the berlin noise-based melody generating device in the embodiment of the present invention, referring to fig. 3, one embodiment of the berlin noise-based melody generating device in the embodiment of the present invention includes:
an acquisition module 301, configured to acquire score data, and read a score data amount from the score data;
a judging module 302 for judging whether the score data is single note sequence data based on the score data amount;
the initial musical melody generation module 303 is configured to generate an initial musical melody based on a preset berlin noise algorithm if the score data is single note sequence data;
If the score data is not single note sequence data, the method is used for 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 a Berlin noise algorithm;
the tuning constraint module 304 is configured to perform tuning constraint on the initial music melody based on a preset expert rule constraint, obtain a target music melody, and convert the target music melody into electronic score data for storage.
In the embodiment of the invention, the initial music melody of Buddhist is generated based on Berlin noise, expert rule constraint mode is introduced to the initial music melody, the target music melody is generated and converted into the electronic music score data for storage, so that the pitch trend in the target music melody is natural, the fitting rate of the target music melody and a music theme is improved, and the storage level of a music score database is improved by storing the electronic music score data.
Referring to fig. 4, another embodiment of the berlin noise-based melody generating apparatus according to an embodiment of the present invention includes:
an acquisition module 301, configured to acquire score data, and read a score data amount from the score data;
a judging module 302 for judging whether the score data is single note sequence data based on the score data amount;
The initial musical melody generation module 303 is configured to generate an initial musical melody based on a preset berlin noise algorithm if the score data is single note sequence data;
if the score data is not single note sequence data, the method is used for 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 a Berlin noise algorithm;
the tuning constraint module 304 is configured to perform tuning constraint on the initial music melody based on a preset expert rule constraint, obtain a target music melody, and convert the target music melody into electronic score data for storage.
Optionally, the initial musical melody generating module 303 may be further specifically configured to:
if the music score data is single note sequence data, a preset random algorithm is called to process the music score data into a plurality of random numbers, and a first list length and a second list length are generated 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;
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, a first pseudo-random number and a second pseudo-random number;
superposing a plurality of frequency Berlin noises to obtain fractal noises;
an initial musical melody is determined based on the fractal noise.
Optionally, the initial musical melody generating module 303 includes:
an extracting unit 3031 for extracting a pitch sequence and a rhythm sequence from the score data if the score data is not single note sequence data;
a pitch melody sequence generation 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 used for splicing the pitch melody sequence and the rhythm melody sequence to obtain the 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 weight pitch fractal noise;
and respectively superposing a plurality of weighted pitch fractal noises on the pitch sequence to obtain a pitch melody sequence.
Optionally, the rhythmic melody sequence generating unit 3033 may further specifically be configured to:
determining a plurality of target templates from a plurality of preset rhythm templates based on the rhythm sequence;
and splicing a plurality of target templates by adopting a preset rhythm random function to generate a rhythm melody sequence.
Optionally, the adjustable constraint module 304 may be further specifically configured to:
extracting preset melody adjustment and preset melody adjustment from preset expert rule constraint;
calling a preset musical scale function to perform musical scale constraint calculation on the melody tuning and the melody tuning, and generating melody musical scale constraint;
extracting melody pitch from the initial music melody, and limiting the melody pitch within melody scale constraint based on a preset adjustable constraint function to obtain the music melody with limited pitch;
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, the adjustable constraint function is:
wherein ,for constraining musical melody behind pitch, +.>Is melody pitch +.>Is a melody scale constraint.
In the embodiment of the invention, the initial music melody of Buddhist is generated based on Berlin noise, expert rule constraint mode is introduced to the initial music melody, the target music melody is generated and converted into the electronic music score data for storage, so that the pitch trend in the target music melody is natural, the fitting rate of the target music melody and a music theme is improved, and the storage level of a music score database is improved by storing the electronic music score data.
The berlin noise-based melody generating apparatus of the embodiment of the present invention is described in detail above in fig. 3 and 4 from the point of view of the modularized functional entity, and the berlin noise-based melody generating device of the embodiment of the present invention is described in detail below from the point of view of the hardware processing.
Fig. 5 is a schematic structural diagram of a berlin noise-based melody generating apparatus according to an embodiment of the present invention, where the berlin noise-based melody generating apparatus 500 may have relatively large differences according to configuration or performance, and may include one or more processors (central processing units, CPU) 510 (e.g., one or more processors) and a memory 520, and one or more storage media 530 (e.g., one or more mass storage devices) storing applications 533 or data 532. Wherein memory 520 and storage medium 530 may be transitory 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 on the berlin noise-based melody generating apparatus 500. Still further, the processor 510 may be arranged to communicate with the storage medium 530, executing 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 can 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 service, mac OS X, unix, linux, freeBSD, and the like. It will be appreciated by those skilled in the art that the berlin noise-based melody generating device structure shown in fig. 5 does not constitute a limitation of the berlin noise-based melody generating device, and may include more or less components than illustrated, or may combine certain components, or may be 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 from the use of blockchain nodes, and the like.
The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium, and may also be a volatile computer-readable storage medium, having stored therein instructions that, when executed on a computer, cause the computer to perform the steps of the berlin noise-based melody generation method.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, which are not repeated herein.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied essentially or in part or all of the technical solution or in part in the form of a software product stored in a storage medium, including instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a read-only memory (ROM), a random access memory (random access memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and the like. The Blockchain (Blockchain), which is essentially a decentralised database, is a string of data blocks that are generated by cryptographic means in association, each data block containing a batch of information of network transactions for verifying the validity of the information (anti-counterfeiting) and generating the next block. The blockchain may include a blockchain underlying platform, a platform product services layer, an application services layer, and the like.
The above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (9)

1. A method for generating a berlin noise-based melody, the method comprising:
Obtaining music score data and reading the music score data from the music score data to obtain music score data quantity;
judging whether the score data is single note sequence data 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 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;
performing adjustable 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 score data for storage;
if the score data is single note sequence data, generating the initial musical melody based on a preset berlin noise algorithm includes:
if the music score data is single note sequence data, a preset random algorithm is called to process the music score data into a plurality of random numbers, and a first list length and a second list length are generated based on the 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;
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 frequency Berlin noises to obtain fractal noises;
determining an initial musical melody based on the fractal noise;
the extracting a pitch sequence and a rhythm sequence from the score data if the score data is not single note sequence data, and generating an initial musical melody based on the pitch sequence, the rhythm sequence, and the berlin noise algorithm includes:
if the score data is not single note sequence data, extracting a pitch sequence and a rhythm sequence from the score data;
generating a pitch melody sequence based on the pitch sequence;
generating a rhythm melody sequence based on the rhythm sequence;
splicing the pitch melody sequence and the rhythm melody sequence to obtain an initial music melody;
The generating a pitch melody sequence based on the pitch sequence includes:
calculating the pitch sequence based on the Berlin noise algorithm to obtain 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 weight pitch fractal noise;
and respectively superposing a plurality of weighted pitch fractal noises on the pitch sequence to obtain a pitch melody sequence.
2. The method of generating a berlin noise-based melody of claim 1, wherein the generating a rhythmic melody sequence based on the rhythmic sequence includes:
determining a plurality of target templates from 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.
3. The method of claim 1 or claim 2, wherein the performing an adjustment constraint on the initial musical melody based on a preset expert rule constraint to obtain a target musical melody, and converting the target musical melody into electronic score data for storage comprises:
extracting preset melody adjustment and preset melody adjustment from preset expert rule constraint;
Calling a preset musical scale function to perform musical scale constraint calculation on the melody mode and the melody mode so as to generate melody musical scale constraint;
extracting melody pitch from the initial music melody, and limiting the melody pitch within the melody scale constraint based on a preset adjustment constraint function to obtain a music melody with limited pitch;
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.
4. The method of claim 3, wherein the extracting melody pitch from the initial melody and restricting the melody pitch within the melody scale constraint based on a preset pitch restriction function, the pitch restriction function in the melody after pitch restriction is:
wherein ,for constraining musical melody behind pitch, +.>Is melody pitch +.>Is a melody scale constraint.
5. A berlin noise-based melody generating apparatus, comprising:
The acquisition module is used for acquiring music score data and reading music score data from the music score data to obtain music score data quantity;
a judging module for judging whether the score data is single note sequence data based on the score data amount;
the initial music melody generation module is used for generating initial music melody based on a preset Berlin noise algorithm if the music score data are single note sequence data;
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;
the adjustment constraint module is used for carrying out adjustment 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 initial music melody generation module is specifically configured to:
if the music score data is single note sequence data, a preset random algorithm is called to process the music score data into a plurality of random numbers, and a first list length and a second list length are generated 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; 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, a first pseudo-random number and a second pseudo-random number; superposing a plurality of frequency Berlin noises to obtain fractal noises; determining an initial musical melody based on the fractal noise;
The initial music melody generation module includes:
an extracting unit for extracting a pitch sequence and a rhythm sequence from the score data if the score data is not single note sequence data;
a pitch melody sequence generation unit for generating a pitch melody sequence based on the pitch sequence;
a rhythm melody sequence generating unit for generating a rhythm melody sequence based on the rhythm sequence;
the splicing unit is used for splicing the pitch melody sequence and the rhythm melody sequence to obtain an initial music melody;
the pitch melody sequence generation 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 weight pitch fractal noise; and respectively superposing a plurality of weighted pitch fractal noises on the pitch sequence to obtain a pitch melody sequence.
6. The berlin noise-based melody generating device of claim 5, wherein the rhythmic melody sequence generating unit is specifically configured to:
determining a plurality of target templates from 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.
7. The berlin noise-based melody generating device of claim 5 or claim 6, wherein the pitch constraint module is specifically configured to:
extracting preset melody adjustment and preset melody adjustment from preset expert rule constraint;
calling a preset musical scale function to perform musical scale constraint calculation on the melody mode and the melody mode so as to generate melody musical scale constraint;
extracting melody pitch from the initial music melody, and limiting the melody pitch within the melody scale constraint based on a preset adjustment constraint function to obtain a music melody with limited pitch;
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.
8. A berlin noise-based melody generation device, the berlin noise-based melody generation device comprising: a memory and at least one processor, the memory having instructions stored therein, the memory and the at least one processor being 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 one of claims 1-4.
9. A computer-readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the berlin noise-based melody generation method according to any one of claims 1-4.
CN202110284981.7A 2021-03-17 2021-03-17 Method, device, equipment and storage medium for generating melody based on Berlin noise Active CN113066456B (en)

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 CN113066456A (en) 2021-07-02
CN113066456B true 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)

* Cited by examiner, † Cited by third party
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

Patent Citations (4)

* Cited by examiner, † Cited by third party
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)

* Cited by examiner, † Cited by third party
Title
詹雯 . 基于规则和概率模型的智能作曲研究.中国优秀硕士学位论文全文数据库信息科技辑.2019,I140-654. *

Also Published As

Publication number Publication date
CN113066456A (en) 2021-07-02

Similar Documents

Publication Publication Date Title
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
Le Brun Digital waveshaping synthesis
WO2020015153A1 (en) Method and device for generating music for lyrics text, and computer-readable storage medium
US6225546B1 (en) Method and apparatus for music summarization and creation of audio summaries
CN109346045B (en) Multi-vocal part music generation method and device based on long-short time neural network
Serra et al. Sound transformations based on the sms high level attributes
JPWO2008062816A1 (en) Automatic composition system
CN106375780A (en) Method and apparatus for generating multimedia file
JP4333700B2 (en) Chord estimation apparatus and method
CN105825872A (en) Song difficulty determining method and device
CN110010159A (en) Sound similarity determines method and device
CN113066456B (en) Method, device, equipment and storage medium for generating melody based on Berlin noise
CN106919583B (en) Audio file pushing method and device
Kızrak et al. Classification of classic Turkish music makams
WO2016209510A1 (en) Communicating data with audible harmonies
CN106970950B (en) Similar audio data searching method and device
CN112967734B (en) Music data identification method, device, equipment and storage medium based on multiple sound parts
JPH06337690A (en) Singing voice synthesizing device
CN113066512B (en) Buddhism music identification method, device, equipment and storage medium
CN115331682A (en) Method and apparatus for correcting pitch of audio
CN112906402B (en) Music response data generation method, device, equipment and storage medium
CN113270081B (en) Method for adjusting song accompaniment and electronic device for adjusting song accompaniment
CN113066457B (en) Fan-exclamation music generation method, device, equipment and storage medium
Tolonen Object-based sound source modeling for musical signals

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