Music playing method and device based on musical instrument separation
By replacing the instrument element data of the audio, the problem of large loss after audio separation is solved and high-quality panoramic sound playback is achieved.
Patent Information
- Application Number
- CN202310174140.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-23
- Publication Date
- 2024-08-23
AI Technical Summary
In the existing technology, when the audio is converted into panoramic sound for playback, the separated target music has greater loss and distortion.
By obtaining the audio to be processed, parsing and identifying the tune of each target instrument, replacing the tune with instrument element data, and assigning it to a preset channel for playback, ensuring the data quality of the tune.
It reduces the data loss of target audio, improves data quality, and achieves high-quality panoramic sound playback effects.
Smart Images

Figure CN118538189A
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of information technology, and in particular to a method and device for music playing based on instrument separation. Background Art
[0002] At present, the method of converting audio to panoramic sound playback mainly uses the method of separating the target music from the original audio and replaying it based on the surround sound channel, and the panoramic sound playback effect is achieved based on the above method. However, the target music separated by the relevant technology has a relatively large loss and a lot of distortion. Summary of the invention
[0003] The present disclosure provides a method and device for playing music based on instrument separation, the main purpose of which is to solve the problem of large loss and high distortion of separated target music in the related art.
[0004] According to a first aspect of the present disclosure, a method for playing music based on instrument separation is provided, comprising:
[0005] Acquire the audio to be processed, and parse the audio to be processed to obtain the music tune corresponding to each target instrument in the audio to be processed;
[0006] Using the musical instrument element data to replace the corresponding musical tones respectively to obtain the target audio, wherein the musical instrument element data is the reference data of the musical tones corresponding to different types of musical instruments;
[0007] The target audio is distributed to a preset number of channels for playback.
[0008] Optionally, the parsing of the audio to be processed to obtain the music tunes corresponding to each target instrument in the audio to be processed includes:
[0009] Calling a preset algorithm to identify the audio to be processed, and obtaining the type of the target musical instrument contained in the audio to be processed;
[0010] Obtaining the tune played by each target instrument at each moment;
[0011] The tunes played by each target musical instrument at each moment are reorganized based on the time axis to obtain the musical tunes corresponding to the types of each target musical instrument.
[0012] Optionally, the using the instrument element data to replace the corresponding musical tunes respectively to obtain the target audio comprises:
[0013] Matching the instrument element data corresponding to the type of the target instrument in the instrument element database to obtain the instrument element data corresponding to each target instrument in the audio to be processed;
[0014] The corresponding musical melody is replaced with the musical instrument element data to obtain the target audio corresponding to each target musical instrument.
[0015] Optionally, the using the instrument element data to replace the corresponding musical melody to obtain the target audio corresponding to each target instrument includes:
[0016] Respectively replace the musical melody corresponding to each target instrument with the corresponding musical instrument element data, and modulate each of the replaced musical melody as an audio track;
[0017] Each of the audio tracks is converted into the target audio respectively, so as to obtain the target audio corresponding to each target instrument respectively.
[0018] Optionally, the step of replacing the musical melody corresponding to each target musical instrument with the corresponding musical instrument element data comprises:
[0019] The tunes corresponding to different moments in the musical melody corresponding to each target instrument are replaced with the tunes of the corresponding instrument element data to obtain the musical melody corresponding to each target instrument after replacement.
[0020] Optionally, allocating the target audio to a preset number of channels for playing includes:
[0021] Allocating the target audio to a preset number of channels, wherein one channel corresponds to at least one speaker, and the speaker is arranged at a preset spatial position;
[0022] The target audio is played based on the speaker corresponding to the channel.
[0023] Optionally, the playing of the target audio based on the speaker corresponding to the channel includes:
[0024] Each of the channels is matched to the corresponding loudspeaker, and the target audio is played based on the loudspeaker, wherein the channel is matched to the loudspeaker in a manner selected in a preset mode or in a manner defined by a user.
[0025] According to a second aspect of the present disclosure, a device for playing music based on instrument separation is provided, comprising:
[0026] A parsing unit, used to obtain the audio to be processed, and parse the audio to be processed to obtain the music tune corresponding to each target instrument in the audio to be processed;
[0027] A replacement unit, used to replace the corresponding musical tones with musical instrument element data to obtain target audio, wherein the musical instrument element data is reference data of musical tones corresponding to different types of musical instruments;
[0028] The playing unit is used to distribute the target audio to a preset number of channels for playing.
[0029] Optionally, the parsing unit includes:
[0030] An identification module, used for calling a preset algorithm to identify the audio to be processed, and obtaining the type of the target instrument contained in the audio to be processed;
[0031] An acquisition module, used for acquiring the tune played by each target instrument at each moment;
[0032] The reorganization module is used to reorganize the tunes played by each target instrument at each moment based on the time axis to obtain the musical tunes corresponding to the types of each target instrument.
[0033] Optionally, the replacement unit includes:
[0034] A matching module, used for matching the instrument element data corresponding to the type of the target instrument in the instrument element database, and obtaining the instrument element data corresponding to each target instrument in the audio to be processed;
[0035] The optimization module is used to use the instrument element data to replace the corresponding musical melody to obtain the target audio corresponding to each target instrument.
[0036] Optionally, the optimization module is further used for:
[0037] Respectively replace the musical melody corresponding to each target instrument with the corresponding musical instrument element data, and modulate each of the replaced musical melody as an audio track;
[0038] Each of the audio tracks is converted into the target audio respectively, so as to obtain the target audio corresponding to each target instrument respectively.
[0039] Optionally, the optimization module is also used to:
[0040] The tunes corresponding to different moments in the musical melody corresponding to each target instrument are replaced with the tunes of the corresponding instrument element data to obtain the musical melody corresponding to each target instrument after replacement.
[0041] Optionally, the playback unit includes:
[0042] A distribution module, used for distributing the target audio to a preset number of the channels, wherein one channel corresponds to at least one speaker, and the speaker is arranged at a preset spatial position;
[0043] A playing module is used to play the target audio based on the speaker corresponding to the channel.
[0044] Optionally, the playback module is further used for:
[0045] Each of the channels is matched to the corresponding loudspeaker, and the target audio is played based on the loudspeaker, wherein the channel is matched to the loudspeaker in a manner selected in a preset mode or in a manner defined by a user.
[0046] According to a third aspect of the present disclosure, a vehicle is provided, comprising the device for playing music based on instrument separation according to the second aspect.
[0047] According to a fourth aspect of the present disclosure, there is provided an electronic device, including:
[0048] at least one processor; and
[0049] a memory communicatively connected to the at least one processor; wherein,
[0050] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method described in the first aspect.
[0051] According to a fifth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the method described in the first aspect.
[0052] According to a sixth aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the method described in the first aspect is implemented.
[0053] The present disclosure provides a method and device for music playback based on instrument separation, which obtains the audio to be processed, analyzes the audio to be processed, and obtains the music tunes corresponding to each target instrument in the audio to be processed; uses the instrument element data to replace the corresponding music tunes respectively to obtain the target audio, and the instrument element data is the music tune reference data corresponding to different types of instruments; and distributes the target audio to a preset number of channels for playback. Compared with the related art, by analyzing the audio to be processed, the music tunes corresponding to each target instrument in the audio to be processed are obtained, and the corresponding music tunes are replaced based on the music tune reference data, i.e., the instrument element data, to obtain the target audio. The target audio is distributed to a preset number of channels for playback. Among them, the music tunes are obtained by preliminary analysis of the audio to be processed, and the music tunes are replaced by the instrument element data, thereby ensuring the data quality of the music tunes, thereby improving the data quality of the target audio and reducing the data loss of the target audio.
[0054] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0056] Figure 1 A flowchart of a method for playing music based on instrument separation provided by an embodiment of the present disclosure;
[0057] Figure 2 A schematic diagram of a structure for separating musical instruments provided by an embodiment of the present disclosure;
[0058] Figure 3 A waveform diagram of stereo data provided by an embodiment of the present disclosure;
[0059] Figure 4 A waveform diagram of panoramic sound data provided by an embodiment of the present disclosure;
[0060] Figure 5 A schematic diagram of the structure of a device for playing music based on instrument separation provided in an embodiment of the present disclosure;
[0061] Figure 6 A schematic diagram of the structure of another device for playing music based on instrument separation provided in an embodiment of the present disclosure;
[0062] Figure 7 A schematic block diagram of an exemplary electronic device 300 provided for an embodiment of the present disclosure. DETAILED DESCRIPTION
[0063] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0064] The following describes the method, device, electronic device and storage medium for music playback based on instrument separation according to an embodiment of the present disclosure with reference to the accompanying drawings.
[0065] Figure 1 The flowchart of a method for playing music based on instrument separation provided by an embodiment of the present disclosure is shown in FIG. The method is applied to a player, such as Figure 1 As shown, the following steps are included:
[0066] Step 101, obtain the audio to be processed, and parse the audio to be processed to obtain the music tune corresponding to each target instrument in the audio to be processed.
[0067] As a refinement of the above step 101, the audio to be processed can be stereo audio or monaural audio. This embodiment does not limit the type of the audio to be processed. After obtaining the audio to be processed, the audio to be processed is parsed to obtain the musical melody corresponding to each target instrument in the audio to be processed. The musical melody is the note played by a target instrument at a certain moment, specifically the melody corresponding to an instrument in a certain time period. For example, the audio to be processed contains the sound of a piano. By parsing the audio to be processed, a musical melody with only the sound of piano is obtained. The musical melody is the melody of the piano in the audio to be processed. The above description is only exemplary. This embodiment does not limit the type and number of instruments contained in the audio to be processed.
[0068] Step 102: Use the musical instrument element data to replace the corresponding musical tones respectively to obtain the target audio, wherein the musical instrument element data is the reference data of the musical tones corresponding to different types of musical instruments.
[0069] As a refinement of the above step 102, in order to improve the quality of the musical melody and obtain the target audio with good quality, it is necessary to replace the musical melody based on the musical melody reference data, that is, the musical instrument element data, to improve the quality of the musical melody. It should be noted that when replacing the musical melody based on the musical instrument element data, it is necessary to pay attention to the correspondence between the musical melody and the musical instrument element data. For example, if the musical instrument type is piano, there will be a corresponding musical melody and corresponding musical instrument element data for the piano. The musical melody corresponding to the piano needs to be replaced based on the musical instrument element data corresponding to the piano. The musical instrument element data corresponding to the piano is the melody data set of the piano. It should be understood that the above description is merely exemplary, and this embodiment does not limit the specific content of the musical instrument element data.
[0070] Step 103: distribute the target audio to a preset number of channels for playback.
[0071] As a refinement of the above step 103, the target audio corresponding to each target instrument in the audio to be processed is obtained through step 102. The target audio corresponding to each target instrument is allocated to a preset number of channels for playback, that is, each channel can be allocated with a plurality of the target audios.
[0072] The method for music playing based on instrument separation provided by the present disclosure obtains the audio to be processed, and parses the audio to be processed to obtain the music tunes corresponding to each target instrument in the audio to be processed; uses the instrument element data to replace the corresponding music tunes respectively to obtain the target audio, and the instrument element data is the music tune reference data corresponding to different types of instruments; and distributes the target audio to a preset number of channels for playing. Compared with the related art, by parsing the audio to be processed, the music tunes corresponding to each target instrument in the audio to be processed are obtained, and the corresponding music tunes are replaced based on the music tune reference data, i.e., the instrument element data, to obtain the target audio. The target audio is distributed to a preset number of channels for playing. Among them, the music tunes are obtained by preliminary analysis of the audio to be processed, and the music tunes are replaced by the instrument element data, thereby ensuring the data quality of the music tunes, thereby improving the data quality of the target audio and reducing the data loss of the target audio.
[0073] As a refinement of the above embodiment, when executing step 101 to parse the audio to be processed and obtain the musical tunes corresponding to each target instrument in the audio to be processed, the following implementation methods can be adopted but not limited to, for example: calling a preset algorithm to identify the audio to be processed and obtain the type of target instrument contained in the audio to be processed; obtaining the tune played by each target instrument at each moment; reorganizing the tune played by each target instrument at each moment based on the time axis to obtain the musical tunes corresponding to the types of each target instrument.
[0074] The preset algorithm is a machine learning algorithm. The preset algorithm, i.e., the machine learning algorithm, is called to identify the audio to be processed, and the target instrument type contained in the audio to be processed is obtained. For example, based on the machine learning algorithm, the audio to be processed is identified, and it is determined that the audio to be processed contains guitar, drums, bass, electronic keyboard, etc. The present embodiment does not limit the types of instruments contained in the audio to be processed. In addition to determining the types of target instruments contained in the audio to be processed, the musical tunes corresponding to various types of target instruments are also obtained. Among them, the acquisition of the musical tunes includes acquiring the tunes played by each of the target instruments at each moment, reorganizing the tunes played by each of the target instruments at each moment based on the time axis, and obtaining the musical tunes corresponding to the types of the target instruments, that is, rearranging and combining the tunes played by the target instruments at each moment in order to obtain the musical tunes. The above acquisition of the musical tunes is only exemplary, and the present embodiment does not limit the way of acquiring the musical tunes.
[0075] As a refinement of the above embodiment, when executing step 102 to replace the corresponding musical tunes with the musical instrument element data to obtain the target audio, the following implementation methods can be adopted but not limited to, for example: matching the musical instrument element data corresponding to the type of the target instrument in the musical instrument element database to obtain the musical instrument element data corresponding to each target instrument in the audio to be processed; using the musical instrument element data to replace the corresponding musical tunes to obtain the target audio corresponding to each target instrument.
[0076] As a refinement of the above embodiment, the musical instrument element database is a database for storing the musical instrument element data, which includes musical instrument element data corresponding to various types of musical instruments. In order to obtain the target audio corresponding to each target musical instrument, it is necessary to match the musical instrument element data corresponding to the target musical instrument type in the musical instrument element database, that is, first determine the target instrument type contained in the audio to be processed, query and match the musical instrument element data corresponding to each target musical instrument in the musical instrument element database, and finally obtain the musical instrument element data corresponding to each target instrument. Thereafter, replace the corresponding musical tune based on the obtained musical instrument element data to obtain the target audio corresponding to each target instrument, for example: replace the musical tune corresponding to the guitar based on the musical instrument element data corresponding to the guitar to obtain the target audio corresponding to the guitar; replace the musical tune corresponding to the bass based on the musical instrument element data corresponding to the bass to obtain the target audio corresponding to the bass, and so on to complete the acquisition of the target audio corresponding to all target instruments.
[0077] As a refinement of the above embodiment, when using the musical instrument element data to replace the corresponding musical tune to obtain the target audio corresponding to each target musical instrument, the following implementation method can be adopted but not limited to, for example: replacing the musical tune corresponding to each target musical instrument with the corresponding musical instrument element data, and modulating each of the replaced musical tunes as an audio track; converting each of the audio tracks into the target audio to obtain the target audio corresponding to each target instrument.
[0078] It should be understood that in order to improve the quality of the musical melody, the corresponding musical melody is replaced based on the musical instrument element data. In order to more clearly illustrate the above-mentioned replacement process, an exemplary description is provided here. For example: after obtaining the musical melody corresponding to the guitar, the musical instrument element data corresponding to the guitar is determined in the musical instrument element database, and then the musical instrument element data that matches the melody similarity of the musical melody is queried in the musical instrument element data and is higher than a preset threshold. The musical melody is replaced with the musical instrument element data, and finally the replaced musical melody with excellent quality is obtained. The replaced musical melody is then modulated as an audio track, and the target audio corresponding to the guitar is generated based on the audio track. In this exemplary description, the guitar is used as an example to illustrate the steps of replacing the musical melody and the steps of producing the target audio. The replacement steps and the steps of producing the target audio involved in other musical instruments are consistent with the exemplary description. For the sake of clarity and conciseness, they will not be repeated in this embodiment.
[0079] As a refinement of the above embodiment, when executing the method of replacing the musical melody corresponding to each target instrument with the corresponding musical instrument element data, the following implementation method can also be adopted but is not limited to, for example: replacing the tunes corresponding to different moments in the musical melody corresponding to each target instrument with the tunes of the corresponding musical instrument element data, to obtain the musical melody corresponding to each target instrument after replacement.
[0080] In order to illustrate the detailed steps of replacing the musical melody with the musical instrument element data, an exemplary description is provided here. In the above detailed description, it is known that the musical instrument element data that replaces the musical melody is the musical instrument element data whose melody similarity with the musical melody is higher than a preset threshold. The musical melody corresponding to each target instrument at different times is replaced by the melody of the corresponding musical instrument element data, so as to obtain the musical melody corresponding to each target instrument after replacement. That is, in a specific implementation method, the use of the musical instrument element data can replace only the melody corresponding to a certain moment of the musical melody, or can completely replace a musical melody. This embodiment does not limit the replacement method of the musical melody.
[0081] As a refinement of the above embodiment, when executing step 103 to allocate the target audio to a preset number of channels, the following implementation method can be adopted but is not limited to, for example: allocate the target audio to a preset number of channels, wherein one channel corresponds to at least one speaker, and the speaker is set at a preset spatial position; and play the target audio based on the speaker corresponding to the channel.
[0082] It should be understood that multiple target audios can be assigned to one channel. For example, the channel contains target audio corresponding to guitar and target audio corresponding to bass. By assigning the target audio of an instrument to a preset number of channels and playing the target audio based on the speakers corresponding to the channels, different playback effects can be obtained. For example: the target audio is assigned to dual channels, namely the left channel and the right channel, and the target audio of the left channel is played based on the speaker at the left position; the target audio of the right channel is played based on the speaker at the right position to form a stereo sound effect.
[0083] Figure 2 A schematic diagram of a structure of separating musical instruments provided by an embodiment of the present disclosure, Figure 2 The target audio corresponding to the target instrument involved in the two-channel audio is separated and redistributed to different channels to form multi-channel audio. Figure 2 Each musical instrument shown occupies only one channel, but this does not constitute a limitation of the present disclosure, wherein left door, right door, left front surround, and right front surround are all different channel names.
[0084] As a refinement of the above embodiment, when playing the target audio based on the speaker corresponding to the channel, the following implementation method may also be used but is not limited to, for example: matching each channel to the corresponding speaker, and playing the target audio based on the speaker, wherein the channel is matched to the speaker in a manner selected in a preset mode or in a user-defined manner.
[0085] As a refinement of the above embodiment, in the present embodiment, one channel corresponds to at least one speaker, and the target audio in the channel is played based on the corresponding speaker, but in the matching method of the channel and the speaker, a method of selecting in a preset mode can be adopted, that is, several matching schemes are preset in the system for users to directly select, and a user-defined mode can also be adopted, that is, the user sets a certain channel to match a certain speaker.
[0086] In some embodiments, the preset mode of matching channels with speakers may also correspond to a playback mode, for example, a stereo playback mode may be played based on two speakers corresponding to two channels in the preset mode, and a panoramic playback mode may be played based on seven speakers corresponding to seven channels in the preset mode. It should be understood that the description of the above preset modes is merely exemplary and does not constitute a limitation of the present disclosure.
[0087] As a refinement of the above embodiment, when playing the audio to be processed in panoramic sound mode, methods that can be used include but are not limited to respectively allocating the target audio corresponding to each target instrument to the seven channels, and playing the target audio corresponding to each target instrument based on at least seven speakers corresponding to the seven channels to achieve a panoramic sound playback effect.
[0088] Figure 3 A waveform diagram of stereo data provided by an embodiment of the present disclosure; Figure 4 A waveform diagram of panoramic sound data provided by an embodiment of the present disclosure, wherein: Figure 4 The panoramic sound data shown is composed of Figure 3 The stereo data shown is converted based on a method of playing music with instrument separation.
[0089] It should be noted that the user information and data involved in this disclosure are all information and data authorized by the user or fully authorized by all parties.
[0090] In summary, the embodiments of the present disclosure can achieve the following effects:
[0091] 1. The musical melody obtained by analysis is replaced by musical melody reference data to obtain the target audio with high quality, and the target audio with high quality is distributed to a preset number of channels for playback, thereby achieving a high-quality panoramic sound playback effect.
[0092] 2. Convert stereo music into panoramic music.
[0093] 3. By analyzing the audio to be processed, the musical tune corresponding to each target instrument in the audio to be processed is obtained, and the corresponding musical tune is replaced based on the musical tune reference data, i.e., the instrument element data, to obtain the target audio, thereby reducing the data loss of the target audio.
[0094] Corresponding to the above-mentioned method for playing music with separated musical instruments, the present invention also provides a device for playing music with separated musical instruments. Since the device embodiment of the present invention corresponds to the above-mentioned method embodiment, the details not disclosed in the device embodiment can be referred to the above-mentioned method embodiment, and will not be repeated in the present invention.
[0095] Figure 5 A schematic diagram of the structure of a device for playing music based on instrument separation provided in an embodiment of the present disclosure, such as Figure 5 As shown, including:
[0096] The parsing unit 21 is used to obtain the audio to be processed, and parse the audio to be processed to obtain the music tune corresponding to each target instrument in the audio to be processed;
[0097] A replacement unit 22, used to replace the corresponding musical tones with musical instrument element data to obtain target audio, wherein the musical instrument element data is reference data of musical tones corresponding to different types of musical instruments;
[0098] The playing unit 23 is used to distribute the target audio to a preset number of channels for playing.
[0099] The device for music playback based on instrument separation provided by the present disclosure obtains the audio to be processed, and parses the audio to be processed to obtain the music tunes corresponding to each target instrument in the audio to be processed; uses the instrument element data to replace the corresponding music tunes respectively to obtain the target audio, and the instrument element data is the music tune reference data corresponding to different types of instruments; and distributes the target audio to a preset number of channels for playback. Compared with the related art, by parsing the audio to be processed, the music tunes corresponding to each target instrument in the audio to be processed are obtained, and the corresponding music tunes are replaced based on the music tune reference data, i.e., the instrument element data, to obtain the target audio. The target audio is distributed to a preset number of channels for playback. Among them, the music tunes are obtained by preliminary analysis of the audio to be processed, and the music tunes are replaced by the instrument element data, thereby ensuring the data quality of the music tunes, thereby improving the data quality of the target audio and reducing the data loss of the target audio.
[0100] Figure 6 A schematic diagram of the structure of another device for playing music based on instrument separation provided in an embodiment of the present disclosure;
[0101] Furthermore, in a possible implementation of this embodiment, as Figure 6 As shown, the parsing unit 21 includes:
[0102] The identification module 211 is used to call a preset algorithm to identify the audio to be processed and obtain the type of the target instrument contained in the audio to be processed;
[0103] An acquisition module 212 is used to acquire the tune played by each target instrument at each moment;
[0104] The reorganization module 213 is used to reorganize the tunes played by each target instrument at each moment based on the time axis to obtain the musical tunes corresponding to the types of each target instrument.
[0105] Furthermore, in a possible implementation of this embodiment, as Figure 6 As shown, the replacement unit 22 includes:
[0106] A matching module 221 is used to match the instrument element data corresponding to the type of the target instrument in the instrument element database to obtain the instrument element data corresponding to each target instrument in the audio to be processed;
[0107] The optimization module 222 is used to use the instrument element data to replace the corresponding musical melody to obtain the target audio corresponding to each target instrument.
[0108] Furthermore, in a possible implementation of this embodiment, as Figure 6 As shown, the optimization module 222 is also used for:
[0109] Respectively replace the musical melody corresponding to each target instrument with the corresponding musical instrument element data, and modulate each of the replaced musical melody as an audio track;
[0110] Each of the audio tracks is converted into the target audio respectively, so as to obtain the target audio corresponding to each target instrument respectively.
[0111] Optionally, the optimization module 222 is further used for:
[0112] The tunes corresponding to different moments in the musical melody corresponding to each target instrument are replaced with the tunes of the corresponding instrument element data to obtain the musical melody corresponding to each target instrument after replacement.
[0113] Furthermore, in a possible implementation of this embodiment, as Figure 6 As shown, the playback unit 23 includes:
[0114] An allocating module 231, configured to allocate the target audio to a preset number of the channels, wherein one channel corresponds to at least one speaker, and the speaker is disposed at a preset spatial position;
[0115] The playing module 232 is configured to play the target audio based on the speaker corresponding to the channel.
[0116] Furthermore, in a possible implementation of this embodiment, as Figure 6 As shown, the playing module 232 is also used for:
[0117] Each of the channels is matched to the corresponding loudspeaker, and the target audio is played based on the loudspeaker, wherein the channel is matched to the loudspeaker in a manner selected in a preset mode or in a manner defined by a user.
[0118] It should be noted that the above explanation of the method embodiment is also applicable to the device of this embodiment, and the principle is the same, which is no longer limited in this embodiment.
[0119] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0120] Figure 7A schematic block diagram of an example electronic device 300 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0121] like Figure 7 As shown, the device 300 includes a computing unit 301, which can perform various appropriate actions and processes according to a computer program stored in a ROM (Read-Only Memory) 302 or a computer program loaded from a storage unit 308 to a RAM (Random Access Memory) 303. In the RAM 303, various programs and data required for the operation of the device 300 can also be stored. The computing unit 301, the ROM 302, and the RAM 303 are connected to each other via a bus 304. An I / O (Input / Output) interface 305 is also connected to the bus 304.
[0122] A number of components in the device 300 are connected to the I / O interface 305, including: an input unit 303, such as a keyboard, a mouse, etc.; an output unit 307, such as various types of displays, speakers, etc.; a storage unit 308, such as a disk, an optical disk, etc.; and a communication unit 309, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 309 allows the device 300 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0123] The computing unit 301 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 301 include, but are not limited to, a CPU (Central Processing Unit), a GPU (Graphic Processing Units), various dedicated AI (Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, DSP (Digital Signal Processor), and any appropriate processor, controller, microcontroller, etc. The computing unit 301 performs the various methods and processes described above, such as a method for playing music based on instrument separation. For example, in some embodiments, the method for playing music based on instrument separation may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 308. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 300 via the ROM 302 and / or the communication unit 309. When the computer program is loaded into the RAM 303 and executed by the computing unit 301, one or more steps of the method described above may be performed. Alternatively, in other embodiments, the computing unit 301 may be configured to execute the aforementioned method of music playback based on instrument separation in any other appropriate manner (eg, by means of firmware).
[0124] Various embodiments of the systems and techniques described above herein may be implemented in digital electronic circuit systems, integrated circuit systems, FPGAs (Field Programmable Gate Arrays), ASICs (Application-Specific Integrated Circuits), ASSPs (Application Specific Standard Products), SOCs (System On Chips), CPLDs (Complex Programmable Logic Devices), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: being implemented in one or more computer programs that may be executed and / or interpreted on a programmable system including at least one programmable processor that may be a dedicated or general-purpose programmable processor that may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0125] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0126] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. More specific examples of machine-readable storage media may include electrical connections based on one or more lines, portable computer disks, hard disks, RAM, ROM, EPROM (Electrically Programmable Read-Only-Memory) or flash memory, optical fiber, CD-ROM (Compact Disc Read-Only Memory), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0127] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (Cathode-Ray Tube) or LCD (Liquid Crystal Display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball), through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0128] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: LAN (Local Area Network), WAN (Wide Area Network), the Internet, and blockchain networks.
[0129] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.
[0130] It should be noted that artificial intelligence is a discipline that studies how computers can simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.), and includes both hardware-level and software-level technologies. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, and big data processing; artificial intelligence software technologies mainly include computer vision technology, speech recognition technology, natural language processing technology, as well as machine learning / deep learning, big data processing technology, knowledge graph technology, and other major directions.
[0131] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0132] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A method for playing music based on instrument separation, characterized in that: include: Acquire the audio to be processed, and parse the audio to be processed to obtain the music tune corresponding to each target instrument in the audio to be processed; Using the musical instrument element data to replace the corresponding musical tones respectively to obtain the target audio, wherein the musical instrument element data is the musical tones reference data corresponding to different types of musical instruments; The target audio is distributed to a preset number of channels for playback.
2. The method according to claim 1, characterized in that The parsing of the audio to be processed to obtain the music tunes corresponding to each target instrument in the audio to be processed includes: Calling a preset algorithm to identify the audio to be processed, and obtaining the type of the target musical instrument contained in the audio to be processed; Obtaining the tune played by each target instrument at each moment; The tunes played by each target musical instrument at each moment are reorganized based on the time axis to obtain the musical tunes corresponding to the types of each target musical instrument.
3. The method according to claim 2, characterized in that The using the instrument element data to replace the corresponding musical tunes respectively to obtain the target audio comprises: Matching the instrument element data corresponding to the type of the target instrument in the instrument element database to obtain the instrument element data corresponding to each target instrument in the audio to be processed; The corresponding musical melody is replaced with the musical instrument element data to obtain the target audio corresponding to each target musical instrument.
4. The method according to claim 3, characterized in that The using the instrument element data to replace the corresponding musical melody to obtain the target audio corresponding to each target instrument includes: Respectively replace the musical melody corresponding to each target instrument with the corresponding musical instrument element data, and modulate each of the replaced musical melody as an audio track; Each of the audio tracks is converted into the target audio respectively, so as to obtain the target audio corresponding to each target instrument respectively.
5. The method according to claim 4, characterized in that Replacing the musical melody corresponding to each target musical instrument with the corresponding musical instrument element data comprises: The tunes corresponding to different moments in the musical melody corresponding to each target instrument are replaced with the tunes of the corresponding instrument element data to obtain the musical melody corresponding to each target instrument after replacement.
6. The method according to claim 1, characterized in that The step of allocating the target audio to a preset number of channels for playback includes: Allocating the target audio to a preset number of channels, wherein one channel corresponds to at least one speaker, and the speaker is arranged at a preset spatial position; The target audio is played based on the speaker corresponding to the channel.
7. The method according to claim 6, characterized in that The playing of the target audio based on the speaker corresponding to the channel includes: Each of the channels is matched to the corresponding loudspeaker, and the target audio is played based on the loudspeaker, wherein the channel is matched to the loudspeaker in a manner selected in a preset mode or in a manner defined by a user.
8. A device for playing music based on instrument separation, characterized in that: include: A parsing unit, used to obtain the audio to be processed, and parse the audio to be processed to obtain the music tune corresponding to each target instrument in the audio to be processed; A replacement unit, used to replace the corresponding musical tones with musical instrument element data to obtain target audio, wherein the musical instrument element data is reference data of musical tones corresponding to different types of musical instruments; The playing unit is used to distribute the target audio to a preset number of channels for playing.
9. A vehicle, characterized in that: A device for playing music based on instrument separation as described in claim 8.
10. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 7.
11. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-7.
12. A computer program product, characterized in that The invention comprises a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 7.
