Music style transfer method, computer device and computer readable storage medium

By separating and similarity matching the music of multiple instruments, and using the variational autoencoding model to process, the problem of difficulty in distinguishing multi-instrument melodies in the existing technology is solved, and the music and lighting themes after style migration are more coordinated and improved. User experience.

CN118471241BActive Publication Date: 2024-10-15TRUE SPACE (ZHUHAI) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410940696.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-15
Publication Date
2024-10-15
Estimated Expiration
2044-07-15

AI Technical Summary

Technical Problem

Existing music style transfer methods are difficult to effectively distinguish and convert the melodies of multiple instruments, causing noise to easily appear after style transfer, affecting the user experience.

Method used

By separating the music to be migrated, extracting multiple audio tracks to be migrated, and using template music for similarity matching and variational autoencoding model processing, ensuring that each audio track contains only one instrument, thereby avoiding noise during style migration. The synthesized music fits the lighting theme better.

Benefits of technology

It realizes the style transfer of music from multiple instruments, avoids noise, enhances the coordination of music and lighting themes, and improves user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118471241B_ABST
    Figure CN118471241B_ABST
Patent Text Reader

Abstract

The present invention provides a method for music style transfer, a computer device and a computer-readable storage medium, the method comprising obtaining a light theme, selecting template music from a music database according to the light theme; separating the music to be transferred to obtain multiple tracks to be transferred, the multiple tracks to be transferred include multiple instrument tracks to be transferred and vocal tracks to be transferred; transforming the vocal tracks to be transferred using the template vocal tracks of the template music to obtain transfer vocal tracks; extracting each feature to be transferred from each instrument track to be transferred; performing similarity matching between each instrument track to be transferred and the template track of the template music; inputting each instrument track to be transferred and its corresponding template track into a variational autoencoder model to obtain each transfer track; merging each transfer track with the transfer vocal track to obtain transfer music. By dividing the music to be transferred into multiple tracks to be transferred, the transferred music after the music style transfer is more consistent with the theme style of the light.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of music style transfer, and in particular to a method for music style transfer, a computer device and a computer-readable storage medium. Background Art

[0002] In recent years, lighting control technology has become increasingly popular in smart homes. Lighting control technology can present different experience effects to the audience through changes in light beams, colors and lighting effects. Some lighting systems are designed with lighting controls of different styles and themes for users to choose from. For example, Philips' Hue system provides lighting themes such as starry sky, grassland sunset, and northern lights. Different lighting themes can be paired with corresponding styles of music, so that users can feel the atmosphere brought by the changes in lighting while enjoying music.

[0003] However, the style of the music that some users like does not match the lighting theme, resulting in a very poor user experience. For example, when a user turns on the starry sky theme lighting to help him sleep before going to bed, and at this time plays the user's favorite music with a strong sense of percussion, the user will have difficulty falling asleep due to the different styles.

[0004] The steps of a music emotion style transfer method based on a deep neural network include obtaining original music data, generating an original music spectrogram according to the original music data; inputting the original music data into a preset style encoder to obtain an original style embedding vector; obtaining a target emotion embedding vector; concatenating the original style embedding vector and the target emotion embedding vector to obtain a target style embedding vector; obtaining a music emotion transfer neural network; inputting the original music spectrogram and the target style embedding vector into the music emotion transfer neural network, and the music emotion transfer neural network outputs the target emotion style music. The music style transfer method determines the style of music data by pitch and timbre. However, since the melodies played by different instruments are different, the melodies played by various instruments are prone to overlap. Therefore, if the music emotion style transfer method is used directly for style transfer, the melodies played by various instruments cannot be distinguished. After the style transfer of the overlapping melodies, noise is likely to occur, which affects the user experience. Summary of the invention

[0005] The first object of the present invention is to provide a method for music style transfer applicable to multi-instrument music.

[0006] A second object of the present invention is to provide a computer device for implementing the above-mentioned method of music style transfer.

[0007] A second object of the present invention is to provide a computer-readable storage medium for implementing the above-mentioned method of music style transfer.

