CN111477198B - Method and device for representing music bar and electronic equipment - Google Patents
Method and device for representing music bar and electronic equipment Download PDFInfo
- Publication number
- CN111477198B CN111477198B CN202010151122.6A CN202010151122A CN111477198B CN 111477198 B CN111477198 B CN 111477198B CN 202010151122 A CN202010151122 A CN 202010151122A CN 111477198 B CN111477198 B CN 111477198B
- Authority
- CN
- China
- Prior art keywords
- music
- section
- representation vector
- sections
- vector
- 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
Links
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
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/60—Information retrieval; Database structures therefor; File system structures therefor of audio data
- G06F16/68—Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually
- G06F16/683—Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually using metadata automatically derived from the content
-
- 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
- G10H2210/00—Aspects or methods of musical processing having intrinsic musical character, i.e. involving musical theory or musical parameters or relying on musical knowledge, as applied in electrophonic musical tools or instruments
- G10H2210/101—Music Composition or musical creation; Tools or processes therefor
- G10H2210/111—Automatic composing, i.e. using predefined musical rules
-
- 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
- G10H2240/00—Data organisation or data communication aspects, specifically adapted for electrophonic musical tools or instruments
- G10H2240/121—Musical libraries, i.e. musical databases indexed by musical parameters, wavetables, indexing schemes using musical parameters, musical rule bases or knowledge bases, e.g. for automatic composing methods
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Multimedia (AREA)
- Library & Information Science (AREA)
- Acoustics & Sound (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Auxiliary Devices For Music (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The specification discloses a method, a device and an electronic device for representing a music section, wherein the method comprises the following steps: obtaining a music section contained in a tune library; establishing a representation vector for each of the musical sections; obtaining a context music section of each music section according to the tunes in the tune library, wherein the context music section is a music section within a preset distance from the music section in the tunes; for each music section, calculating a loss function score according to the representation vector of the music section and the representation vector of the context music section, and updating the representation vector of the music section based on the score, so that the similarity between the representation vector of the music section and the representation vector of the context music section is continuously increased, and the similarity between the representation vector of the music section and the negative sample vector is continuously reduced, thereby realizing semantic vectorization representation of each music section.
Description
Technical Field
The present disclosure relates to the field of software technologies, and in particular, to a method and an apparatus for representing a music section, and an electronic device.
Background
Most music tunes are currently created artificially, but today automatic composing by artificial intelligence (Artificial Intelligence, AI) is already possible. Conventional AI automatic composition is usually based on the speech signal itself, and then new tunes are analyzed and automatically generated by speech technology, so that there is a gap between the generated new tunes and artificial creation, and most of the AI automatic composition can only be used for inspiring musicians or folk creators. For automatic composition of AI, a new method is needed to increase the way of automatic composition of AI.
Disclosure of Invention
The embodiment of the specification provides a method, a device and electronic equipment for representing a music section, which are used for realizing semantic vectorization representation of the music section so as to automatically make AI by using the representation vector of the music section and increase the automatic AI making mode.
In a first aspect, embodiments of the present disclosure provide a method for representing a music section, the method including:
obtaining a music section contained in a tune library;
establishing a representation vector for each of the musical sections;
obtaining a context music section of each music section according to the tunes in the tune library, wherein the context music section is a music section within a preset distance from the music section in the tunes;
for each music section, acquiring a negative sample vector, wherein the music section corresponding to the negative sample vector is a music section except for a context music section of the music section; and calculating a loss function score according to the representation vector of the music bar, the representation vector of the context music bar and the negative sample vector, and updating the representation vector of the music bar based on the score, wherein the similarity between the updated representation vector of the music bar and the representation vector of the context music bar is increased, and the similarity between the updated representation vector of the music bar and the negative sample vector is reduced.
Optionally, the obtaining, according to the tunes in the tune library, a contextual music measure of the music measure for each music measure includes:
sequentially scanning each music section of each tune in the tune library, and aiming at the current scanned current music section, acquiring all current context music sections within the preset distance from the current music section;
the calculating, for each musical section, a loss function score from the representation vector of the musical section and the representation vector of the contextual musical section, and updating the representation vector of the musical section based on the score, comprising:
for a current music measure, respectively calculating a loss function score according to the representation vector of the current music measure and the representation vector of each current context music measure, and respectively updating the representation vector of the current music measure based on each score.
Optionally, the obtaining the music section contained in the tune library includes:
scanning each tune in the tune library to obtain all the appeared music sections and establishing a music section table;
obtaining the occurrence times of all the music sections, and deleting the music sections with the occurrence times smaller than a preset threshold from the music section table;
establishing a representation vector for each of the musical sections, comprising:
a representation vector is established for each of the musical sections in the table of musical sections.
Optionally, before obtaining the music sections contained in the tune library, the method further includes:
and converting all the tunes in the tune library into numbered musical notation tunes to obtain music sections in the numbered musical notation tunes.
In a second aspect, embodiments of the present disclosure provide a device for representing a musical section, the device comprising:
the acquisition unit is used for acquiring the music sections contained in the tune library;
a setting unit configured to establish a representation vector for each of the music sections;
the scanning unit is used for obtaining a context music section of each music section according to the tunes in the tune library, wherein the context music section is a music section within a preset distance from the music section in the tunes;
an updating unit, configured to obtain, for each music measure, a negative sample vector, where a music measure corresponding to the negative sample vector is a music measure other than a context music measure of the music measure; and calculating a loss function score according to the representation vector of the music bar, the representation vector of the context music bar and the negative sample vector, and updating the representation vector of the music bar based on the score, wherein the similarity between the updated representation vector of the music bar and the representation vector of the context music bar is increased, and the similarity between the updated representation vector of the music bar and the negative sample vector is reduced.
Optionally, the scanning unit is configured to: sequentially scanning each music section of each tune in the tune library, and aiming at the current scanned current music section, acquiring all current context music sections within the preset distance from the current music section;
the updating unit is used for: for a current music measure, respectively calculating a loss function score according to the representation vector of the current music measure and the representation vector of each current context music measure, and respectively updating the representation vector of the current music measure based on each score.
Optionally, the acquiring unit is configured to:
scanning each tune in the tune library to obtain all the appeared music sections and establishing a music section table;
obtaining the occurrence times of all the music sections, and deleting the music sections with the occurrence times smaller than a preset threshold from the music section table;
establishing a representation vector for each of the musical sections, comprising:
a representation vector is established for each of the musical sections in the table of musical sections.
Optionally, the apparatus further includes:
the conversion unit is used for converting all the tunes in the tune library into numbered musical notation tunes before the music sections contained in the tune library are acquired, so as to obtain the music sections in the numbered musical notation tunes.
The above-mentioned one or more technical solutions in the embodiments of the present disclosure at least have the following technical effects:
the embodiment of the specification provides a method for representing a music section, which is used for obtaining the music section contained in a tune library; establishing a representation vector for each musical section; according to the tunes in the tune library, for each music section, a context music section of the music section is obtained, a loss function score is calculated according to the representation vector of the music section, the representation vector of the context music section and the negative sample vector of the music section, and the representation vector of the music section is updated based on the score, so that the similarity between the updated representation vector of the music section and the representation vector of the context music section is increased, and the similarity between the updated representation vector of the music section and the negative sample vector is reduced. The representation vector of the music bar is updated through the representation vector of the context music bar, so that the representation vector of the music bar is related to the representation vector of the context music bar and is similar as much as possible, semantic vectorization representation of the music bar is realized, and the accuracy of the representation of the music bar is improved. Through the vector representation of the music bars, the AI automatic composing can be performed based on the representation vector of the music bars, so that the AI automatic composing mode is increased, the processing process of analyzing the voice signals is reduced, and the AI automatic composing efficiency is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present description, the following description will briefly explain the embodiments or the drawings used in the description of the prior art, and it is obvious that the drawings in the following description are some embodiments of the present description, and other drawings may be obtained according to these drawings without inventive effort to a person skilled in the art.
FIG. 1 is a flowchart of a method for representing a music section according to an embodiment of the present disclosure;
FIG. 2 is a schematic diagram of numbered musical notation conversion provided in an embodiment of the present disclosure;
FIG. 3 is a schematic diagram of a vector update method according to an embodiment of the present disclosure;
FIG. 4 is a schematic diagram of a device for representing a music section according to an embodiment of the present disclosure;
fig. 5 is a schematic diagram of an electronic device according to an embodiment of the present disclosure.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the embodiments of the present specification more clear, the technical solutions of the embodiments of the present specification will be clearly and completely described below with reference to the drawings in the embodiments of the present specification, and it is apparent that the described embodiments are some embodiments of the present specification, but not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are intended to be within the scope of the present disclosure.
The embodiment of the specification provides a method, a device and electronic equipment for representing a music section, which are used for realizing semantic vectorization representation of the music section, improving the accuracy of the representation of the music section, enabling the automatic AI composition to be realized based on the representation vector of the music section and increasing the automatic AI composition mode.
The main implementation principle, the specific implementation manner and the corresponding beneficial effects of the technical solution of the embodiments of the present specification are described in detail below with reference to the accompanying drawings.
Examples
Referring to fig. 1, the present embodiment provides a method for representing a music section, including steps S11 to S17 as follows:
s11, obtaining music sections contained in a tune library.
Wherein a large number of existing tunes are collected in the tune library. Each tune is made up of a plurality of music bars. The bar of music is a unit of beat, and the strong beats and the weak beats always appear in a regular cycle in the process of music, and the part from one strong beat to the next strong beat is called a bar. Before the strong beat, the vertical lines used for dividing the beat units are called bar lines, i.e. the two bars are separated by a "bar line". For example, for the tune "|1155|665- |4433|221- |5544|332- |1155|665- |4433|221- |221- |," |1155|, "|665- |", |4433|, and the like are each one musical section.
S13, establishing a representation vector for each music section.
Wherein the representation vector is used for vectorizing the representation and semantic representation of the music measure. By creating a representation vector for each music section, the creation of a representation vector for a music section and its contextual music section is achieved, the representation vector for a contextual music section also being referred to as contextual music section vector for the corresponding music section. A tune consists of a succession of pieces of music, each piece of music having two semantics in the tune: one representing the music measure itself and another representing a context music measure adjacent or near to it, such as: for the first "|665- |6|4433|221- |5544|332- |1155|665- |4433|221- |" in the tune "|665- |not only the semantics of which include" |665- | "but also contextual music sections which are" |1155| "and" |4433| ". The dimension of the representation vector of each music section in the tune library is the same, and the representation vector can be randomly generated during construction, and is updated through follow-up steps.
S15, obtaining context music sections of the music sections according to the tunes in the tune library aiming at each music section.
The context music bars of the music bars are music bars within a preset distance from the music bars in the same tune, namely, the distance between the context music bars and the corresponding music bars is smaller than or equal to the preset distance. The distance between the music bars is the distance of movement in the tune required to move from the location of one music bar to the location of another music bar, which may be in units of music bars. For example: for the tune "|1155|665- |4433|221- |5544|332- |1155|665- |4433|221- |", the distance between the first "|1155|" and the first "|4433|" is 2 music sections, assuming that the preset distance is 1 music section, for the music sections "|221- |" in the above-mentioned tune, its contextual music sections are "|4433|" and "|5544|". The music bars in different tunes may differ in their context and the music bars in different locations in the same tune may differ in their context.
S17, calculating a loss function score according to the representation vector of the music section and the representation vector of the context music section for each music section, and updating the representation vector of the music section based on the score.
The similarity between the representative vector of the music bar updated based on the loss function score and the representative vector of the context music bar is increased, the similarity between the representative vector of the context music bar and the representative vector of the negative example vector is reduced, and the representative vector of the music bar is more and more similar to the representative vector of the context music bar and is more and more dissimilar to the representative vector of the negative example vector after the representative vector of the music bar is updated based on a large number of representative vectors of the context music bar.
In this embodiment, a prediction model, such as word2vec, may be used to input a representation vector of a context music measure into the prediction model, predict a representation vector of a music measure by a prediction function of the prediction model, calculate a loss function score according to the representation vector of the context music measure and an actual representation vector of the music measure, and reflect a difference between the representation vector of the predicted music measure and the actual representation vector, where the smaller the loss function score is, the smaller the difference is, and the larger the loss function score is, the larger the difference is. And judging whether the loss function score meets the convergence condition according to the loss function score, if not, calculating the gradient of the loss function, and updating the model parameters of the prediction model, namely the vector parameters of the prediction expression vector according to the gradient, so as to update the expression vector of the music measure according to the vector parameters. And for each music section, carrying out loss function calculation through all contextual music sections of the music section, and updating the representation vector of the music section, so that the representation vector of the music section can represent the semantic meaning of the music section in a tune library, thereby realizing the semantic vectorization representation of the music section and improving the accuracy of the representation of the music section.
In the embodiment, the music sections are used as basic units of the tune, each continuous music section forms a complete tune, and the tune can be studied based on semantic vectorization representation of the music sections, so that automatic AI composing is performed. Converting tunes in a tune library into a vector sequence according to the updated representation vector of the music section; and constructing a training sample according to the vector sequence of the tune, training an automatic composing model, and automatically composing the music through the trained automatic composing model. For example: after part of the music sections in the melody are removed, the representing vectors of the remaining music sections are used as input, the representing vectors of the removed music sections are used as labels to construct training samples of an automatic composition model, the automatic composition model is obtained through training of a large number of training samples, and aiming at the trained model, the representing vectors of the music sections are input, the automatic composition model can output predicted follow-up melodies, automatic composition of AI is achieved, and composition efficiency can be effectively improved.
In the implementation process, before executing S11, all tunes in the tune library may be converted into numbered musical notation tunes, and each numbered musical notation tune in the tune library after the conversion is scanned, so as to improve scanning efficiency. The numbered musical notation refers to a simple notation method and comprises two types of letter numbered musical notation and digital numbered musical notation. The numbered musical notation is generally called as a numbered musical notation. The digital numbered musical notation is based on the movable singing name method, and 7 basic levels in musical scales are represented by '1', '2', '3', '4', '5', '6', '7', and the pronunciation is 'do','re', 'mi', 'fa', 'sol', 'la', 'ti' (si in China). The music sections can be scanned and identified by converting all the tunes into numbered musical notation. For example: as shown in fig. 2, the music score of "a flash and a flash crystal" includes a staff, a numbered musical notation and lyrics, and in the process of semantic vectorization representation of a music bar, the music score can be converted into the numbered musical notation, so that the simplified writing is as follows: the bar 1155|665- |4433|221- |5544- |332- |1155|665- |4433|221- |, the vertical line is the bar, the number represents the note, and the "-" represents the previous note for multiple beats.
S11, each tune in a tune library can be scanned, all the occurring music sections are obtained, and a music section table is built; obtaining the occurrence times of all the music sections, and deleting the music sections with the occurrence times smaller than a preset threshold from the music section table; s13 builds a music measure vector and a contextual music measure vector for each music measure in the music measure table. The preset threshold is a preset super parameter, and can be set according to actual requirements. The music bars with the occurrence number smaller than the preset threshold value have fewer reference samples due to the fact that the occurrence number is smaller, and even if vector learning is carried out on the music bars, the finally obtained vector is inaccurate, and therefore the music bars are deleted.
S15 and S17 are performed after S13, and the specific embodiment may adopt any of the following modes:
mode one, S15, obtains all contextual music measures for each music measure, including all contextual music measures in different locations of the same tune and different tunes, and then performs S17 calculation of a penalty function score and updating of the representation vectors of the music measure and contextual music measure for each music measure and each contextual music measure corresponding thereto, respectively. The method comprises the steps of firstly completing scanning of each music section and the context music section in the tune library, and then carrying out loss function calculation and expression vector update.
S15, scanning each music section of each tune in the tune library in turn, and aiming at the current scanned current music section, acquiring all current context music sections within a preset distance from the current music section; the jump is then performed S17 to calculate a loss function score for the current music measure from the representation vector of the current music measure and the representation vector of each current context music measure, respectively, and to update the representation vector of each current music measure and the context music, respectively, based on each score. The mode S15 and S17 is circularly executed until the last music section of the last tune in the tune library is scanned and the updating of the representation vector is completed, and the mode is high in efficiency and low in calculation amount.
Please refer to fig. 3, which is a schematic diagram of a vector update method based on the second embodiment, comprising the following steps:
1) And establishing a music section table.
The music bars in the music bar table are music bars with the occurrence times larger than a set threshold value in the tune library.
2) Initializing a representation vector of the music measure.
A random vector of the same dimension is established for each music section in the list of music sections. The representation vector of the music measure may be simply referred to as a music measure vector, and the representation vector of the context music measure may be simply referred to as a context music measure vector.
3) Scanning tunes, sequentially selecting current music sections w, and judging whether w traverses all music sections of all tunes. If w traverses all the music sections of all the tunes, ending; otherwise, jumping to step 4).
Wherein each music section in each tune is scanned one by one when the tunes are scanned, and one currently scanned music section is selected as a current music section w each time.
4) Scanning the context music subsections, selecting one context music subsection at a time as c, and judging whether c traverses all the context music subsections of w. If c does not traverse all the contextual music segments of w, jumping to step 5), otherwise jumping to step 3).
When the context music section is scanned, a sliding window distance b (sliding window respectively leftwards and rightwards) can be set for the current music section w, the music section in the sliding window is the context music section c of the current music section w, and the sliding window distance is smaller than or equal to a preset distance.
5) Calculating a loss function score, updating the representation vector of the music measure according to the score, and returning to the step 4).
When the loss function score is calculated, a negative sample vector of each music section can be obtained, wherein the music section corresponding to the negative sample vector is a music section except for the context music section of the music section; a penalty function score is calculated from the music measure vector, the music measure vector of the contextual music measure, and the negative sample vector for each music measure. When the loss function score is calculated, the more similar the expression vector of the context music measure is to the expression vector of the music measure, the lower the loss function score is, and conversely, the higher the loss function score is; the more similar the representation vector of the contextual music measures is to the negative sample vector, the higher the loss function score, and vice versa. Wherein the loss function score may be calculated by the following formula:
wherein, l represents a loss function,representation of a music section wVector (S)>A representation vector representing a contextual music measure c, λ representing a pre-set hyper-parameter, σ representing an excitation function of the neural network, +.>Representing a negative sample vector, the music bar c 'corresponding to the negative sample vector being a negative sample contextual music bar of the current music bar w, c' may be a randomly selected music bar.
With respect to the method for representing a music section provided in the foregoing embodiment, based on the same inventive concept, this embodiment also correspondingly provides a device for representing a music section, please refer to fig. 4, which includes:
in a second aspect, embodiments of the present disclosure provide a device for representing a musical section, the device comprising:
an obtaining unit 41, configured to obtain a music section included in a tune library;
a setting unit 42 for establishing a representation vector for each of the music sections;
a scanning unit 43, configured to obtain, for each music section, a context music section of the music section according to the tunes in the tune library, where the context music section is a music section within a preset distance from the music section in the tunes;
an updating unit 44, configured to obtain, for each music measure, a negative sample vector of the music measure, where the music measure corresponding to the negative sample vector is a music measure other than a context music measure of the music measure; and calculating a loss function score according to the representation vector of the music bar, the representation vector of the context music bar and the negative sample vector, updating the representation vector of the music bar based on the score, wherein the similarity between the updated representation vector of the music bar and the representation vector of the context music bar is increased, and the similarity between the updated representation vector of the music bar and the negative sample vector is reduced.
As an alternative embodiment, the scanning unit 43 is configured to: sequentially scanning each music section of each tune in the tune library, and aiming at the current scanned current music section, acquiring all current context music sections within the preset distance from the current music section;
the updating unit 44 is configured to: for a current music measure, calculating a loss function score according to the representation vector of the current music measure and the representation vector of each current context music measure, and updating the representation vector of the current music measure and the representation vector of the current context music measure based on each score.
As an alternative embodiment, the obtaining unit 41 is configured to: scanning each tune in the tune library to obtain all the appeared music sections and establishing a music section table; obtaining the occurrence times of all the music sections, and deleting the music sections with the occurrence times smaller than a preset threshold from the music section table;
the setting unit 42 is configured to: a representation vector is established for each of the musical sections in the table of musical sections.
As an alternative embodiment, the apparatus further comprises: and a conversion unit 45, configured to convert all tunes in the tune library into numbered musical tunes before obtaining the musical sections included in the tune library, so as to obtain the musical sections in the numbered musical tunes.
The specific manner in which the individual units perform the operations in relation to the apparatus of the above embodiments has been described in detail in relation to the embodiments of the method and will not be explained in detail here.
Referring to fig. 5, a block diagram of an electronic device 700 for implementing a data query method is shown, according to an exemplary embodiment. For example, the electronic device 700 may be a computer, a database console, a tablet device, a personal digital assistant, or the like.
Referring to fig. 5, an electronic device 700 may include one or more of the following components: a processing component 702, a memory 704, a power supply component 706, a multimedia component 708, an input/output (I/O) interface 710, and a communication component 712.
The processing component 702 generally controls overall operation of the electronic device 700, such as operations associated with display, data communication, and recording operations. The processing element 702 may include one or more processors 720 to execute instructions to perform all or part of the steps of the methods described above. Further, the processing component 702 can include one or more modules that facilitate interaction between the processing component 702 and other components.
The power supply component 706 provides power to the various components of the electronic device 700. Power supply components 706 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for electronic device 700.
The I/O interface 710 provides an interface between the processing component 702 and peripheral interface modules, which may be a keyboard, click wheel, buttons, etc. These buttons may include, but are not limited to: homepage button, volume button, start button, and lock button.
The communication component 712 is configured to facilitate communication between the electronic device 700 and other devices, either wired or wireless. The electronic device 700 may access a wireless network based on a communication standard, such as WiFi,2G, or 3G, or a combination thereof. In one exemplary embodiment, the communication part 712 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 712 further includes a Near Field Communication (NFC) module to facilitate short range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, ultra Wideband (UWB) technology, bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the electronic device 700 may be implemented by one or more Application Specific Integrated Circuits (ASICs), digital Signal Processors (DSPs), digital Signal Processing Devices (DSPDs), programmable Logic Devices (PLDs), field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic elements for executing the methods described above.
In an exemplary embodiment, a non-transitory computer readable storage medium is also provided, such as memory 704, including instructions executable by processor 720 of electronic device 700 to perform the above-described method. For example, the non-transitory computer readable storage medium may be ROM, random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
A non-transitory computer readable storage medium, which when executed by a processor of a mobile terminal, causes an electronic device to perform a method of representing a musical section, the method comprising:
obtaining a music section contained in a tune library; establishing a representation vector for each music section, wherein the representation vector comprises a music section vector and a context music section vector; obtaining a context music section of each music section, wherein the distance of the context music sections with small pitches in the same tune is smaller than a preset distance; and calculating a loss function score according to the music bar vector of each music bar and the context music bar vector of the context music bar, and updating the music bar vector of each music bar and the context music bar vector of the context music bar based on the score.
It is to be understood that the present embodiment is not limited to the precise construction that has been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present embodiments is limited only by the appended claims
The foregoing description is illustrative of the present invention and is not to be construed as limiting the invention, but rather is to be construed as limiting the scope of the invention.
Claims (10)
1. A method of representing a musical section, the method comprising:
obtaining a music section contained in a tune library;
establishing a representation vector for each of the musical sections;
obtaining a context music section of each music section according to the tunes in the tune library, wherein the context music section is a music section within a preset distance from the music section in the tunes;
for each music section, acquiring a negative sample vector of the music section, wherein the music section corresponding to the negative sample vector is a music section except for a context music section of the music section; and calculating a loss function score according to the representation vector of the music bar, the representation vector of the context music bar and the negative sample vector, updating the representation vector of the music bar based on the score, wherein the similarity between the updated representation vector of the music bar and the representation vector of the context music bar is increased, and the similarity between the updated representation vector of the music bar and the negative sample vector is reduced.
2. The method of claim 1, the obtaining contextual music bars of the music bars for each of the music bars from tunes in the library of tunes, comprising:
sequentially scanning each music section of each tune in the tune library, and aiming at the current scanned current music section, acquiring all current context music sections within the preset distance from the current music section;
the calculating, for each musical section, a loss function score from the representation vector of the musical section and the representation vector of the contextual musical section, and updating the representation vector of the musical section based on the score, comprising:
for a current music measure, respectively calculating a loss function score according to the representation vector of the current music measure and the representation vector of each current context music measure, and respectively updating the representation vector of the current music measure based on each score.
3. The method of claim 1, wherein the obtaining the music sections contained in the tune library comprises:
scanning each tune in the tune library to obtain all the appeared music sections and establishing a music section table;
obtaining the occurrence times of all the music sections, and deleting the music sections with the occurrence times smaller than a preset threshold from the music section table;
establishing a representation vector for each of the musical sections, comprising:
a representation vector is established for each of the musical sections in the table of musical sections.
4. A method according to any one of claims 1 to 3, the method further comprising, prior to obtaining the music sections contained in the library of tunes:
and converting all the tunes in the tune library into numbered musical notation tunes to obtain music sections in the numbered musical notation tunes.
5. A representation apparatus of a musical section, the apparatus comprising:
the acquisition unit is used for acquiring the music sections contained in the tune library;
a setting unit configured to establish a representation vector for each of the music sections;
a scanning unit, configured to obtain, for each of the music sections, a contextual music section of the music section according to a tune in the tune library, where the contextual music section is another music section within a preset distance from the music section in the tune;
an updating unit, configured to obtain, for each of the music sections, a negative sample vector of the music section, where the music section corresponding to the negative sample vector is a music section other than a context music section of the music section; and calculating a loss function score according to the representation vector of the music bar, the representation vector of the context music bar and the negative sample vector, updating the representation vector of the music bar based on the score, wherein the similarity between the updated representation vector of the music bar and the representation vector of the context music bar is increased, and the similarity between the updated representation vector of the music bar and the negative sample vector is reduced.
6. The apparatus of claim 5, the scanning unit to: sequentially scanning each music section of each tune in the tune library, and aiming at the current scanned current music section, acquiring all current context music sections within the preset distance from the current music section;
the updating unit is used for: for a current music measure, respectively calculating a loss function score according to the representation vector of the current music measure and the representation vector of each current context music measure, and respectively updating the representation vector of the current music measure based on each score.
7. The apparatus of claim 5, the acquisition unit to: scanning each tune in the tune library to obtain all the appeared music sections and establishing a music section table; obtaining the occurrence times of all the music sections, and deleting the music sections with the occurrence times smaller than a preset threshold from the music section table;
the setting unit is used for: a representation vector is established for each of the musical sections in the table of musical sections.
8. The apparatus of any one of claims 5 to 7, further comprising:
the conversion unit is used for converting all the tunes in the tune library into numbered musical notation tunes before the music sections contained in the tune library are acquired, so as to obtain the music sections in the numbered musical notation tunes.
9. A computer readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the steps of the method according to any one of claims 1-4.
10. An electronic device comprising a memory and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by one or more processors, the one or more programs comprising instructions for performing the method of any of claims 1-4.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010151122.6A CN111477198B (en) | 2020-03-05 | 2020-03-05 | Method and device for representing music bar and electronic equipment |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010151122.6A CN111477198B (en) | 2020-03-05 | 2020-03-05 | Method and device for representing music bar and electronic equipment |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN111477198A CN111477198A (en) | 2020-07-31 |
| CN111477198B true CN111477198B (en) | 2023-07-14 |
Family
ID=71747356
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202010151122.6A Active CN111477198B (en) | 2020-03-05 | 2020-03-05 | Method and device for representing music bar and electronic equipment |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN111477198B (en) |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2004219804A (en) * | 2003-01-16 | 2004-08-05 | Nippon Telegr & Teleph Corp <Ntt> | Similar voice music search device, similar voice music search processing method, similar voice music search program, and recording medium of the program |
| CN103021390A (en) * | 2011-09-25 | 2013-04-03 | 雅马哈株式会社 | Displaying content in relation to music reproduction by means of information processing apparatus independent of music reproduction apparatus |
| CN109166566A (en) * | 2018-08-27 | 2019-01-08 | 北京奥曼特奇科技有限公司 | A kind of method and system for music intelligent accompaniment |
| CN109189974A (en) * | 2018-08-08 | 2019-01-11 | 平安科技(深圳)有限公司 | A kind of method for building up, system, equipment and the storage medium of model of wrirting music |
Family Cites Families (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US8710343B2 (en) * | 2011-06-09 | 2014-04-29 | Ujam Inc. | Music composition automation including song structure |
-
2020
- 2020-03-05 CN CN202010151122.6A patent/CN111477198B/en active Active
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2004219804A (en) * | 2003-01-16 | 2004-08-05 | Nippon Telegr & Teleph Corp <Ntt> | Similar voice music search device, similar voice music search processing method, similar voice music search program, and recording medium of the program |
| CN103021390A (en) * | 2011-09-25 | 2013-04-03 | 雅马哈株式会社 | Displaying content in relation to music reproduction by means of information processing apparatus independent of music reproduction apparatus |
| CN109189974A (en) * | 2018-08-08 | 2019-01-11 | 平安科技(深圳)有限公司 | A kind of method for building up, system, equipment and the storage medium of model of wrirting music |
| CN109166566A (en) * | 2018-08-27 | 2019-01-08 | 北京奥曼特奇科技有限公司 | A kind of method and system for music intelligent accompaniment |
Non-Patent Citations (1)
| Title |
|---|
| 一种分段式音乐情感识别方法;石祥滨等;《小型微型计算机系统》(第08期);全文 * |
Also Published As
| Publication number | Publication date |
|---|---|
| CN111477198A (en) | 2020-07-31 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN111524557B (en) | Inverse synthesis prediction method, device, equipment and storage medium based on artificial intelligence | |
| CN110246472B (en) | Music style conversion method and device and terminal equipment | |
| CN109299458A (en) | Entity recognition method, device, equipment and storage medium | |
| US11568244B2 (en) | Information processing method and apparatus | |
| US11600252B2 (en) | Performance analysis method | |
| US12147477B2 (en) | Search result display device, search result display method, and non-transitory computer readable recording medium | |
| CN112489676A (en) | Model training method, device, equipment and storage medium | |
| EP4630917A1 (en) | Code review comment generation from historical data using machine learning | |
| CN111428487B (en) | Model training method, lyric generation method, device, electronic equipment and medium | |
| KR102625795B1 (en) | System and Method for Searching of Similar sound source based on Artificial Intelligence | |
| Liu et al. | Prioritized experience replay based on multi-armed bandit | |
| US20230245735A1 (en) | Electronic medical record data analysis system and electronic medical record data analysis method | |
| CN114756706B (en) | Resource synthesis method, device, equipment and storage medium | |
| CN116186200A (en) | Model training method, device, electronic equipment and storage medium | |
| CN113157727A (en) | Method, apparatus and storage medium for providing recall result | |
| CN111198965A (en) | Song retrieval method, device, server and storage medium | |
| JP2005004658A (en) | Change point detection device, change point detection method and change point-detecting program | |
| CN111477198B (en) | Method and device for representing music bar and electronic equipment | |
| CN111062216B (en) | Named entity identification method, device, terminal and readable medium | |
| CN119066977A (en) | A ship design knowledge push method and system based on artificial intelligence | |
| CN113177419A (en) | Text rewriting method, device, storage medium and electronic equipment | |
| CN111460141B (en) | Text processing method and device and electronic equipment | |
| CN113779203B (en) | Method and device for generating paragraph set, and reasoning method and device | |
| Pauwels et al. | A Critical Look at the Applicability of Markov Logic Networks for Music Signal Analysis | |
| CN119028299A (en) | Music generation method, system, device and storage medium |
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 |