Particle processing method, device, electronic device and storage medium
By controlling the number and types of audio particles and adopting independent particle mode and lightweight particle mode, the problem of excessive resource consumption of particle synthesizers on mobile terminals is solved, and its wide application on mobile terminals is achieved.
Patent Information
- Application Number
- CN202210975427.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-15
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2042-08-15
AI Technical Summary
When used on mobile devices, existing particle synthesizers consume too much resources and cannot meet performance requirements, resulting in their inability to be widely used on mobile devices.
By controlling the number of audio particle types, using independent particle mode and lightweight particle mode, the number of particle generation types can be dynamically adjusted to reduce resource consumption.
It reduces the hardware requirements for the application platform, improves the breadth and flexibility of the application, and is suitable for both mobile and host terminals.
Smart Images

Figure CN115527546B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of audio processing technology, and in particular to a particle processing method, device, electronic device and storage medium. Background Art
[0002] Granular synthesizers are a subtype of synthesizers, commonly used in music production. Their basic principle is to chop audio material into segments ranging from 1ms to 100ms, called "granules," and then perform various other processing operations on these segments, such as pitch shifting and speed change.
[0003] The existing solution applies a particle synthesizer to the game, combined with time-controlled gameplay to achieve real-time rewind functionality. However, the particle synthesizer itself has high performance requirements. Depending on the number of particles generated each time, the cache required is very large, which cannot meet the requirements of mobile applications. Summary of the Invention
[0004] The present invention provides a particle processing method, device, electronic device and storage medium, which are used to reduce the resources consumed by particle generation by controlling the number of types of audio particles, lower the hardware requirements for the application platform, and improve the breadth and flexibility of application.
[0005] A first aspect of an embodiment of the present invention provides a particle processing method, comprising: receiving a particle processing instruction, wherein the particle processing instruction includes particle parameter information for generating initial audio particles; in response to the particle processing instruction, generating multiple initial audio particles according to a first preset mode based on a target audio material; screening the multiple initial audio particles according to the particle parameter information to obtain a target number of independent audio particles, wherein each of the independent audio particles is of a different type and the target number is less than the total number of the initial audio particles; allocating a corresponding particle cache to each independent audio particle in the target number of independent audio particles to obtain a target number of independent particle caches, wherein the independent particle cache is used to store independent audio particles of corresponding types.
[0006] A second aspect of an embodiment of the present invention provides a particle processing device, comprising: a receiving module for receiving a particle processing instruction, wherein the particle processing instruction includes particle parameter information for generating initial audio particles; a generating module for generating multiple initial audio particles according to a first preset mode based on a target audio material in response to the particle processing instruction; a screening module for screening the multiple initial audio particles according to the particle parameter information to obtain a target number of independent audio particles, wherein each of the independent audio particles is of a different type and the target number is less than the total number of the initial audio particles; an allocating module for allocating a corresponding particle cache to each independent audio particle in the target number of independent audio particles to obtain a target number of independent particle caches, wherein the independent particle caches are used to store independent audio particles of corresponding types.
[0007] A third aspect of an embodiment of the present invention provides an electronic device, comprising: a memory and at least one processor, wherein the memory stores instructions; the at least one processor calls the instructions in the memory so that the electronic device executes the above-mentioned particle processing method.
[0008] A fourth aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the above-mentioned particle processing method.
[0009] In the technical solution provided by an embodiment of the present invention, a particle processing instruction is received, wherein the particle processing instruction includes particle parameter information for generating initial audio particles; in response to the particle processing instruction, a plurality of initial audio particles are generated according to a first preset mode based on target audio material; the plurality of initial audio particles are screened according to the particle parameter information to obtain a target number of independent audio particles, wherein each independent audio particle is of a different type and the target number is less than the total number of initial audio particles; a corresponding particle cache is allocated to each independent audio particle in the target number of independent audio particles to obtain a target number of independent particle caches, wherein the independent particle caches are used to store independent audio particles of corresponding types. By controlling the number of audio particle types, the embodiments of the present invention reduce the resources consumed by particle generation, reduce the hardware requirements for the application platform, and improve the breadth and flexibility of application. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Figure 1 A schematic diagram of a particle processing method provided by one embodiment of the present invention;
[0011] Figure 2 A schematic diagram of particle types provided in one embodiment of the present invention;
[0012] Figure 3A schematic diagram of particle types provided in another embodiment of the present invention;
[0013] Figure 4 A schematic diagram of a particle processing method provided by another embodiment of the present invention;
[0014] Figure 5 A schematic diagram of a particle processing method provided by another embodiment of the present invention;
[0015] Figure 6 A schematic diagram of a particle processing method provided by another embodiment of the present invention;
[0016] Figure 7 A schematic diagram of a particle processing device provided in one embodiment of the present invention;
[0017] Figure 8 A schematic diagram of an electronic device provided according to an embodiment of the present invention. DETAILED DESCRIPTION
[0018] The present invention provides a particle processing method, device, electronic device and storage medium, which are used to reduce the resources consumed by particle generation by controlling the number of types of audio particles, lower the hardware requirements for the application platform, and improve the breadth and flexibility of application.
[0019] It is understandable that the present invention can be applied to electronic devices. As an example but not a limitation, the electronic device can be a server or a terminal, which is not limited in this application.
[0020] The terms "first," "second," "third," "fourth," and so on (if any) in the description and claims of the present invention and in the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of the present invention described herein can, for example, be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0021] While particle synthesizers inherently have high performance requirements, their performance consumption fluctuates significantly depending on the number of particles generated each time. However, because existing solutions are primarily used in console-based games, the performance consumption of particle synthesizers is not a major concern. However, optimization is required on mobile devices. This invention provides a particle processing method that can be applied simultaneously on both mobile and console platforms. It dynamically adjusts the number of generated particle types based on the needs of the application platform, reducing resource consumption.
[0022] See also Figure 1 , a flow chart of a particle processing method provided by an embodiment of the present invention, specifically including:
[0023] 101. Receive a particle processing instruction, where the particle processing instruction includes particle parameter information for generating initial audio particles.
[0024] When audio needs to be adjusted, a particle processing instruction needs to be triggered. That is, the user clicks to start particle processing in the operation interface, and the terminal processes the target audio material according to the parameters on the operation interface. Particle parameter information includes at least one of the following: particle file location information, particle duration, pitch information, particle fade-in time, particle fade-out time, the probability of particle forward or backward playback, the number of independent particles, and the particle generation rate. Among them, the particle file location information is used to indicate the starting position of audio particle creation, with a value range of 0 to 1, where 0 represents the beginning of the audio file and 1 represents the end of the audio file; the particle duration is used to indicate the duration of the audio particle in milliseconds; the pitch information is used to indicate the degree of waveform scaling of the audio particle; the particle fade-in time is used to indicate the particle startup time; the particle fade-out time is used to indicate the particle release time; the probability of particle forward or backward playback is 0 or 1, with 0 indicating backward playback and 1 indicating forward playback; the number of independent particles is used to indicate the number of particles to be reused, which is a positive integer; and the particle generation rate is used to indicate the number of particles generated per second. The time units involved in this application are uniformly milliseconds, and can also be adjusted to other time units according to actual conditions, such as seconds, which are not specifically limited here.
[0025] 102. In response to a particle processing instruction, generate a plurality of initial audio particles according to a first preset mode based on target audio material.
[0026] In response to the particle processing instruction, the target audio material is processed according to a first preset mode to generate multiple initial audio particles. The first preset mode is an independent particle mode, and the initial audio particles generated in this independent particle mode must meet the configuration parameters of the first preset mode. For example, if a playback lifecycle (i.e., the total duration of a playback event) requires the generation of 10 particles, then 10 initial audio particles are generated according to the configuration parameters of the first preset mode.
[0027] 103. Filter the multiple initial audio particles according to the particle parameter information to obtain a target number of independent audio particles, wherein each independent audio particle has a different type, and the target number is less than the total number of the initial audio particles.
[0028] When the particle parameter information includes the number of independent particles, a target number of initial audio particles is selected from multiple initial audio particles as independent audio particles based on the value of the number of independent particles. For example, if the number of initial audio particles is 10 and the number of independent particles is 2, then it is necessary to screen out 2 independent audio particles from the 10 initial audio particles. If the number of initial audio particles is 10 and the number of independent particles is 5, then it is necessary to screen out 5 independent audio particles from the 10 initial audio particles. In this application, independent audio particles are particles that need to be allocated a cache and need to be played repeatedly.
[0029] For example, if a playback lifecycle (i.e., the total duration of a playback event) requires the generation of 10 initial audio particles, a cache of 10 initial audio particles will be required to store these particles. These 10 initial audio particles are all different. To reduce cache usage, this application can limit the number of unique grains and particle generation rate. For example, if the number of unique audio particles is set to 10 and the particle generation rate is set to 10, then 10 initial audio particles will be generated in a single playback lifecycle.
[0030] 104. Allocate a corresponding particle cache to each independent audio particle in the target number of independent audio particles to obtain the target number of independent particle caches, wherein the independent particle caches are used to store independent audio particles of corresponding types.
[0031] For example, when 10 independent audio particles are screened out, these 10 independent audio particles need to allocate corresponding caches, which consumes a lot of performance. If the number of independent particles is set to 2 and the particle generation rate is set to 10, then 10 audio particles will be generated in a playback life cycle. There will only be 2 independent audio particle-sized caches to store independent audio particles, such as Figure 3 As shown in the figure, independent audio particles 1 and 2 are independent audio particles. In other words, there are only two different independent audio particles among the 10 audio particles. However, in one playback lifecycle, these two independent audio particles are each played five times. Because only the cache size of two independent audio particles is used, performance consumption is reduced.
[0032] like Figure 2As shown, when the number of independent particles is set to 10 and the particle generation rate is set to 10, then 10 audio particles will be generated in a playback life cycle, and there will only be a cache of 10 particles to store the particles, where the size of each particle cache is the same, which is sufficient to store audio particles of any size. The 10 independent audio particles are independent audio particle 1 to independent audio particle 10. When playing, they are played in the order of independent audio particle 1, independent audio particle 2, independent audio particle 3, independent audio particle 4, independent audio particle 5, independent audio particle 6, independent audio particle 7, independent audio particle 8, independent audio particle 9, and independent audio particle 10. As shown Figure 3 As shown in the figure, when the number of independent particles is set to 2 and the particle generation rate is set to 10, then 10 independent audio particles are generated in a playback life cycle. There will only be 2 independent particle-sized caches to store particles. The two independent particles are independent audio particle 1 and independent audio particle 2. When playing, they are played in the order of independent audio particle 1, independent audio particle 2, independent audio particle 1, independent audio particle 2, independent audio particle 1, independent audio particle 2, independent audio particle 1, independent audio particle 2, independent audio particle 1, independent audio particle 2, independent audio particle 1, independent audio particle 2, independent audio particle 1, and independent audio particle 2.
[0033] The embodiments of the present invention control the number of types of audio particles, thereby reducing the resources consumed by particle generation, lowering the hardware requirements for the application platform, and improving the breadth and flexibility of application.
[0034] See also Figure 4 , another flow chart of the particle processing method provided by an embodiment of the present invention, specifically including:
[0035] 401. Receive a particle processing instruction, where the particle processing instruction includes particle parameter information for generating initial audio particles.
[0036] Step 401 is similar to step 101 and will not be described again here.
[0037] 402 . In response to a particle processing instruction, determine configuration parameters of a first preset mode according to particle parameter information in the particle processing instruction.
[0038] Specifically, in response to a particle processing instruction, the particle shape characteristics of each audio particle are determined according to the pitch information, particle fade-in time, and particle fade-out time in the particle parameter information; the particle playback parameters of each audio particle are determined according to the probability of the particle playing forward or backward, the particle file position information, and the particle duration in the particle parameter information; the particle shape characteristics, particle playback parameters, the number of independent particles in the particle parameter information, and the particle generation rate corresponding to each audio particle are determined as configuration parameters of the first preset mode.
[0039] In a feasible implementation, the particle playback parameters of each audio particle are determined based on the probability of the particle playing forward or backward, the particle file position information, and the particle duration of the particle parameter information, including: determining the starting position and ending position of each audio particle based on the particle file position information and the particle duration of the particle parameter information; determining the playback direction of each audio particle based on the probability of the particle playing forward or backward in the particle parameter information; and determining the starting position, ending position, and playback direction corresponding to each audio particle as the particle playback parameters of each audio particle.
[0040] It should be noted that parameters not included in the particle parameter information can be set to default values in the first preset mode. The default values can be set according to actual conditions and are not limited here. For example, assuming that the particle parameter information does not include the particle file location information, it can be set to a default value of 0; assuming that the particle parameter information does not include the particle fade-in time, the particle fade-in time can be set to a default value of 0.01, and the particle fade-out time can be set to a value of 0.01. The default value of the particle file location information is 0, the default value of the particle duration is 0.03, the default value of the pitch information is 0, the default value of the particle fade-in time is 0.01, the default value of the particle fade-out time is 0.01, the default value of the probability of the particle playing forward or backward is 0, the default value of the number of independent particles is 0, and the default value of the particle generation rate is 10.
[0041] It can be understood that the types of parameters contained in the particle parameter information can be the same or different, and the values in the configuration parameters of the first preset mode can be the same or different. For example, the particle file position information, particle duration, particle fade-in time, particle fade-out time, probability of particle forward or backward playback, number of independent particles, and particle generation rate corresponding to two different particles are all the same, but the corresponding pitch information is different, resulting in different particle shape characteristics in the configuration parameters of the first preset mode.
[0042] 403. Process the target audio material according to the configuration parameters of the first preset mode to obtain a plurality of initial audio particles.
[0043] The target audio material is processed according to the configuration parameters of the first preset mode to obtain multiple initial audio particles, where each initial audio particle has different characteristics. For example, if initial independent audio particle 1 corresponds to a starting position of 0, an ending position of 1, a particle shape characteristic of 0, and a forward playback direction, and independent audio particle 2 corresponds to a starting position of 0, an ending position of 1, a particle shape characteristic of 0, and a reverse playback direction, then independent audio particle 1 and independent audio particle 2 are of different types.
[0044] The processing process of the target audio material is as follows: first, the starting information is obtained according to the particle file position information, and the length of each particle is determined according to the particle duration, so that the starting position and end position corresponding to the independent audio particle are obtained; then the shape of the particle is changed according to the pitch information, particle fade-in time and particle fade-out time, that is, the waveform of the audio particle is scaled; then, according to the probability of the particle playing forward or backward, it is determined whether the particle is played forward or reverse; it is determined whether the number of independent particles is less than the particle generation rate; if so, multiple initial audio particles are generated according to the number of independent particles; if not, the initial audio particles are generated according to the number of particle generation rate.
[0045] Among them, one configuration parameter corresponds to one particle type, each configuration parameter can include one or more particle parameters, and the type of each initial audio particle is different. Different types mean that the configuration parameters corresponding to each independent audio particle are not exactly the same. For example, the starting position corresponding to independent audio particle 1 is 0, the ending position is 1, the particle shape feature is 0, and the playback direction is forward. The starting position corresponding to independent audio particle 2 is 0, the ending position is 1, the particle shape feature is 0, and the playback direction is reverse. Then the types of independent audio particle 1 and independent audio particle 2 are different.
[0046] 404. Determine the number of particle types according to the number of independent particles and the value of the particle generation rate included in the particle parameter information.
[0047] It should be noted that the generation of independent audio particles is not only related to the number of independent particles, but also to the particle generation rate. The process of processing according to the first preset mode is: compare the number of independent particles contained in the particle parameter information and the value of the particle generation rate; when the number of independent particles is less than the value of the particle generation rate, the number of independent particles is determined as the number of particle types; when the number of independent particles is greater than or equal to the value of the particle generation rate, the value of the particle generation rate is determined as the number of particle types.
[0048] 405. Select a target number of initial audio particles from the multiple initial audio particles as independent audio particles to obtain a target number of independent audio particles, where the target number is the same as the number of particle types.
[0049] It should be noted that the screening method can be to select a target number of independent audio particles arbitrarily or according to preset rules, for example, the order of generation or the order of size, which is not limited in this application.
[0050] It is understandable that the greater the difference between each audio particle, the better the audio sound performance. Under the premise of meeting performance requirements, the difference between particles should be increased as much as possible.
[0051] 406. Allocate a corresponding particle cache to each independent audio particle in the target number of independent audio particles to obtain the target number of independent particle caches, wherein the independent particle caches are used to store independent audio particles of corresponding types.
[0052] Step 406 is similar to step 104 and will not be described again here.
[0053] The embodiments of the present invention control the number of audio particle types and allocate corresponding caches for independent audio particles, thereby reducing the number of independent particles that need to be cached, reducing the cache resources consumed by particle generation, lowering the hardware requirements for the application platform, and improving the breadth and flexibility of applications.
[0054] See also Figure 5 , another flow chart of the particle processing method provided by an embodiment of the present invention, specifically including:
[0055] 501. Receive a particle processing instruction, where the particle processing instruction includes particle parameter information for generating initial audio particles.
[0056] 502. In response to a particle processing instruction, determine configuration parameters of a first preset mode according to particle parameter information in the particle processing instruction.
[0057] 503. Process the target audio material according to the configuration parameters of the first preset mode to obtain a plurality of initial audio particles.
[0058] 504. Determine the number of particle types according to the number of independent particles and the value of the particle generation rate included in the particle parameter information.
[0059] 505. Select a target number of initial audio particles from the multiple initial audio particles as independent audio particles to obtain a target number of independent audio particles, where the target number is the same as the number of particle types.
[0060] 506. Allocate a corresponding particle cache to each independent audio particle in the target number of independent audio particles to obtain the target number of independent particle caches, wherein the independent particle caches are used to store independent audio particles of corresponding types.
[0061] Steps 501-506 are similar to steps 401-406 and are not described again here.
[0062] 507. Determine the number of times each independent audio particle is played, where the total number of times each independent audio particle is played is equal to the total number of initial audio particles.
[0063] It should be noted that multiple independent audio particles can be combined as needed to determine the number of times and order in which each independent audio particle is played. The sum of the number of times each independent audio particle is played is equal to the total number of initial audio particles. The number of times played can also be called the number of reads. This application uses the number of times played as an example for explanation.
[0064] 508. In response to the audio play instruction, read the independent audio particles from the independent particle cache for play.
[0065] It should be noted that the playback of all independent audio particles is completed according to the playback times and playback order of each independent audio particle.
[0066] It should be noted that, before step 501, the process also includes: converting the initial audio material through a preset middleware to obtain a first intermediate format audio or a second intermediate format audio; converting the first intermediate format audio or the second intermediate format audio into a target format to obtain a first target format audio or a second target format audio; and determining the first target format audio or the second target format audio as the target audio material.
[0067] For example, the pre-installed middleware Wwise converts the WAV format into the Vorbis format or the AdPacM format according to the game capacity limit, and then converts the Vorbis format or the AdPacM format into the Pulse-Code Modulation (PCM) format. After transcoding the initial audio material, the target audio material consistent with other audio resources is obtained, ensuring the uniformity of the audio format and improving processing efficiency.
[0068] It is understandable that the target format can be PCM format or other audio formats, which are not specifically limited here. In this application, the PCM format is used as an example for explanation. Because the PCM format is an uncompressed format, it does not require decompression and places less burden on the CPU. Therefore, converting the initial audio material into the PCM format reduces the burden on the CPU and reduces resource consumption. The format conversion process is defined, and after the initial audio material is transcoded, the target audio material consistent with the format of other audio resources is obtained, which clarifies the preprocessing process of the audio material, ensures the uniformity of the audio resources, and improves the efficiency of generating audio particles.
[0069] The embodiments of the present invention control the number of audio particle types and allocate corresponding independent particle caches for independent audio particles, thereby reducing the number of independent particles that need to be cached, reducing the cache resources consumed by particle generation, lowering the hardware requirements for the application platform, and improving the breadth and flexibility of applications.
[0070] See also Figure 6, another flow chart of the particle processing method provided by an embodiment of the present invention, specifically including:
[0071] 601. Receive a particle processing instruction, where the particle processing instruction includes particle parameter information for generating initial audio particles.
[0072] 602. In response to the particle processing instruction, generate a plurality of initial audio particles according to a first preset mode based on the target audio material.
[0073] 603. Filter the multiple initial audio particles according to the particle parameter information to obtain a target number of independent audio particles, where each independent audio particle is of a different type and the target number is less than the total number of the initial audio particles.
[0074] 604. Allocate a corresponding particle cache to each independent audio particle in the target number of independent audio particles to obtain the target number of independent particle caches, wherein the independent particle caches are used to store independent audio particles of corresponding types.
[0075] Steps 601-604 are similar to steps 101-104 and are not repeated here.
[0076] 605. In response to the particle processing instruction, generate a plurality of lightweight audio particles according to the target audio material in accordance with a second preset mode.
[0077] The second preset mode is lightweight particle mode. When this mode is enabled, no cache is allocated for the generated particles. Instead, the system directly reads the particle parameter information corresponding to the target audio material and generates lightweight audio particles in real time, reducing cache consumption. In this application, lightweight audio particles are particles that do not require cache allocation and do not need to be played repeatedly.
[0078] Specifically, the particle parameter information in the particle processing instruction is parsed to obtain the particle file position information, particle duration, pitch information, particle fade-in time, particle fade-out time, probability of particle forward or backward playback, number of independent particles and particle generation rate corresponding to each audio particle; the starting position and end position of each audio particle are determined according to the particle file position information and particle duration; the playback direction of each audio particle is determined according to the probability of the particle forward or backward playback, and the playback direction is forward playback or reverse playback; the waveform of each audio particle is scaled according to the particle fade-in time, particle fade-out time and pitch information to obtain the particle shape characteristics of each audio particle; the particle generation rate and the starting position, end position, playback direction and particle shape characteristics corresponding to each audio particle are determined as the configuration parameters of the second preset mode; the target audio material is used to generate multiple lightweight audio particles in real time according to the configuration parameters of the second preset mode, and a counter is assigned to each lightweight audio particle, and the counter is used to control the fade-in and fade-out time of each lightweight particle.
[0079] For example, first obtain the starting information based on the particle file position information, and then determine whether the particle is played forward or backward based on the probability of the particle playing forward or backward; then adjust the shape of the particle based on the pitch information, particle fade-in time, and particle fade-out time, that is, scale the audio waveform to obtain the particle shape characteristics; generate multiple audio particles in real time according to the particle generation rate, and assign a counter to each particle (that is, each particle is equipped with a Counter variable).
[0080] When lightweight audio particles and independent audio particles are used in combination, the total number of times the independent audio particles are played is less than the total number of initial audio particles.
[0081] 606. Play the multiple lightweight audio particles in real time according to the starting position, ending position, play direction, counter, particle duration, particle fade-in time, and particle fade-out time corresponding to each lightweight audio particle.
[0082] Multiple lightweight audio particles are generated and played in real time according to the starting position, playback direction, counter, particle duration, particle fade-in time, and particle fade-out time corresponding to each audio particle. When playback starts, the Counter starts calculating and a fade-in effect occurs. The fade-out start time is calculated based on the particle duration and particle fade-out time. When the Counter reaches the fade-out start time, a fade-out effect occurs. Finally, when the Counter equals the particle storage time, the particle playback ends and the Counter is reset.
[0083] This embodiment provides two particle processing modes, independent particle mode and lightweight particle mode. The lightweight particle mode can significantly reduce memory usage, but it will fix the file position parameters, that is, the starting position of each particle is the same, which reduces the difference between particles, reduces memory consumption, and also reduces sound performance. The independent particle mode directly controls the type of independent particles, and reduces the cache consumption of the particle synthesizer by reusing independent particles. The specific processing mode can be selected according to the actual usage, that is, the hardware conditions of the application platform. Because the memory consumption difference between the lightweight particle mode and the independent particle mode can be up to about 10 times, under the premise of meeting performance requirements, the difference between particles is increased as much as possible, that is, the number of particle types is increased as much as possible. This embodiment provides an additional processing mode for reducing resource consumption, which saves more cache resources than the independent particle mode.
[0084] It should be noted that the particles generated by lightweight particle mode and independent particle mode, in addition to the performance differences, also have different sounds due to different processing methods. It is necessary to confirm whether the lightweight particle mode meets the performance and listening requirements. If so, the lightweight particle mode can be used because it consumes fewer resources than the independent particle mode.
[0085] In an embodiment of the present invention, the number of audio particle types is controlled through an independent particle mode, thereby reducing the resources consumed by particle generation, lowering the hardware requirements for the application platform, and improving the breadth and flexibility of application. In addition, a lightweight particle mode is used for real-time particle generation and playback, which reduces cache usage and improves particle processing efficiency.
[0086] The particle processing method according to the embodiment of the present invention is described above. The particle processing device according to the embodiment of the present invention is described below. Figure 7 , an embodiment of the particle processing device in the embodiment of the present invention includes:
[0087] A receiving module 701 is configured to receive a particle processing instruction, wherein the particle processing instruction includes particle parameter information for generating initial audio particles;
[0088] A first generating module 702 is configured to generate a plurality of initial audio particles according to a first preset mode based on target audio material in response to the particle processing instruction;
[0089] a screening module 703, configured to screen the plurality of initial audio particles according to the particle parameter information to obtain a target number of independent audio particles, wherein each independent audio particle is of a different type and the target number is less than the total number of the initial audio particles;
[0090] The allocating module 704 is configured to allocate a corresponding particle cache to each independent audio particle in the target number of independent audio particles, thereby obtaining the target number of independent particle caches, wherein the independent particle caches are used to store independent audio particles of corresponding types.
[0091] In a feasible implementation, the screening module 703 includes:
[0092] A first determining unit 7031 is configured to determine the number of particle types according to the number of independent particles and the value of the particle generation rate included in the particle parameter information;
[0093] The selection unit 7032 is configured to select a target number of initial audio particles from the multiple initial audio particles as independent audio particles to obtain a target number of independent audio particles, where the target number is the same as the number of particle types.
[0094] In a feasible implementation manner, the determining unit 7031 is specifically configured to:
[0095] Comparing the values of the number of independent particles and the particle generation rate included in the particle parameter information;
[0096] When the number of independent particles is less than the value of the particle generation rate, determining the number of independent particles as the number of particle types;
[0097] When the number of independent particles is greater than or equal to the value of the particle generation rate, the value of the particle generation rate is determined as the number of particle types.
[0098] In a feasible implementation manner, the first generating module 702 includes:
[0099] A second determining unit 7021 is configured to determine, in response to the particle processing instruction, configuration parameters of the first preset mode according to particle parameter information in the particle processing instruction;
[0100] The processing unit 7022 is configured to process the target audio material according to the configuration parameters of the first preset mode to obtain a plurality of initial audio particles.
[0101] In a feasible implementation manner, the particle parameter information includes at least one of the following:
[0102] Particle file position information, particle duration, pitch information, particle fade-in time, particle fade-out time, probability of particle playing forward or backward, number of independent particles, and particle generation rate.
[0103] In a feasible implementation manner, the configuration parameter includes at least one of the following:
[0104] The starting position of each audio particle, the ending position of each audio particle, the particle shape characteristics of each audio particle, the playback direction of each audio particle, the number of independent particles, and the particle generation rate.
[0105] In a feasible implementation manner, the second determining unit 7021 includes:
[0106] A first determining subunit 70211 is configured to determine a particle shape feature of each audio particle according to the pitch information, the particle fade-in time, and the particle fade-out time in the particle parameter information;
[0107] The second determining subunit 70212 is configured to determine the particle playback parameters of each audio particle according to the probability of the particle being played forward or backward, the particle file position information, and the particle duration of the particle parameter information;
[0108] The third determining subunit 70213 is used to determine the particle shape characteristics, particle playback parameters, the number of independent particles in the particle parameter information, and the particle generation rate corresponding to each audio particle as configuration parameters of the first preset mode.
[0109] In a feasible implementation manner, the second determining subunit 70212 is specifically configured to:
[0110] Determine the starting position and ending position of each audio particle according to the particle file position information and the particle duration of the particle parameter information;
[0111] Determining the playback direction of each audio particle according to the probability of the particle playing forward or backward in the particle parameter information;
[0112] The starting position, ending position, and playback direction corresponding to each audio particle are determined as the particle playback parameters of each audio particle.
[0113] In a feasible embodiment, the particle processing device further includes:
[0114] The determination module 705 is configured to determine the number of times each of the independent audio particles is played, wherein the sum of the number of times each of the independent audio particles is played is equal to the total number of the initial audio particles.
[0115] In a feasible embodiment, the particle processing device further includes:
[0116] The first playing module 706 is configured to respond to an audio playing instruction and read independent audio particles from the independent particle buffer for playing.
[0117] In a feasible embodiment, the particle processing device further includes:
[0118] The second generating module 707 is configured to generate a plurality of lightweight audio particles according to a second preset mode based on the target audio material in response to the particle processing instruction.
[0119] In a feasible implementation manner, the second generating module 707 is specifically configured to:
[0120] Parsing the particle parameter information in the particle processing instruction to obtain particle file location information, particle duration, pitch information, particle fade-in time, particle fade-out time, probability of particle forward or backward playback, number of independent particles, and particle generation rate corresponding to each audio particle;
[0121] Determine the starting position and the ending position of each audio particle according to the particle file position information and the particle duration;
[0122] Determining a playback direction of each audio particle according to a probability of the particle playing forward or backward, wherein the playback direction is forward playback or reverse playback;
[0123] Scaling the waveform of each audio particle according to the particle fade-in time, the particle fade-out time, and the pitch information to obtain a particle shape feature of each audio particle;
[0124] Determining the particle generation rate and the starting position, ending position, playback direction, and particle shape characteristics corresponding to each audio particle as configuration parameters of the second preset mode;
[0125] The target audio material is used to generate multiple lightweight audio particles in real time according to the configuration parameters of the second preset mode, and a counter is allocated to each lightweight audio particle, where the counter is used to control the fade-in and fade-out time of each lightweight particle.
[0126] In a feasible embodiment, the particle processing device further includes:
[0127] The second playing module 708 is configured to play the plurality of lightweight audio particles in real time according to the starting position, ending position, playing direction, counter, particle duration, particle fade-in time, and particle fade-out time corresponding to each lightweight audio particle.
[0128] In an embodiment of the present invention, the number of audio particle types is controlled through an independent particle mode, thereby reducing the resources consumed by particle generation, lowering the hardware requirements for the application platform, and improving the breadth and flexibility of application. In addition, a lightweight particle mode is used for real-time particle generation and playback, which reduces cache usage and improves particle processing efficiency.
[0129] Figure 8 FIG2 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. The electronic device 800 may vary significantly due to different configurations or performance. The device may include one or more central processing units (CPUs) 810 (e.g., one or more processors), a memory 820, and one or more storage media 830 (e.g., one or more mass storage devices) storing application programs 833 or data 832. The memory 820 and storage medium 830 may be either transient or persistent storage. The program stored in the storage medium 830 may include one or more modules (not shown), each of which may include a series of instruction operations on the electronic device 800. Furthermore, the processor 810 may be configured to communicate with the storage medium 830 to execute the series of instruction operations in the storage medium 830 on the electronic device 800.
[0130] The electronic device 800 may further include one or more power supplies 840, one or more wired or wireless network interfaces 850, one or more input and output interfaces 860, and / or one or more operating devices 831, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc. It will be understood by those skilled in the art that Figure 8 The structure of the electronic device shown does not limit the electronic device and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0131] By way of example and not limitation, electronic device 800 may be a server or a terminal.
[0132] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. The computer-readable storage medium stores instructions, which, when executed on a computer, cause the computer to execute the steps of the particle processing method.
[0133] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0134] In addition, in the description of the embodiments of the present invention, unless otherwise expressly specified or limited, the terms "mounted," "connected," and "connected" should be understood in a broad sense. For example, they may refer to fixed connections, detachable connections, or integral connections; they may refer to mechanical connections or electrical connections; they may refer to direct connections or indirect connections through an intermediate medium; and they may refer to internal communication between two components. Those skilled in the art will understand the specific meanings of the above terms in the present invention based on the specific circumstances.
[0135] If the functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the portion that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage media include various media capable of storing program code, such as USB flash drives, mobile hard drives, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical disks.
[0136] In the description of the present invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicating orientations or positional relationships, are based on the orientations or positional relationships shown in the accompanying drawings and are intended solely to facilitate and simplify the description of the present invention. They are not intended to indicate or imply that the devices or components referred to must have, be constructed, or operate in a specific orientation, and therefore should not be construed as limitations on the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0137] Finally, it should be noted that the above embodiments are only specific implementation methods of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that any person skilled in the art can modify or easily conceive of changes to the technical solutions described in the above embodiments within the technical scope disclosed by the present invention, or replace some of the technical features therein with equivalents. Such modifications, changes or replacements do not deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.
Claims
1. A particle processing method, characterized in that: include: receiving a particle processing instruction, wherein the particle processing instruction includes particle parameter information for generating initial audio particles; In response to the particle processing instruction, generating a plurality of initial audio particles according to a first preset mode based on the target audio material; screening the plurality of initial audio particles according to the particle parameter information to obtain a target number of independent audio particles, wherein each of the independent audio particles is of a different type and the target number is less than the total number of the initial audio particles; A corresponding particle cache is allocated to each independent audio particle in the target number of independent audio particles to obtain a target number of independent particle caches, wherein the independent particle caches are used to store independent audio particles of corresponding types.
2. The particle processing method according to claim 1, characterized in that The screening of the plurality of initial audio particles according to the particle parameter information to obtain a target number of independent audio particles includes: Determining the number of particle types according to the number of independent particles and the value of the particle generation rate included in the particle parameter information; A target number of initial audio particles is selected from the multiple initial audio particles as independent audio particles to obtain a target number of independent audio particles, where the target number is the same as the number of particle types.
3. The particle processing method according to claim 2, characterized in that: The determining the number of particle types according to the number of independent particles and the value of the particle generation rate included in the particle parameter information includes: Comparing the values of the number of independent particles and the particle generation rate included in the particle parameter information; When the number of independent particles is less than the value of the particle generation rate, determining the number of independent particles as the number of particle types; When the number of independent particles is greater than or equal to the value of the particle generation rate, the value of the particle generation rate is determined as the number of particle types.
4. The particle processing method according to claim 1, characterized in that The step of generating a plurality of initial audio particles according to a first preset mode based on the target audio material in response to the particle processing instruction includes: In response to the particle processing instruction, determining configuration parameters of a first preset mode according to particle parameter information in the particle processing instruction; The target audio material is processed according to the configuration parameters of the first preset mode to obtain a plurality of initial audio particles.
5. The particle processing method according to claim 4, characterized in that: The particle parameter information includes at least one of the following: Particle file position information, particle duration, pitch information, particle fade-in time, particle fade-out time, probability of particle playing forward or backward, number of independent particles, and particle generation rate.
6. The particle processing method according to claim 4, characterized in that: The configuration parameters include at least one of the following: The starting position of each audio particle, the ending position of each audio particle, the particle shape characteristics of each audio particle, the playback direction of each audio particle, the number of independent particles, and the particle generation rate.
7. The particle processing method according to claim 4, characterized in that: The determining of the configuration parameters of the first preset mode according to the particle parameter information in the particle processing instruction includes: Determine the particle shape characteristics of each audio particle according to the pitch information, the particle fade-in time, and the particle fade-out time in the particle parameter information; Determine a particle playback parameter for each audio particle according to the probability of the particle being played forward or backward, the particle file position information, and the particle duration of the particle parameter information; The particle shape characteristics, particle playback parameters, the number of independent particles in the particle parameter information, and the particle generation rate corresponding to each audio particle are determined as configuration parameters of the first preset mode.
8. The particle processing method according to claim 7, characterized in that: The determining of the particle playback parameters of each audio particle according to the probability of the particle playing forward or backward, the particle file position information, and the particle duration of the particle parameter information includes: Determine the starting position and ending position of each audio particle according to the particle file position information and the particle duration of the particle parameter information; Determining the playback direction of each audio particle according to the probability of the particle playing forward or backward in the particle parameter information; The starting position, ending position, and playback direction corresponding to each audio particle are determined as the particle playback parameters of each audio particle.
9. The particle processing method according to claim 1, wherein: The method further comprises: The number of times each of the independent audio particles is played is determined, wherein the sum of the number of times each of the independent audio particles is played is equal to the total number of the initial audio particles.
10. The particle processing method according to claim 1, wherein: The method further comprises: In response to the audio play instruction, independent audio particles are read from the independent particle buffer for playing.
11. The particle processing method according to any one of claims 1 to 4, characterized in that: The method further comprises: In response to the particle processing instruction, a plurality of lightweight audio particles are generated according to a second preset mode based on the target audio material.
12. The particle processing method according to claim 11, characterized in that: The step of generating a plurality of lightweight audio particles according to a second preset mode based on the target audio material in response to the particle processing instruction includes: Parsing the particle parameter information in the particle processing instruction to obtain particle file location information, particle duration, pitch information, particle fade-in time, particle fade-out time, probability of particle forward or backward playback, number of independent particles, and particle generation rate corresponding to each audio particle; Determine the starting position and the ending position of each audio particle according to the particle file position information and the particle duration; Determining a playback direction of each audio particle according to a probability of the particle playing forward or backward, wherein the playback direction is forward playback or reverse playback; Scaling the waveform of each audio particle according to the particle fade-in time, the particle fade-out time, and the pitch information to obtain a particle shape feature of each audio particle; Determining the particle generation rate and the starting position, ending position, playback direction, and particle shape characteristics corresponding to each audio particle as configuration parameters of the second preset mode; The target audio material is used to generate multiple lightweight audio particles in real time according to the configuration parameters of the second preset mode, and a counter is allocated to each lightweight audio particle, where the counter is used to control the fade-in and fade-out time of each lightweight particle.
13. The particle processing method according to claim 12, characterized in that: After generating a plurality of lightweight audio particles in real time from the target audio material according to the configuration parameters of the second preset mode and assigning a counter to each lightweight audio particle, the method further includes: The plurality of lightweight audio particles are played in real time according to the starting position, ending position, playing direction, counter, particle duration, particle fade-in time, and particle fade-out time corresponding to each lightweight audio particle.
14. A particle processing device, characterized in that: include: A receiving module, configured to receive a particle processing instruction, wherein the particle processing instruction includes particle parameter information for generating initial audio particles; a generating module, configured to generate a plurality of initial audio particles according to a first preset mode based on target audio material in response to the particle processing instruction; a screening module, configured to screen the plurality of initial audio particles according to the particle parameter information to obtain a target number of independent audio particles, wherein each of the independent audio particles is of a different type and the target number is less than the total number of the initial audio particles; An allocation module is configured to allocate a corresponding particle cache to each independent audio particle in the target number of independent audio particles, thereby obtaining a target number of independent particle caches, wherein the independent particle caches are used to store independent audio particles of corresponding types.
15. An electronic device, characterized in that: The electronic device includes: a memory and at least one processor, wherein instructions are stored in the memory, and the memory and the at least one processor are interconnected via a line; The at least one processor calls the instructions in the memory to enable the electronic device to execute the particle processing method according to any one of claims 1 to 13.
16. A computer-readable storage medium, characterized in that The computer-readable storage medium stores instructions, and when the instructions are executed by a processor, the particle processing method according to any one of claims 1 to 13 is implemented.
Citation Information
Patent Citations
Video dynamic editing method and device and intelligent mobile terminal
CN108038185A
Sound particle synthesis method and device
CN111798831A