[0008] To achieve the first purpose of the present invention, the present invention provides a method for music style transfer, which comprises the following steps: obtaining a lighting theme, selecting template music from a music database according to the lighting theme; separating the music to be transferred to obtain a plurality of tracks to be transferred, the plurality of tracks to be transferred comprising a plurality of instrument tracks to be transferred and a vocal track to be transferred; transforming the vocal track to be transferred using a template vocal track of the template music to obtain a transferred vocal track; extracting each feature to be transferred from each instrument track to be transferred; performing similarity matching between each instrument track to be transferred and the template track of the template music to find a target template track that best matches the instrument track to be transferred; inputting each instrument track to be transferred and its corresponding target template track into a variational autoencoder model to obtain each transferred audio track; merging each transferred audio track with the transferred vocal track to obtain transferred music.

[0009] It can be seen from the above scheme that the audio tracks to be migrated of the present invention include multiple instrument tracks to be migrated and vocal tracks to be migrated. Among the instrument tracks to be migrated, each track contains only one instrument as much as possible. Music track division can make it applicable to music of multiple instruments during music migration, avoiding noise caused by mixed melodies of multiple instruments during style migration. In the present invention, by dividing the music to be migrated into multiple audio tracks to be migrated, and then confirming the similarity between the audio tracks to be migrated and the audio tracks of the template music one by one, matching the audio tracks to be migrated with the template music with the highest similarity, and then performing style migration of the audio tracks, thereby resynthesizing the migrated music, so that the migrated music after the music style migration is more in line with the theme style of the lighting, providing the user with a stronger sense of atmosphere.

[0010] In a further solution, after obtaining each migration track, the following steps are further performed: analyzing the beat of the music to be migrated, and performing speed change processing on each migration track according to the beat of the template music.

[0011] It can be seen that changing the speed of the music makes the music style more in line with the lighting theme.

[0012] In a further scheme, the step of matching the similarity of each instrumental track to be migrated with the template track of the template music includes: calculating the relative entropy of each feature to be migrated and the template feature of each template track of the template music, comparing the relative entropy of the same feature to be migrated with each template feature, matching the feature to be migrated with the template feature with the smallest relative entropy of the feature to be migrated, and using the template track corresponding to the template feature with the smallest relative entropy as the target template track for matching the instrumental track to be migrated.

[0013] It can be seen that by calculating the relative entropy between the features to be transferred and the template features, the instrument track to be transferred can be matched to the closest track in the template music, for example, the string track is matched to the string track, and the violin track is matched to the erhu track, etc. The closest instrument track to be transferred is matched with the template track, which can make the subsequent style transfer more coordinated and the style of the transferred music closer to the template music.

[0014] In a further scheme, before obtaining the lighting theme, the following is also performed: establishing a music database; establishing the music database includes: collecting multiple template music, the template music is provided with multiple template audio tracks; performing beat analysis on each template music; obtaining the template music text of each template music, inputting the template music text into the language model, and extracting the template music index vector; extracting template features from the template audio tracks of each template music.

[0015] It can be seen that setting up a music database to provide templates of various styles of music as the target of migration makes the music style migration more accurate.

[0016] In a further scheme, selecting template music from a music database according to the light theme includes: inputting the theme text of the light theme into a language model to obtain a theme feature vector; and obtaining the template music by comparing the cosine distance between the theme feature vector and each of the template music index vectors.

[0017] It can be seen that by comparing the theme feature vector with each template music index vector, the template music index vector with the closest distance is selected to obtain the template music of the template music index vector.

[0018] In a further embodiment, the variational autoencoder model is provided with a content encoder, a style encoder and a decoder.

[0019] In a further solution, each instrument track to be migrated and its corresponding target template track are input into the variational autoencoder model, including: inputting the instrument track to be migrated into the content encoder to obtain content features; inputting the target template track corresponding to the instrument track to be migrated into the style encoder to obtain style features; and superimposing the content features and the style features and inputting them into the decoder to obtain the migration track.

