Audio signal amplification processing method and device, electronic equipment and storage medium
By dividing the audio signal into fixed blocks and determining the interpolation coefficient according to the block characteristics for amplification, the noise problem during the amplification process of audio signal is solved, and the gradual transition of sound and the improvement of computing efficiency is achieved.
Patent Information
- Application Number
- CN202411007508.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-25
- Publication Date
- 2024-11-22
AI Technical Summary
During the audio signal amplification process, the attack time and release time settings of the compressor in the prior art are unreasonable, resulting in untimely suppression of sound and introducing noise.
The audio signal is divided into multiple fixed blocks according to the preset length, and the block interpolation coefficient is determined according to the block characteristics of the current block and the next block, and the target element is amplified to avoid the introduction of noise.
Through block processing and determination of block interpolation coefficients, the gradual transition of sound is achieved without exposure, reducing CPU load, improving computing efficiency, reducing delay, and avoiding the introduction of noise.
Smart Images

Figure CN119010816A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of audio processing technology, and in particular to an audio signal amplification processing method, device, electronic device and storage medium. Background Art
[0002] For the amplification of audio signals, it is generally necessary to add a compressor control after the gain. In a typical compressor design, it is necessary to control processing parameters such as attack time and release time. Attack time refers to the time required from the level of the audio signal exceeding the set threshold to the time when the compressor starts to reduce the gain of the signal. Release time refers to the time required for the compressor to stop reducing the gain of the signal after the level of the audio signal falls below the set threshold. Therefore, there is a certain delay in the processing of the sound through the compressor control process, which may not suppress the sound in time and introduce noise. Summary of the invention
[0003] The present application provides an audio signal amplification processing method, device, electronic device and storage medium to solve the problem of how to avoid introducing noise during the audio signal amplification processing.
[0004] In a first aspect, the present application provides an audio signal amplification processing method, the method comprising:
[0005] Divide the audio signal into a plurality of fixed blocks according to a preset length;
[0006] Obtaining a block feature corresponding to each of the fixed blocks;
[0007] Determining a block interpolation coefficient of the current fixed block according to a block feature of the current fixed block and a block feature of a next fixed block of the current fixed block;
[0008] Based on the block interpolation coefficient, a target element included in the current fixed block is enlarged.
[0009] Optionally, obtaining a block feature corresponding to each of the fixed blocks includes:
[0010] Get the preset gain threshold;
[0011] Obtaining a maximum value of target elements included in the fixed block;
[0012] A block feature corresponding to the fixed block is determined according to the maximum value of the target element and the gain threshold.
[0013] Optionally, determining a block feature corresponding to the fixed block according to the maximum value of the target element and the gain threshold includes:
[0014] If the absolute value of the maximum value of the target element is greater than the gain threshold, the absolute value of the maximum value of the target element is used as the block feature of the fixed block;
[0015] If the absolute value of the maximum value of the target element is less than or equal to the gain threshold, zero is used as the block feature of the fixed block.
[0016] Optionally, obtaining a preset gain threshold includes:
[0017] Get the preset amplification peak and gain parameters;
[0018] Determine the amplification factor according to the gain parameter;
[0019] The quotient of the amplification peak value and the amplification factor is used as the preset gain threshold.
[0020] Optionally, determining a block interpolation coefficient of the current fixed block according to a block feature of the current fixed block and a block feature of a next fixed block of the current fixed block includes:
[0021] Get the preset initial interpolation coefficient;
[0022] If the block feature of the current fixed block is zero and the block feature of the next fixed block is zero, determining that the block interpolation coefficient of the current fixed block is equal to the magnification;
[0023] If the block feature of the current fixed block is smaller than the block feature of the next fixed block, determining the block interpolation coefficient of the current fixed block as the quotient of the amplified peak value and the block feature of the next fixed block;
[0024] If the block characteristic of the current fixed block is greater than the block characteristic of the next fixed block, the block interpolation coefficient of the current fixed block is determined to be the initial interpolation coefficient.
[0025] Optionally, enlarging the target element included in the current fixed block based on the block interpolation coefficient includes:
[0026] Get the preset initial interpolation coefficient;
[0027] Determine a target element interpolation coefficient corresponding to each target element of the current fixed block according to the block interpolation coefficient and the initial interpolation coefficient;
[0028] Performing a magnification process on the target element based on the target element interpolation coefficient;
[0029] The current fixed block that has completed the magnification process is added to the renderer.
[0030] Optionally, after adding the current fixed block that has completed the magnification process to the renderer, the method further includes:
[0031] The block interpolation coefficient of the current fixed block is used as an initial interpolation coefficient of a next fixed block of the current fixed block.
[0032] In a second aspect, the present application provides an audio signal amplification processing device, the device comprising:
[0033] A segmentation module, used for dividing the audio signal into a plurality of fixed blocks according to a preset length;
[0034] An acquisition module, used for acquiring a block feature corresponding to each of the fixed blocks;
[0035] A determination module, configured to determine a block interpolation coefficient of the current fixed block according to a block feature of the current fixed block and a block feature of a next fixed block of the current fixed block;
[0036] The enlargement module is used to enlarge the target element included in the current fixed block based on the block interpolation coefficient.
[0037] In a third aspect, the present application provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;
[0038] Memory, used to store computer programs;
[0039] The processor is used to implement the audio signal amplification processing method described in any embodiment of the first aspect when executing the program stored in the memory.
[0040] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the audio signal amplification processing method as described in any one of the embodiments of the first aspect is implemented.
[0041] The above technical solution provided by the embodiment of the present application has the following advantages over the prior art: the method provided by the embodiment of the present application divides the audio signal into multiple fixed blocks according to a preset length; obtains the block features corresponding to each of the fixed blocks; determines the block interpolation coefficient of the current fixed block according to the block features of the current fixed block and the block features of the next fixed block of the current fixed block; and amplifies the target elements included in the current fixed block based on the block interpolation coefficient. This method divides the audio signal into fixed blocks, determines the block interpolation coefficient of the current fixed block based on the block features of the current fixed block and the block features of the next fixed block, and then amplifies the target elements included in the current fixed block based on the block interpolation coefficient, so that the sound gradually transitions without overexposure, thereby avoiding the introduction of noise. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0043] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0044] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0045] Figure 1 A flowchart of an audio signal amplification processing method provided by one embodiment of the present application;
[0046] Figure 2 A schematic flow chart of an audio signal amplification processing method provided by another embodiment of the present application;
[0047] Figure 3 A schematic diagram of the structure of an audio signal amplification processing device provided by one embodiment of the present application;
[0048] Figure 4 A schematic diagram of the structure of an electronic device provided in accordance with an embodiment of the present application. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0050] The disclosure below provides many different embodiments or examples to realize the different structures of the present application. In order to simplify the disclosure of the present application, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present application. In addition, the application can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.
[0051] In order to solve the technical problem of how to avoid introducing noise during audio signal amplification processing in the prior art, the present application provides an audio signal amplification processing method, device, electronic device and storage medium, which can divide the audio signal into fixed blocks, determine the block interpolation coefficient of the current fixed block based on the block characteristics of the current fixed block and the block characteristics of the next fixed block, and then amplify the target elements included in the current fixed block based on the block interpolation coefficient, so that the sound gradually transitions without overexposure, thereby avoiding the introduction of noise.
[0052] The first embodiment of the present application provides an audio signal amplification processing method, such as Figure 1 , the audio signal amplification processing method comprises:
[0053] Step 101: divide the audio signal into a plurality of fixed blocks according to a preset length.
[0054] In a typical audio rendering, the compressed audio data is first decoded into pulse code modulation PCM (Pulse Code Modulation) data by a decoder, and then the PCM data is added to the audio renderer. In this embodiment, the audio signal can be the decoded PCM data. In order to avoid the introduction of noise in the audio signal amplification process, the decoded PCM data is not directly added to the audio renderer, but the PCM data is subjected to a sound amplification post-processing, and then the post-processed data is added to the audio renderer. The audio signal amplification processing method is the process of the sound amplification post-processing. Among them, during post-processing, the PCM data is first divided into multiple fixed blocks according to a preset length. The length of the fixed blocks is the same, all of which are preset lengths, such as a length of N elements, and the number of N is not limited, and can be 500, 1000, 1024, etc., which is not limited in the embodiment of the present application. It should be noted that the delay is related to the size of the fixed block of the block. The shorter the length of N, the smaller the delay, and the longer the length of N, the larger the delay. The length of N can be selected as needed.
[0055] Step 102: Obtain the block feature corresponding to each fixed block.
[0056] In one embodiment, obtaining a block feature corresponding to each fixed block includes: obtaining a preset gain threshold; obtaining a maximum value of a target element included in the fixed block; and determining the block feature corresponding to the fixed block according to the maximum value of the target element and the gain threshold.
[0057] In this embodiment, a preset gain threshold threshold can be first obtained, each fixed block includes N target elements, the maximum value of the N target elements included in the fixed block is obtained, and the block feature corresponding to the fixed block is determined based on the maximum value of the target element and the gain threshold.
[0058] In one embodiment, obtaining a preset gain threshold includes: obtaining a preset amplification peak value and a gain parameter; determining an amplification factor according to the gain parameter; and using a quotient of the amplification peak value and the amplification factor as the preset gain threshold.
[0059] In this embodiment, the amplification peak value peak (that is, the maximum value allowed for sound amplification) and the gain parameter gain dB can be set during initialization, and the initial interpolation coefficient interpolation0 can be set to 1.0. The amplification factor gain_scale is determined according to the gain parameter gain. Specifically, the amplification factor gain_scale=10 gain / 20 , then the gain threshold (maximum value of gain) is equal to the quotient of the amplification peak value and the amplification factor, that is, threshold = peak / gain_scale.
[0060] In one embodiment, a block feature corresponding to a fixed block is determined based on a maximum value of a target element and a gain threshold, including: if the absolute value of the maximum value of the target element is greater than the gain threshold, the absolute value of the maximum value of the target element is used as the block feature of the fixed block; if the absolute value of the maximum value of the target element is less than or equal to the gain threshold, zero is used as the block feature of the fixed block.
[0061] In this embodiment, the block feature acquisition method includes: firstly dividing the decoded PCM data into N fixed-length blocks x(n) {x0, x1, x2...x i ,...x N-1}, each element x i Take the absolute value y(n){abs(x0), abs(x1), abs(x2)...abs(x i ), ... abs(x N-1 )}, get the maximum value y of y(n) max If y max >threshold, the block feature feature of the current fixed block is stored as y max , otherwise the block feature is 0.
[0062] Step 103: determining a block interpolation coefficient of the current fixed block according to the block feature of the current fixed block and the block feature of the next fixed block of the current fixed block.
[0063] The block feature of the current fixed block can be called feature cur , the block feature of the next fixed block of the current fixed block can be called feature next , read the current fixed block and the next fixed block of the current fixed block, and get the block feature feature of the current fixed block cur and the block feature feature of the next fixed block of the current fixed block next, according to feature cur and feature next The block interpolation decision of the current fixed block can be made, that is, according to the feature cur and feature next Determine the block interpolation coefficient interpolation1 of the current fixed block.
[0064] In one embodiment, determining the block interpolation coefficient of the current fixed block according to the block feature of the current fixed block and the block feature of the next fixed block of the current fixed block includes:
[0065] Get the preset initial interpolation coefficient;
[0066] If the block feature of the current fixed block is zero and the block feature of the next fixed block is zero, determining that the block interpolation coefficient of the current fixed block is equal to the magnification factor;
[0067] If the block feature of the current fixed block is smaller than the block feature of the next fixed block, determining the block interpolation coefficient of the current fixed block as the quotient of the amplified peak value and the block feature of the next fixed block;
[0068] If the block characteristic of the current fixed block is greater than the block characteristic of the next fixed block, the block interpolation coefficient of the current fixed block is determined as the initial interpolation coefficient.
[0069] In this embodiment, the preset initial interpolation coefficient interpolation0 can be set to 1.0. cur The block feature feature is zero and the next fixed block next is zero, then the interpolation coefficient interpolation1 of the current fixed block is determined to be equal to the magnification gain_scale; if the block feature feature of the current fixed block cur Block feature smaller than the next fixed block next , then the block interpolation coefficient interpolation1 of the current fixed block is determined as the quotient of the amplified peak value and the block feature of the next fixed block, that is, interpolation1 = peak / feature next ; If the block feature feature of the current fixed block cur Block feature that is larger than the next fixed block next , then determine the block interpolation coefficient interpolation1 of the current fixed block as the initial interpolation coefficient interpolation0.
[0070] Specifically, if the peak value of the amplification is set to 10000, and the amplification factor gain_scale is calculated to be 5 times, then the gain threshold = peak / gain_scale = 2000. If the absolute value of the maximum value of the elements contained in the current fixed block exceeds 2000, it is marked as the block feature of the current fixed block. For example, the block feature of the current fixed block can be 0, and the block feature of the next fixed block can be 5000. If the block feature of the next fixed block is 5000, the block interpolation coefficient of the current fixed block is interpolation1 = peak / feature next =2.
[0071] Optionally, the block feature feature of the current fixed block cur Block feature smaller than the next fixed block next , including the block feature feature of the current fixed block cur Equal to 0 and feature next Not equal to 0, including feature cur and feature next None of them are equal to 0, but feature cur <feature next The block feature of the current fixed block is cur Block feature that is larger than the next fixed block next , including the block feature feature of the current fixed block cur Not equal to 0 and feature next When it is equal to 0, it also includes feature cur and feature next None of them are equal to 0, but feature cur >feature next situation.
[0072] Step 104: enlarge the target element included in the current fixed block based on the block interpolation coefficient.
[0073] This method divides the audio signal into fixed blocks, determines the block interpolation coefficient of the current fixed block based on the block characteristics of the current fixed block and the block characteristics of the next fixed block, and then amplifies the target elements included in the current fixed block based on the block interpolation coefficient, so that the sound gradually transitions without overexposure, thereby avoiding the introduction of noise.
[0074] In this embodiment, parameter control of the traditional compressor such as attack_time and release_time is not required. The calculation only uses a simple size comparison, which improves calculation efficiency, reduces CPU load, and solves the problem of the sound not being able to be suppressed quickly with a lower delay. The delay is related to the size of the block. The lower the length, the smaller the delay.
[0075] The method of the embodiment of the present application is intended to solve the problem that the typical compressor may set the attack time and release time unreasonably, resulting in untimely suppression and the introduction of noise. In this embodiment, the decoded audio PCM data is divided into fixed blocks, and the gain is determined based only on the peak characteristics of the current block and the next block to determine the interpolation logic, and finally the processed data is added to the renderer to allow the sound to gradually transition without overexposure.
[0076] Optionally, the target elements included in the current fixed block may be uniformly enlarged based on the block interpolation coefficient interpolation1 of the current fixed block, or each target element may be enlarged by further calculating the target element interpolation coefficient of each target element according to the block interpolation coefficient interpolation1 of the current fixed block.
[0077] In one embodiment, the target elements included in the current fixed block are enlarged based on the block interpolation coefficient, including: obtaining a preset initial interpolation coefficient; determining the target element interpolation coefficient corresponding to each target element of the current fixed block according to the block interpolation coefficient and the initial interpolation coefficient; enlarging the target element based on the target element interpolation coefficient; and adding the current fixed block that has completed the enlargement process to the renderer.
[0078] In this embodiment, the target element interpolation coefficient of each target element can be calculated according to the block interpolation coefficient interpolation1 of the current fixed block to perform a magnification process on each target element. Specifically, a preset initial interpolation coefficient interpolation0 is obtained, and the target element interpolation coefficient corresponding to each target element of the current fixed block is determined according to the block interpolation coefficient interpolation1 and the initial interpolation coefficient interpolation0, and the target element is magnified based on the target element interpolation coefficient, and the current fixed block that has completed the amplification process is added to the audio renderer.
[0079] In this embodiment, the target element interpolation coefficient interpolation i =(interpolation1-interpolation0) / (N-1)*i+interpolation0. After obtaining the target element interpolation coefficient of each target element, the corresponding position of the current fixed block can be enlarged, that is, z i =xi *interpolation i After the calculation is completed, the current fixed block completes the enlargement operation and adds z(n){z0,z1,z2,...z i ,...z N-1} to the renderer to complete the rendering of the current fixed block. i is the i-th target element, z i The target element after amplification. After all fixed blocks are rendered, the sound amplification post-processing is completed.
[0080] In one embodiment, after adding the current fixed block that has completed the enlargement process to the renderer, the method further includes: using the block interpolation coefficient of the current fixed block as the initial interpolation coefficient of the next fixed block of the current fixed block.
[0081] In this embodiment, after the current fixed block that has completed the amplification process is added to the renderer, the block interpolation coefficient of the current fixed block is used as the initial interpolation coefficient of the next fixed block of the current fixed block, that is, the initial interpolation coefficient interpolation0 is updated to interpolation1, so that the sound gradually transitions without overexposure.
[0082] In a specific embodiment, the audio signal amplification processing method is as follows: Figure 2 ,include:
[0083] Step S1, setting peak, gain. Initialization: setting the maximum value (peak value) of amplification peak, gain parameter gain dB, and initial interpolation coefficient interpolation0 = 1.0.
[0084] Calculate the amplification factor based on the gain parameter gain_scale=10 gain / 20 , then the maximum value of the gain is the gain threshold threshold = peak / gain_scale.
[0085] The method of obtaining each fixed block is as follows: first, the decoded PCM data is divided into N fixed blocks of length x(n) {x0, x1, x2...x i ,...x N-1}, each element x i Take the absolute value y(n){abs(x0), abs(x1), abs(x2)...abs(x i ), ... abs(x N-1 )}, get the maximum value y of y(n) max . if(y max >threshold), store the current feature as feature y max , otherwise 0.
[0086] Step S2: read the current block and obtain the feature of the current block cur .
[0087] Step S3: read the next block and obtain the feature of the next block of audio next .
[0088] Step S4, determine the interpolation 1 of the current block and generate an interpolation field z of the current block i .
[0089] The current block interpolation decision can be as follows:
[0090] if(feature cur ==0&&feature next ==0):interpolation1=gain_scale
[0091] if(feature cur ==0&&feature next >0):interpolation1=peak / feature next
[0092] if(feature cur >0&&feature next ==0):interpolation1=interpolation0
[0093] if(feature cur >feature next ):interpolation1=interpolation0
[0094] else:interpolation1=peak / feature next
[0095] Get interpolation element interpolation i =(interpolation1-interpolation0) / (N-1)*i+interpolation0
[0096] The current block is enlarged at the corresponding position, then: i =x i *interpolation i .
[0097] Step S5, the current block performs gain and adds data to the renderer. The current block completes the amplification operation and adds z(n){z0,z1,z2,...z i ,...z N-1} to the renderer to complete the current block rendering.
[0098] Step S6, determine whether the process is finished. If finished, execute step S7; if not finished, execute step S8.
[0099] Step S7, if finished, execute the last block gain and add the data to the renderer. i =x i * interpolation0, add z(n){z0,z1,z2,...z i ,...z N-1} to the renderer, completing the last block of rendering and ending the entire process.
[0100] Step S8, update the context. Initial interpolation coefficient interpolation0=interpolation1, jump to step S3.
[0101] In this embodiment, parameter control of the traditional compressor such as attack_time and release_time is not required. The calculation only uses a simple size comparison, which improves calculation efficiency, reduces CPU load, and solves the problem of the sound not being able to be suppressed quickly with a lower delay. The delay is related to the size of the block. The lower the length, the smaller the delay.
[0102] The method of the embodiment of the present application is intended to solve the problem that the typical compressor may set the attack time and release time unreasonably, resulting in untimely suppression and the introduction of noise. In this embodiment, the decoded audio PCM data is divided into fixed blocks, and the gain is determined based only on the peak characteristics of the current block and the next block to determine the interpolation logic, and finally the processed data is added to the renderer to allow the sound to gradually transition without overexposure.
[0103] Based on the same technical concept, the second embodiment of the present application provides an audio signal amplification processing device, such as Figure 3 , the device comprises:
[0104] The segmentation module 301 is used to segment the audio signal into a plurality of fixed blocks according to a preset length.
[0105] In a typical audio rendering, the compressed audio data is first decoded into pulse code modulation PCM (Pulse Code Modulation) data by a decoder, and then the PCM data is added to the audio renderer. In this embodiment, the audio signal can be the decoded PCM data. In order to avoid the introduction of noise in the audio signal amplification process, the decoded PCM data is not directly added to the audio renderer, but the PCM data is subjected to a sound amplification post-processing, and then the post-processed data is added to the audio renderer. The audio signal amplification processing method is the process of the sound amplification post-processing. Among them, during post-processing, the PCM data is first divided into multiple fixed blocks according to a preset length. The length of the fixed blocks is the same, all of which are preset lengths, such as a length of N elements, and the number of N is not limited, and can be 500, 1000, 1024, etc., which is not limited in the embodiment of the present application. It should be noted that the delay is related to the size of the fixed block of the block. The shorter the length of N, the smaller the delay, and the longer the length of N, the larger the delay. The length of N can be selected as needed.
[0106] The acquisition module 302 is used to acquire the block feature corresponding to each of the fixed blocks.
[0107] Optionally, the acquisition module 302 specifically includes:
[0108] A gain threshold acquisition submodule, used to acquire a preset gain threshold;
[0109] A target element maximum value acquisition submodule is used to obtain the maximum value of the target element included in the fixed block;
[0110] The block feature determination submodule is used to determine the block feature corresponding to the fixed block according to the maximum value of the target element and the gain threshold.
[0111] In this embodiment, a preset gain threshold threshold can be first obtained, each fixed block includes N target elements, the maximum value of the N target elements included in the fixed block is obtained, and the block feature corresponding to the fixed block is determined based on the maximum value of the target element and the gain threshold.
[0112] Optionally, the gain threshold acquisition submodule may specifically include:
[0113] A first acquisition unit, used to acquire preset amplification peak value and gain parameters;
[0114] A first determining unit, used to determine the amplification factor according to the gain parameter;
[0115] The gain threshold determination unit is used to take the quotient of the amplification peak value and the amplification factor as a preset gain threshold.
[0116] In this embodiment, the amplification peak value peak (that is, the maximum value allowed for sound amplification) and the gain parameter gain dB can be set during initialization, and the initial interpolation coefficient interpolation0 can be set to 1.0. The amplification factor gain_scale is determined according to the gain parameter gain. Specifically, the amplification factor gain_scale=10 gain / 20 , then the gain threshold (maximum value of gain) is equal to the quotient of the amplification peak value and the amplification factor, that is, threshold = peak / gain_scale.
[0117] Optionally, the block feature determination module may specifically include:
[0118] a first block feature determination unit, configured to use the absolute value of the maximum value of the target element as a block feature of a fixed block if the absolute value of the maximum value of the target element is greater than a gain threshold;
[0119] The second block feature determination unit is configured to use zero as the block feature of the fixed block if the absolute value of the maximum value of the target element is less than or equal to the gain threshold.
[0120] In this embodiment, the block feature acquisition method includes: firstly dividing the decoded PCM data into N fixed-length blocks x(n) {x0, x1, x2...x i ,...x N-1}, each element x i Take the absolute value y(n){abs(x0), abs(x1), abs(x2)...abs(x i ), ... abs(x N-1 )}, get the maximum value y of y(n) max If y max >threshold, the block feature feature of the current fixed block is stored as y max , otherwise the block feature is 0.
[0121] The determination module 303 is used to determine the block interpolation coefficient of the current fixed block according to the block feature of the current fixed block and the block feature of the next fixed block of the current fixed block.
[0122] The block feature of the current fixed block can be called feature cur , the block feature of the next fixed block of the current fixed block can be called feature next , read the current fixed block and the next fixed block of the current fixed block, and get the block feature feature of the current fixed block cur and the block feature feature of the next fixed block of the current fixed block next , according to feature cur and featurenext The block interpolation decision of the current fixed block can be made, that is, according to the feature cur and feature next Determine the block interpolation coefficient interpolation1 of the current fixed block.
[0123] Optionally, the determining module 303 specifically includes:
[0124] A first initial interpolation coefficient acquisition submodule, used to acquire a preset initial interpolation coefficient;
[0125] A first determination submodule, configured to determine that a block interpolation coefficient of the current fixed block is equal to a magnification factor if a block feature of the current fixed block is zero and a block feature of the next fixed block is zero;
[0126] A second determination submodule is used to determine the block interpolation coefficient of the current fixed block as the quotient of the amplified peak value and the block feature of the next fixed block if the block feature of the current fixed block is smaller than the block feature of the next fixed block;
[0127] The third determination submodule is used to determine the block interpolation coefficient of the current fixed block as the initial interpolation coefficient if the block feature of the current fixed block is greater than the block feature of the next fixed block.
[0128] In this embodiment, the preset initial interpolation coefficient interpolation0 can be set to 1.0. cur The block feature feature is zero and the next fixed block next is zero, then the interpolation coefficient interpolation1 of the current fixed block is determined to be equal to the magnification gain_scale; if the block feature feature of the current fixed block cur Block feature smaller than the next fixed block next , then the block interpolation coefficient interpolation1 of the current fixed block is determined as the quotient of the amplified peak value and the block feature of the next fixed block, that is, interpolation1 = peak / feature next ; If the block feature feature of the current fixed block cur Block feature that is larger than the next fixed block next , then determine the block interpolation coefficient interpolation1 of the current fixed block as the initial interpolation coefficient interpolation0.
[0129] Optionally, the block feature feature of the current fixed block cur Block feature smaller than the next fixed block next , including the block feature feature of the current fixed block curEqual to 0 and feature next Not equal to 0, including feature cur and feature next None of them are equal to 0, but feature cur <feature next The block feature of the current fixed block is cur Block feature that is larger than the next fixed block next , including the block feature feature of the current fixed block cur Not equal to 0 and feature next When it is equal to 0, it also includes feature cur and feature next None of them are equal to 0, but feature cur >feature next situation.
[0130] The enlarging module 304 is configured to enlarge the target element included in the current fixed block based on the block interpolation coefficient.
[0131] The device divides the audio signal into fixed blocks, determines the block interpolation coefficient of the current fixed block based on the block characteristics of the current fixed block and the block characteristics of the next fixed block, and then amplifies the target elements included in the current fixed block based on the block interpolation coefficient, so that the sound gradually transitions without overexposure, thereby avoiding the introduction of noise.
[0132] In this embodiment, parameter control of the traditional compressor such as attack_time and release_time is not required. The calculation only uses a simple size comparison, which improves calculation efficiency, reduces CPU load, and solves the problem of the sound not being able to be suppressed quickly with a lower delay. The delay is related to the size of the block. The lower the length, the smaller the delay.
[0133] The device of the embodiment of the present application is intended to solve the problem that the typical compressor may set the attack time and release time unreasonably, resulting in untimely suppression and the introduction of noise. In this embodiment, the decoded audio PCM data is divided into fixed blocks, and the gain is determined only based on the peak characteristics of the current block and the next block to determine the interpolation logic, and finally the processed data is added to the renderer to allow the sound to gradually transition without overexposure.
[0134] Optionally, the target elements included in the current fixed block may be uniformly enlarged based on the block interpolation coefficient interpolation1 of the current fixed block, or each target element may be enlarged by further calculating the target element interpolation coefficient of each target element according to the block interpolation coefficient interpolation1 of the current fixed block.
[0135] Optionally, the amplification module 304 may specifically include:
[0136] A second initial interpolation coefficient acquisition submodule, used to acquire preset initial interpolation coefficients;
[0137] A target element interpolation coefficient determination submodule, used to determine the target element interpolation coefficient corresponding to each target element of the current fixed block according to the block interpolation coefficient and the initial interpolation coefficient;
[0138] The magnification processing submodule is used to magnify the target element based on the target element interpolation coefficient;
[0139] Add submodule for adding current fixed blocks that complete the upscaling process to the renderer.
[0140] In this embodiment, the target element interpolation coefficient of each target element can be calculated according to the block interpolation coefficient interpolation1 of the current fixed block to perform a magnification process on each target element. Specifically, a preset initial interpolation coefficient interpolation0 is obtained, and the target element interpolation coefficient corresponding to each target element of the current fixed block is determined according to the block interpolation coefficient interpolation1 and the initial interpolation coefficient interpolation0, and the target element is magnified based on the target element interpolation coefficient, and the current fixed block that has completed the amplification process is added to the audio renderer.
[0141] In this embodiment, the target element interpolation coefficient interpolation i =(interpolation1-interpolation0) / (N-1)*i+interpolation0. After obtaining the target element interpolation coefficient of each target element, the corresponding position of the current fixed block can be enlarged, that is, z i =x i *interpolation i After the calculation is completed, the current fixed block completes the enlargement operation and adds z(n){z0,z1,z2,...z i ,...z N-1} to the renderer to complete the rendering of the current fixed block. i is the i-th target element, z i The target element after amplification. After all fixed blocks are rendered, the sound amplification post-processing is completed.
[0142] In one embodiment, the device further comprises:
[0143] The interpolation coefficient updating module is used to use the block interpolation coefficient of the current fixed block as the initial interpolation coefficient of the next fixed block of the current fixed block.
[0144] In this embodiment, after the current fixed block that has completed the amplification process is added to the renderer, the block interpolation coefficient of the current fixed block is used as the initial interpolation coefficient of the next fixed block of the current fixed block, that is, the initial interpolation coefficient interpolation0 is updated to interpolation1, so that the sound gradually transitions without overexposure.
[0145] In this embodiment, parameter control of the traditional compressor such as attack_time and release_time is not required. The calculation only uses a simple size comparison, which improves calculation efficiency, reduces CPU load, and solves the problem of the sound not being able to be suppressed quickly with a lower delay. The delay is related to the size of the block. The lower the length, the smaller the delay.
[0146] The device of the embodiment of the present application is intended to solve the problem that the typical compressor may set the attack time and release time unreasonably, resulting in untimely suppression and the introduction of noise. In this embodiment, the decoded audio PCM data is divided into fixed blocks, and the gain is determined only based on the peak characteristics of the current block and the next block to determine the interpolation logic, and finally the processed data is added to the renderer to allow the sound to gradually transition without overexposure.
[0147] like Figure 4 As shown, an embodiment of the present application provides an electronic device, including a processor 111, a communication interface 112, a memory 113 and a communication bus 114, wherein the processor 111, the communication interface 112, and the memory 113 communicate with each other through the communication bus 114.
[0148] Memory 113, used for storing computer programs;
[0149] In one embodiment of the present application, the processor 111 is used to execute the program stored in the memory 113 to implement the audio signal amplification processing method provided by any of the above method embodiments, including:
[0150] Divide the audio signal into a plurality of fixed blocks according to a preset length;
[0151] Obtaining a block feature corresponding to each of the fixed blocks;
[0152] Determining a block interpolation coefficient of the current fixed block according to a block feature of the current fixed block and a block feature of a next fixed block of the current fixed block;
[0153] A target element included in the current fixed block is enlarged based on the block interpolation coefficient.
[0154] Optionally, obtaining a block feature corresponding to each of the fixed blocks includes:
[0155] Get the preset gain threshold;
[0156] Obtaining a maximum value of target elements included in the fixed block;
[0157] A block feature corresponding to the fixed block is determined according to the maximum value of the target element and the gain threshold.
[0158] Optionally, determining a block feature corresponding to the fixed block according to the maximum value of the target element and the gain threshold includes:
[0159] If the absolute value of the maximum value of the target element is greater than the gain threshold, the absolute value of the maximum value of the target element is used as the block feature of the fixed block;
[0160] If the absolute value of the maximum value of the target element is less than or equal to the gain threshold, zero is used as the block feature of the fixed block.
[0161] Optionally, obtaining a preset gain threshold includes:
[0162] Get the preset amplification peak and gain parameters;
[0163] Determine the amplification factor according to the gain parameter;
[0164] The quotient of the amplification peak value and the amplification factor is used as the preset gain threshold.
[0165] Optionally, determining a block interpolation coefficient of the current fixed block according to a block feature of the current fixed block and a block feature of a next fixed block of the current fixed block includes:
[0166] Get the preset initial interpolation coefficient;
[0167] If the block feature of the current fixed block is zero and the block feature of the next fixed block is zero, determining that the block interpolation coefficient of the current fixed block is equal to the magnification;
[0168] If the block feature of the current fixed block is smaller than the block feature of the next fixed block, determining the block interpolation coefficient of the current fixed block as the quotient of the amplified peak value and the block feature of the next fixed block;
[0169] If the block characteristic of the current fixed block is greater than the block characteristic of the next fixed block, the block interpolation coefficient of the current fixed block is determined to be the initial interpolation coefficient.
[0170] Optionally, enlarging the target element included in the current fixed block based on the block interpolation coefficient includes:
[0171] Get the preset initial interpolation coefficient;
[0172] Determine a target element interpolation coefficient corresponding to each target element of the current fixed block according to the block interpolation coefficient and the initial interpolation coefficient;
[0173] Performing a magnification process on the target element based on the target element interpolation coefficient;
[0174] The current fixed block that has completed the magnification process is added to the renderer.
[0175] Optionally, after adding the current fixed block that has completed the magnification process to the renderer, the method further includes:
[0176] The block interpolation coefficient of the current fixed block is used as an initial interpolation coefficient of a next fixed block of the current fixed block.
[0177] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0178] The communication interface is used for communication between the above terminal and other devices.
[0179] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0180] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0181] An embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the audio signal amplification processing method provided by any of the aforementioned method embodiments is implemented.
[0182] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0183] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0184] It should be understood that the terms used herein are only for the purpose of describing specific example embodiments and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used herein may also be meant to include plural forms. The terms "include", "comprise", "contain", and "have" are inclusive, and therefore specify the existence of stated features, steps, operations, elements and / or parts, but do not exclude the existence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The method steps, processes, and operations described herein are not interpreted as necessarily requiring them to be performed in the specific order described or illustrated, unless the execution order is clearly indicated. It should also be understood that additional or alternative steps may be used.
[0185] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application. In the description, the suffixes such as "module", "component" or "unit" used to represent the elements are only used to facilitate the description of the present application and have no specific meaning in themselves. Therefore, "module", "component" or "unit" can be used in a mixed manner.
[0186] The above description is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest range consistent with the principles and novel features applied for herein.
Claims
1. A method for amplifying an audio signal, characterized in that: The method comprises: Divide the audio signal into a plurality of fixed blocks according to a preset length; Obtaining a block feature corresponding to each of the fixed blocks; Determining a block interpolation coefficient of the current fixed block according to a block feature of the current fixed block and a block feature of a next fixed block of the current fixed block; Based on the block interpolation coefficient, a target element included in the current fixed block is enlarged.
2. The method according to claim 1, characterized in that Obtaining a block feature corresponding to each of the fixed blocks includes: Get the preset gain threshold; Obtaining a maximum value of target elements included in the fixed block; A block feature corresponding to the fixed block is determined according to the maximum value of the target element and the gain threshold.
3. The method according to claim 2, characterized in that Determining a block feature corresponding to the fixed block according to the maximum value of the target element and the gain threshold includes: If the absolute value of the maximum value of the target element is greater than the gain threshold, the absolute value of the maximum value of the target element is used as the block feature of the fixed block; If the absolute value of the maximum value of the target element is less than or equal to the gain threshold, zero is used as the block feature of the fixed block.
4. The method according to claim 3, characterized in that Get the preset gain threshold, including: Get the preset amplification peak and gain parameters; Determine the amplification factor according to the gain parameter; The quotient of the amplification peak value and the amplification factor is used as the preset gain threshold.
5. The method according to claim 4, characterized in that Determining a block interpolation coefficient of the current fixed block according to a block feature of the current fixed block and a block feature of a next fixed block of the current fixed block includes: Get the preset initial interpolation coefficient; If the block feature of the current fixed block is zero and the block feature of the next fixed block is zero, determining that the block interpolation coefficient of the current fixed block is equal to the magnification; If the block feature of the current fixed block is smaller than the block feature of the next fixed block, determining the block interpolation coefficient of the current fixed block as the quotient of the amplified peak value and the block feature of the next fixed block; If the block characteristic of the current fixed block is greater than the block characteristic of the next fixed block, the block interpolation coefficient of the current fixed block is determined to be the initial interpolation coefficient.
6. The method according to claim 1, characterized in that The method of enlarging the target element included in the current fixed block based on the block interpolation coefficient comprises: Get the preset initial interpolation coefficient; Determine a target element interpolation coefficient corresponding to each target element of the current fixed block according to the block interpolation coefficient and the initial interpolation coefficient; Performing a magnification process on the target element based on the target element interpolation coefficient; The current fixed block that has completed the magnification process is added to the renderer.
7. The method according to claim 6, characterized in that After adding the current fixed block that has completed the magnification process to the renderer, the method further includes: The block interpolation coefficient of the current fixed block is used as an initial interpolation coefficient of a next fixed block of the current fixed block.
8. An audio signal amplification processing device, characterized in that: The device comprises: A segmentation module, used for dividing the audio signal into a plurality of fixed blocks according to a preset length; An acquisition module, used for acquiring a block feature corresponding to each of the fixed blocks; A determination module, configured to determine a block interpolation coefficient of the current fixed block according to a block feature of the current fixed block and a block feature of a next fixed block of the current fixed block; The enlargement module is used to enlarge the target element included in the current fixed block based on the block interpolation coefficient.
9. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; The processor is used to implement the audio signal amplification processing method according to any one of claims 1 to 7 when executing the program stored in the memory.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the audio signal amplification processing method according to any one of claims 1 to 7 is implemented.