[0020] It can be seen that the content features of the audio track to be migrated, such as pitch, are extracted through the content encoder, and the style features are extracted through the style encoder. By combining the two, music migration is completed.

[0021] To achieve the second objective of the present invention, the present invention provides a computer device, including a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the above-mentioned method of music style transfer is implemented.

[0022] To achieve the third objective of the present invention, the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed, the above-mentioned method of music style transfer is implemented. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] Figure 1 It is a flowchart of establishing a music database according to an embodiment of the method for music style transfer of the present invention.

[0024] Figure 2 It is a flow chart of an embodiment of the method for music style transfer of the present invention.

[0025] Figure 3 It is a structural block diagram of a variational autoencoder model of an embodiment of the method for music style transfer of the present invention.

[0026] The present invention is further described below in conjunction with the accompanying drawings and embodiments. DETAILED DESCRIPTION

[0027] The present invention divides the music to be migrated into multiple tracks to be migrated, confirms the similarity between the tracks to be migrated and the tracks of the template music one by one, and then performs style migration of the tracks, thereby resynthesizing the migrated music, so that the migrated music after the music style migration is more in line with the theme style of the lighting.

[0028] Music style transfer method embodiment:

[0029] See also Figure 1 Before performing the music style migration of this embodiment, a music database needs to be established first. The music database provides templates of various styles of music as the migration target. First, step S21 is executed to collect multiple template music. The template music must be consistent with the light theme style. Each light theme requires a template music. When collecting multiple template music, the template music contains template tracks of each instrument.

[0030] After collecting multiple template music, step S22 is executed to perform beat analysis on the template music. The beat analysis can be performed by calculating the spectrum flux of the template music to detect the starting point of the note, and then finding the autocorrelation of the spectrum flux, and finding the maximum autocorrelation value, and using the maximum autocorrelation value as the predicted beat cycle to analyze the number of beats per minute.

[0031] After the beat analysis of the template music, step S23 is executed to obtain the template music text of each template music, input the template music text into the language model, and obtain the template music index vector. Among them, the template music text is described by the staff, and the template music text describes the style of the template music. The language model is a RoBERTa language model, and it can also be other language models such as an XLNet model. The RoBERTa language model uses each semantic unit of the template music text, such as a Chinese character, an English root, a symbol, etc. as a token. The language model generates an original vector expression for each token of a text sequence, and repeatedly processes the sequence in multiple layers through a self-attention mechanism, and finally uses the vector output at the end of the sentence as a feature vector to represent a text description. In this embodiment, the vector output is a template music index vector.

[0032] After obtaining the template music index vector, execute step S24 to extract template features for the template tracks of each template music. The template features are MFCC (Mel-scale Frequency Cepstral Coefficients) features of the template tracks in the template music, and extracting template features for the template tracks of each template music is a MFCC extraction process for the template tracks. After extracting the MFCC of the template tracks, the mean and covariance matrix of the template features are used to estimate the probability distribution of the template tracks.

[0033] After building the music database, you can perform music style transfer. Figure 2 First, execute step S11 to obtain the light theme, and select template music from the music database according to the light theme. The light theme is determined by the user. The process of selecting the template music is to input the theme text of the light theme into the language model to obtain the theme feature vector. The language model is the RoBERTa language model, and can also be other language models such as the XLNet model. By comparing the cosine distance between the theme feature vector and each template music index vector, the template music index vector with the closest cosine distance to the theme feature vector is selected to obtain the template music of the template music index vector.

[0034] After selecting the template music, execute step S12 to separate the music to be migrated and obtain multiple tracks to be migrated. The separation method is blind source separation, and the music blind source separation tool Spleeter can be used to separate the tracks of the sound source. The multiple tracks to be migrated include multiple instrument tracks to be migrated and vocal tracks to be migrated. Among the instrument tracks to be migrated, try to make each track contain only one instrument. When there are many instruments, such as a symphony orchestra, one track inevitably contains multiple instruments.

[0035] After obtaining a plurality of audio tracks to be migrated, step S13 is executed to transform the vocal tracks to be migrated to obtain migrated vocal tracks. The VITS-SVC tool is used to transform the vocal tracks to be migrated.

[0036] After obtaining the migrated vocal track, execute step S14 to extract each feature to be migrated for each instrument track to be migrated, wherein the feature to be migrated is the MFCC feature of the instrument track to be migrated, and extracting the template feature for each instrument track to be migrated is the MFCC extraction process of the instrument track to be migrated, and the probability distribution of the track to be migrated is estimated based on the mean and covariance matrix of the feature to be migrated.

[0037] After extracting each feature to be transferred from each instrument track to be transferred, step S15 is executed to perform similarity matching between each instrument track to be transferred and the template track, and find the target template track that best matches the instrument track to be transferred. Among them, the relative entropy of each feature to be transferred and the template feature of each template track of the template music is calculated, and the relative entropy of the same feature to be transferred and each template feature is compared. The feature to be transferred is matched with the template feature with the smallest relative entropy of the feature to be transferred, and the template track corresponding to the template feature with the smallest relative entropy is used as the target template track to be matched with the instrument track to be transferred. Since the probability distribution of the track to be transferred and the probability distribution of the template track have been estimated by the feature to be transferred and the template feature, the probability distribution of the track to be transferred and the probability distribution of the template track can be used to calculate the relative entropy, and the template feature with the smallest relative entropy is obtained for the instrument track to be transferred to match it, so that the instrument track to be transferred is matched with the closest template track in the template music. For example, a string track is matched to a string track, such as a violin track is matched to an erhu track, etc.

[0038] After the instrument tracks to be migrated are matched with the closest template tracks in the template music, step S16 is further performed to input each instrument track to be migrated and its corresponding target template track into the variational autoencoder model to obtain each migration track. Figure 3, the variational autoencoder model is a VAE model, wherein the variational autoencoder model is provided with a content encoder 11, a style encoder 12 and a decoder 13. Among them, the content encoder 11 is used to extract the content features of the instrument track to be migrated, and the content in the content features refers to the information that changes over time in a track, such as pitch. The style encoder 12 is used to extract style features, and the style in the style features refers to the information that does not change in a track, such as the timbre of an instrument. Among them, the Mel spectrum of the instrument track to be migrated is input into the content encoder to obtain the content features, and each frame encoding of the content features needs to be retained; the Mel spectrum of the target template track corresponding to the instrument track to be migrated is input into the style encoder to obtain the style features. Since the style features are global to a track, the final frame result is extracted. The content features and the style features are superimposed and input into the decoder 13 to obtain the Mel spectrum of the migrated track. The Mel spectrum of the migrated track generates the waveform of the migrated track through the HiFi-GAN model.

[0039] After obtaining each migration track, the beat of the music to be migrated is analyzed, and each migration track is speed-changed according to the beat of the template music. In this embodiment, a phase vocoder is used to speed-change each migration track to the beat of the template music.

[0040] After the speed change processing is performed, step S17 is executed to merge the migration audio tracks and the migration vocal track to obtain the migration music.

[0041] The audio tracks to be migrated in this embodiment include multiple instrument tracks to be migrated and vocal tracks to be migrated. Among the instrument tracks to be migrated, each track contains only one instrument as much as possible. Music track division can make it applicable to music of multiple instruments during music migration, thereby expanding the scope of music that can be migrated. In the present invention, by dividing the music to be migrated into multiple audio tracks to be migrated, and then confirming the similarity between the audio tracks to be migrated and the audio tracks of the template music one by one, and then performing style migration of the audio tracks, thereby resynthesizing the migrated music, the migrated music after the music style migration is more in line with the theme style of the lighting, and providing the user with a stronger sense of atmosphere.

[0042] Computer device embodiment:

[0043] The computer device of this embodiment includes a processor and a memory. The memory stores a computer program. When the processor executes the computer program, the method embodiment of the music style transfer is implemented.

[0044] The computer device may include but is not limited to a processor and a memory. Those skilled in the art will appreciate that the computer device may include more or fewer components, or a combination of certain components, or different components, for example, the computer device may also include input and output devices, network access devices, buses, etc.

[0045] Computer readable storage medium embodiment:

[0046] The method for music style transfer in the computer device described in the above embodiment can be stored in a computer readable storage medium in the form of a computer program. When the computer program is executed by a processor, the steps of the method embodiment of music style transfer in the computer device can be completed. The computer readable medium can be a computer readable signal medium or a computer readable storage medium. The computer readable storage medium can be, for example, but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0047] The above are only preferred embodiments of the present invention, but the design concept of the invention is not limited thereto. Without departing from the concept of the present invention, more other equivalent embodiments may be included. It is possible for those skilled in the art to make various obvious changes, readjustments and substitutions without departing from the protection scope of the present invention.

Claims

1. A method for music style transfer, characterized in that: Get the light theme, and select template music from the music database according to the light theme; Separating the music to be migrated to obtain a plurality of tracks to be migrated, wherein the plurality of tracks to be migrated include a plurality of instrument tracks to be migrated and a vocal track to be migrated; The vocal track to be migrated is transformed using the template vocal track of the template music to obtain a migrated vocal track; Extracting each feature to be migrated from each of the musical instrument tracks to be migrated; Performing similarity matching between each of the to-be-migrated instrument tracks and the template tracks of the template music, and finding the target template track that best matches the to-be-migrated instrument track; Inputting each of the to-be-migrated instrument tracks and its corresponding target template track into a variational autoencoder model to obtain each migration track; Each of the migration audio tracks and the migration vocal track are combined to obtain the migration music.

2. The method for music style transfer according to claim 1, characterized in that: After getting each migration track, also execute: The beat of the music to be migrated is analyzed, and the speed of each of the migrated audio tracks is changed according to the beat of the template music.

3. The method for music style transfer according to claim 1 or 2, characterized in that: The step of matching the similarity of each of the to-be-migrated instrument tracks with the template tracks of the template music comprises: Calculate the relative entropy of the feature to be migrated and the template features of each template audio track of the template music, compare the relative entropies of the same feature to be migrated and each template feature, match the feature to be migrated with the template feature with the smallest relative entropy of the feature to be migrated, and use the template audio track corresponding to the template feature with the smallest relative entropy as the target template audio track for matching the instrument audio track to be migrated.

4. The method for music style transfer according to claim 3, characterized in that: Before obtaining the lighting theme, the following steps are performed: establishing the music database; The steps of establishing the music database include: Collecting a plurality of template music, wherein the template music is provided with a plurality of template tracks; Performing beat analysis on each of the template music; Acquire the template music text of each of the template music, input the template music text into the language model, and extract the template music index vector; Template features are extracted from the template tracks of each of the template music.

5. The method for music style transfer according to claim 4, characterized in that: The steps for selecting template music from the music database according to the lighting theme include: Inputting the theme text of the lighting theme into the language model to obtain a theme feature vector; The template music is obtained by comparing the cosine distance between the theme feature vector and each template music index vector.

6. The method for music style transfer according to claim 1 or 2, characterized in that: The variational autoencoder model is provided with a content encoder, a style encoder and a decoder.

7. The method for music style transfer according to claim 6, characterized in that: The step of inputting each of the to-be-migrated instrument tracks and its corresponding target template track into the variational autoencoder model comprises: Inputting the instrument track to be migrated into the content encoder to obtain content features; Inputting the target template audio track corresponding to the instrument audio track to be migrated into the style encoder to obtain style features; The content feature and the style feature are superimposed and input into a decoder to obtain the migration audio track.

8. A computer device comprising a processor and a memory, wherein the memory stores a computer program, characterized in that: When the computer program is executed by the processor, the method for music style transfer according to any one of claims 1 to 7 is implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed, the method for music style transfer according to any one of claims 1 to 7 is implemented.