Audio signal processing method, device, electronic device and readable storage medium
By calculating the overlap ratio of the audio signal frame sequence and performing synthesis processing, the problem of low audio signal processing efficiency in the existing technology is solved, the double-speed playback function in embedded devices is realized, and the processing efficiency and user experience are improved.
Patent Information
- Application Number
- CN202211104870.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-09
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2042-09-09
AI Technical Summary
Existing audio signal processing algorithms require a large amount of calculations when processing higher sampling rate audio signals, resulting in low processing efficiency and unable to support double-speed playback functions in embedded electronic devices.
By obtaining the audio signal frame sequence and playback rate parameters, calculating the overlap ratio between adjacent frames, and performing synthesis processing to achieve compression or expansion of the audio signal, simplifying the algorithm process and reducing the amount of calculations.
It improves the efficiency of audio signal processing, enables embedded devices to support double-speed playback function, reduces running memory usage, and improves user experience.
Smart Images

Figure CN115497487B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of audio processing technology, and specifically relates to an audio signal processing method, device, electronic device and readable storage medium. Background Art
[0002] As the performance of electronic devices continues to improve, high-definition televisions, headphones, speakers, and mobile phones can already support the playback of audio with higher sampling rates.
[0003] In the related art, when processing audio at double speed, the waveform similarity superposition algorithm WSOLA is usually used. The WSOLA algorithm selects the signal that best matches the synthesized signal of the previous frame to synthesize the audio data of the next frame in each iteration. However, this processing algorithm requires a huge amount of calculation when performing similarity matching calculations on audio signals with higher sampling rates, resulting in low processing efficiency of audio signals. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide an audio signal processing method, device, electronic device and readable storage medium, which can solve the problem of low processing efficiency of audio signals.
[0005] In a first aspect, an embodiment of the present application provides an audio signal processing method, the method comprising: obtaining a first audio signal frame sequence corresponding to a first audio signal, the first audio signal frame sequence comprising n audio signal frames, where n is an integer greater than 1; obtaining a second overlapping ratio based on a first overlapping ratio corresponding to the first audio signal frame sequence and a playback rate parameter of the first audio signal; performing synthesis processing on the first audio signal frame sequence according to the second overlapping ratio to obtain a second audio signal; wherein the first overlapping ratio is: an overlapping ratio between two adjacent audio signal frames in the n audio signal frames.
[0006] In a second aspect, an embodiment of the present application provides an audio signal processing device, comprising: an acquisition module, a determination module and a processing module, wherein: the acquisition module is used to acquire a first audio signal frame sequence corresponding to a first audio signal, the first audio signal frame sequence comprising n audio signal frames, where n is an integer greater than 1; the determination module is used to obtain a second overlapping ratio based on a first overlapping ratio corresponding to the first audio signal frame sequence acquired by the acquisition module and a playback rate parameter of the first audio signal; the processing module is used to perform synthesis processing on the first audio signal frame sequence according to the second overlapping ratio to obtain a second audio signal; wherein the first overlapping ratio is: the overlapping ratio between two adjacent audio signal frames in the n audio signal frames.
[0007] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the program or instructions are executed by the processor, the steps of the method described in the first aspect are implemented.
[0008] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0009] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.
[0010] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method described in the first aspect.
[0011] In an embodiment of the present application, an audio signal processing device obtains a first audio signal frame sequence corresponding to a first audio signal, the first audio signal frame sequence includes n audio signal frames, n is an integer greater than 1, and based on the first overlap ratio corresponding to the first audio signal frame sequence and the playback rate parameter of the first audio signal, obtains a second overlap ratio, and then synthesizes the first audio signal frame sequence according to the second overlap ratio to obtain a second audio signal; wherein the first overlap ratio is: the overlap ratio between two adjacent audio signal frames in the n audio signal frames. Through this method, the audio signal processing device can determine the second overlap ratio according to the overlap ratio between two adjacent audio signal frames in the n audio signal frames and the audio playback rate parameter, and synthesizes the n audio signal frames according to the second overlap ratio to achieve audio compression or expansion of the audio signal frame sequence, thereby obtaining an audio signal played according to the audio playback rate parameter. The entire algorithm process is relatively simple and has a small amount of calculation, which greatly improves the processing efficiency of the audio signal. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 One of the flowcharts of the audio signal processing method provided in the embodiment of the present application;
[0013] Figure 2 A schematic diagram of the audio speed playback principle provided in an embodiment of the present application;
[0014] Figure 3 A second flowchart of the audio signal processing method provided in an embodiment of the present application;
[0015] Figure 4 A schematic diagram of the structure of an audio signal processing device provided in an embodiment of the present application;
[0016] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0017] Figure 6 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0018] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0019] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0020] In the era of mobile Internet, with the promotion and popularization of smart wearable devices, smart watches have gradually become portable electronic devices that users use frequently in their daily lives and work. With the development of industry technology, users' demand for smooth audio application functions on smart watches is growing. At present, embedded smart wearable devices on the market generally have audio application software, and their audio functions support basic functions such as playback control, downloading, and song switching.
[0021] In related technologies, embedded wearable devices have many limitations in performance, power consumption, and size. The audio application functions of smart watches currently on the market only support basic functions such as playback control, downloading, and song switching, but do not support functions such as double-speed playback that require a large amount of computing power and occupy a large amount of device running memory RAM. In special scenarios, users need to actively speed up or slow down the playback speed, but smart watch applications and systems do not support double-speed playback, which cannot provide users with a complete and comprehensive audio function experience, affecting the user experience of smart watches and will also have a certain degree of negative impact on product reputation.
[0022] In the audio signal processing method provided in the embodiment of the present application, the audio signal processing device can determine a second overlapping ratio based on the overlapping ratio between two adjacent audio signal frames in n audio signal frames and the audio playback ratio parameter, and perform synthesis processing on the n audio signal frames according to the second overlapping ratio to realize audio compression or expansion of the audio signal frame sequence, thereby obtaining an audio signal played according to the audio playback ratio parameter. The entire algorithm process is relatively simple and has a small amount of calculation, and occupies a small amount of running memory of the device. It can be run in embedded electronic devices, so that the embedded electronic devices can support the audio speed playback function and greatly improve the processing efficiency of audio signals.
[0023] The audio signal processing method provided in the embodiment of the present application is described in detail below through specific embodiments and application scenarios in conjunction with the accompanying drawings.
[0024] Figure 1 Schematic diagram of an audio signal processing method provided in an embodiment of the present application. Figure 1 As shown, the audio signal processing method provided in the embodiment of the present application includes the following steps 201 to 203:
[0025] Step 201: an audio signal processing apparatus obtains a first audio signal frame sequence corresponding to a first audio signal.
[0026] The first audio signal frame sequence includes n audio signal frames, where n is an integer greater than 1.
[0027] Optionally, in this embodiment of the present application, the first audio signal is a streaming audio signal.
[0028] It should be noted that, since the signal is data, the first audio signal may also be referred to as first audio signal data.
[0029] Optionally, in the embodiment of the present application, the first audio signal frame sequence is an audio signal frame sequence obtained after performing frame processing on the first audio signal.
[0030] Optionally, in this embodiment of the present application, each of the n audio signal frames is an audio signal frame that carries audio information.
[0031] Optionally, in the embodiment of the present application, the audio signal processing device may perform frame processing on the first audio signal to obtain the first audio signal frame sequence.
[0032] It should be noted that for the relevant description of frame processing, please refer to the relevant technology, and the embodiments of the present application will not go into details.
[0033] Step 202: The audio signal processing apparatus obtains a second overlapping ratio based on the first overlapping ratio corresponding to the first audio signal frame sequence and a playback rate parameter of the first audio signal.
[0034] The first overlapping ratio is: an overlapping ratio between two adjacent audio signal frames in the n audio signal frames.
[0035] Optionally, in the embodiment of the present application, the first overlapping ratio is the ratio of the length of the overlapping area between two adjacent audio signal frames in the n audio signal frames obtained after the first audio signal is framed to the length of the audio signal frame.
[0036] Optionally, in the embodiment of the present application, the first overlapping ratio is: the ratio of the overlapping length of adjacent frames and the previous frame in the first audio signal frame sequence to the length of the audio signal frame, and the first overlapping ratio can be recorded as S1.
[0037] Exemplarily, the first audio signal frame sequence includes n audio signal frames, the duration corresponding to the first audio signal frame is 0ms-20ms, and the duration corresponding to the second audio signal frame is 1ms-21ms, then the duration of the overlapping part of the first audio signal frame and the second audio signal frame is 1-20ms, the overlapping length is 19ms, and the overlapping ratio is 19 / 20.
[0038] It should be noted that the second audio signal frame is the adjacent frame, and the first audio signal frame is the previous frame.
[0039] Optionally, in an embodiment of the present application, the first overlap ratio is predefined, and a value of the first overlap ratio is within a first preset interval.
[0040] Exemplarily, the first preset interval may be 60% to 85%, or the first preset interval may be 70% to 80%. Exemplarily, the first overlap ratio may be 70%, 75% or 80%.
[0041] Optionally, in the embodiment of the present application, the above-mentioned playback rate parameters may include: playback multiple ratio.
[0042] Optionally, in an embodiment of the present application, the audio signal processing device determines the playback speed of the first audio signal according to the user's selection input of the playback speed control, or according to the playback speed information input by the user, and the playback speed of the first audio signal can be recorded as M.
[0043] Exemplarily, the playback multiple ratio may be x0.5, x1.5, x2, x3, etc., which is not limited in the embodiments of the present application.
[0044] Optionally, in the embodiment of the present application, the first overlapping ratio is the ratio of the length of the overlapping area between two adjacent audio signal frames to the length of the audio signal frame when the n audio signal frames obtained by the frame processing are combined.
[0045] Optionally, in an embodiment of the present application, the audio signal processing device can calculate the second overlapping ratio based on the first overlapping ratio corresponding to the first audio signal frame sequence and the playback speed of the first audio signal by a speed ratio formula, i.e., formula (8) below. The second overlapping ratio can be denoted as S2.
[0046] In some embodiments of the present application, the audio signal processing device may substitute the first overlapping ratio and the playback speed into a speed ratio formula to calculate the second overlapping ratio.
[0047] It should be noted that the calculation process of the second overlap ratio can be specifically described below and will not be repeated here.
[0048] Step 203: The audio signal processing apparatus performs synthesis processing on the first audio signal frame sequence according to the second overlapping ratio to obtain a second audio signal.
[0049] Optionally, in the embodiment of the present application, the above-mentioned synthesis processing may be a frame combining processing.
[0050] In some embodiments of the present application, the audio signal processing device performs frame combining processing on n audio signal frames in the first audio signal frame sequence according to the second overlapping ratio, that is, performs superposition and synthesis processing on the n audio signal frames in sequence to obtain the second audio signal.
[0051] It should be noted that, for the detailed description of the synthesis process of the first audio signal frame sequence, reference may be made to the related art, which will not be described in detail here.
[0052] It should be noted that the process of sequentially performing superposition synthesis processing on the n audio signal frames in the first audio signal frame sequence according to the second overlap ratio can be understood as a process of compressing or expanding the first audio signal frame sequence. Whether the first audio signal frame sequence is compressed or expanded depends on the magnitude relationship between the first overlap ratio and the second overlap ratio. When the first overlap ratio is greater than the second overlap ratio, the first audio signal frame sequence is expanded, that is, the audio is finally slowed down. When the first overlap ratio is less than the second overlap ratio, the first audio signal frame sequence is compressed, and the audio is finally fast-forwarded.
[0053] The following is a detailed description of the derivation process of the speed ratio formula provided in the embodiment of the present application:
[0054] Figure 2 It is a schematic diagram of an audio speed playback principle provided in an embodiment of the present application.
[0055] exist Figure 2 In the figure, T1 represents the audio signal data per unit time length, i.e., the first audio signal, and T2 represents the length of the audio signal data after compression / expansion of the audio signal frame sequence, which is obtained after dynamic calculation according to the compression / expansion ratio. F1 represents a frame of data after the audio signal data is framed. Similarly, F2 and F3 are enumerations of continuous frame data in the audio signal frame sequence. Fn represents the last frame of the n audio signal frames of the audio signal data. W1 represents the duration of an audio signal frame after the audio signal data is framed, i.e., the audio signal frame length. The length interval is dynamically selected between 20ms-50ms, W2 represents the length of the overlap between adjacent frames and the previous frame when the audio signal is framed, and W3 represents the length of the overlap between adjacent frames and the previous frame when the audio signal frame sequence data is framed.
[0056] When the first audio signal is subjected to frame processing, the overlap ratio between the adjacent frame and the previous frame is recorded as S1. According to the frame principle, the following formula (1) can be obtained:
[0057]
[0058] When the audio signal frame sequence data is combined, the overlap ratio between the adjacent frames and the previous frame is recorded as S2. Similarly, according to the principle of combining frames, formula (2) can be obtained:
[0059]
[0060] After a series of frame splitting and framing operations are performed on the first audio signal data, it is assumed that the audio duration changes from the duration T1 before framing to the duration T2 after framing, where the duration T2 is larger than the duration T1, it means that the audio duration becomes longer after the audio signal is processed, that is, the audio is played at a slower speed; if the duration T2 is smaller than the duration T1, it means that the audio is played at a faster speed. According to the relationship between the audio playback speed ratio and the duration of the audio signal before and after framing, the following formula (3) can be obtained:
[0061]
[0062] At the same time, according to the principle of framing, the total duration of the audio signal is the duration of the non-overlapping part of the adjacent frame and the previous frame plus the duration of the last complete frame, which is recorded as the total duration of the entire audio signal. The total duration T1 of the first audio signal can be calculated by formula (4), and the total duration T2 of the second audio signal can be calculated by formula (5):
[0063] T1=W1*(1-S1)*(n-1)+W1 (4)
[0064] T2=W1*(1-S2)*(n-1)+W1 (5)
[0065] Substituting formula (4) and formula (5) into formula (3), we can get the speed ratio formula (6):
[0066]
[0067] The above speed ratio formula (6) is simplified and calculated to obtain the following formula (7):
[0068]
[0069] Here, n represents the total number of frames after a segment of audio signal data is divided into frames. Taking music playing as an example, the general duration of music is about 3 minutes.
[0070] Assuming that the audio data to be processed is 3 minutes long, we can get:
[0071] T1=3*60*1000ms=180000ms. Assume that the frame window length of the audio signal data is set to 20ms when framing, that is, W1=20ms. The initial overlap ratio S1 during framing is set to 75%. According to the above formula (4), the total time length can be calculated as follows: 180000=20*(1–75%)*(n-1)+20. The total number of frames n=35997. Substituting this total number of frames into formula (7), since the value of the 1 / (n-1) part is very small, the influence on the calculation of the final overlap ratio is very limited. Therefore, the speed ratio calculation formula can ignore the influence of the 1 / (n-1) part. Finally, formula (7) can be simplified to the following formula (8):
[0072]
[0073] The audio signal data is divided into frames using the overlapping ratio S1 as described above, and then combined into frames using the overlapping ratio S2 as described above, so as to realize the audio speed playback function corresponding to M times speed.
[0074] When calculating the second overlap ratio by using the multiple ratio calculation formula, since the unknown quantities only include the first overlap ratio and the playback speed ratio, the operation is relatively simple and the amount of operation is small, the operating space of the electronic device is small and the processing efficiency is high.
[0075] In the audio signal processing method provided in the embodiment of the present application, the audio signal processing device obtains a first audio signal frame sequence corresponding to the first audio signal, the first audio signal frame sequence includes n audio signal frames, n is an integer greater than 1, and based on the first overlap ratio corresponding to the first audio signal frame sequence and the playback rate parameter of the first audio signal, obtains a second overlap ratio, and then synthesizes the first audio signal frame sequence according to the second overlap ratio to obtain a second audio signal; wherein the first overlap ratio is: the overlap ratio between two adjacent audio signal frames in the n audio signal frames. Through this method, the audio signal processing device can determine the second overlap ratio according to the overlap ratio between two adjacent audio signal frames in the n audio signal frames and the audio playback rate parameter, and synthesizes the n audio signal frames according to the second overlap ratio to achieve audio compression or expansion of the audio signal frame sequence, thereby obtaining an audio signal played according to the audio playback rate parameter. The entire algorithm process is relatively simple and has a small amount of calculation, which greatly improves the processing efficiency of the audio signal.
[0076] Optionally, in the embodiment of the present application, the above step 201 may include the following steps 201a and 201b:
[0077] Step 201a: The audio signal processing apparatus determines a target window duration.
[0078] Step 201b: the audio signal processing apparatus performs frame processing on the first audio signal according to the target window duration and the first overlap ratio to obtain a first audio signal frame sequence.
[0079] Exemplarily, the target window duration may range from 20 ms to 50 ms.
[0080] It should be noted that the target window duration may be 20 ms or 50 ms.
[0081] Exemplarily, the first overlap ratio, ie, the initial frame-merging overlap ratio, may be set to a default value of 75%.
[0082] Exemplarily, the audio signal processing apparatus may segment the first audio signal according to the target window duration and the first overlap ratio to obtain n audio signal frames.
[0083] It should be noted that when dividing the frames, the audio signal frames are divided in a way that each frame overlaps with the previous frame in a certain proportion. When dividing the frames, by setting a 75% overlap between two adjacent frames, the audio amplitude and phase of adjacent frames can be made as smooth and stable as possible, so that the two adjacent frames can have a smooth transition during playback.
[0084] In this way, after receiving the streaming audio signal data, the signal processing device selects a period of audio signal data with a shorter length for frame processing each time, thereby reducing the computational complexity during the processing, thereby reducing the memory usage of the electronic device and improving processing efficiency.
[0085] Optionally, in an embodiment of the present application, when dividing the first audio signal into frames, each frame is overlapped with the previous frame in a certain ratio to perform audio signal frame segmentation. After the framing is completed, the audio signal processing device performs a frame merging operation on the audio signal frame sequence obtained by the framing process. Specifically, each frame is overlapped with the previous frame in a certain ratio. After completing the above-mentioned framing and framing operations, the purpose of compressing and expanding the audio signal frame sequence is achieved, and finally a complete and continuous new audio signal data is output and sent to the audio streaming playback framework for playback.
[0086] Optionally, in the embodiment of the present application, after the above step 201b, the audio signal processing method provided in the embodiment of the present application further includes the following steps 201c1 and 201c2:
[0087] Step 201c1: the audio signal processing apparatus determines whether the duration of the target audio signal frame in the first audio signal frame sequence is equal to the target window duration.
[0088] Step 201c2: when the duration of the target audio signal frame is less than the target window duration, the audio signal processing apparatus performs zero padding on the target audio signal frame.
[0089] Exemplarily, the target audio signal frame may be the last audio signal frame in the first audio signal frame sequence.
[0090] Exemplarily, when the duration of the target audio signal frame is less than the preset target window duration, the target audio signal frame is padded with zeros to form a complete and valid audio signal frame, thereby ensuring that it can be effectively processed later.
[0091] It should be noted that when the audio signal is framed, the duration of the last audio signal frame obtained may be less than one frame, which will affect the subsequent processing of the audio signal frame and lead to poor calculation accuracy. For example, when the window selected for the audio signal is framed, the duration of the last audio signal frame obtained after the frame processing is 19ms.
[0092] Optionally, in the application embodiment, the above step 203 may include the following steps 203a and 203b:
[0093] Step 203a: The audio signal processing apparatus performs synthesis processing on the first audio signal frame sequence according to the second overlapping ratio to obtain a third audio signal.
[0094] Step 203b: When the audio signal processing apparatus detects that the third audio signal includes invalid data, the audio signal processing apparatus discards the invalid data to obtain the second audio signal.
[0095] Exemplarily, the invalid data may be zero-padded data, for example, the invalid data is zero-padded data inserted at the end of the third audio signal.
[0096] Exemplarily, when performing frame merging processing on the first audio signal frame sequence, the audio signal processing device merges the audio signal frames in the first audio frame sequence to obtain a third audio signal, and then performs an illegal data check on the third audio signal. If the third audio signal does not contain invalid data, the third audio signal is used as the final audio signal, i.e., the second audio signal. If invalid data exists in the third audio signal, the invalid data is discarded to obtain a second audio signal without invalid data.
[0097] Exemplarily, the audio signal processing device checks whether the end data of the audio data after framing is invalid data padded with zeros. If a zero-padded data segment is detected at the end, the data is polled backward from the tail until the detected data is valid data, and the polled invalid data segment is discarded.
[0098] For example, assuming that after the first audio signal is framed, the duration of the last audio signal frame obtained does not meet the duration requirement of one frame, zero-padding processing is performed at the end of the last audio signal frame. When the audio signal frame sequence including the last audio signal frame is subsequently merged, zero-padding data after the zero-padding processing will exist in the obtained audio signal. The data is invalid data. When the zero-padding data is detected, the zero-padding data can be discarded to ensure the validity of the audio signal.
[0099] In this way, the audio signal processing apparatus can discard invalid data in the audio signal data, thereby improving the validity of the audio signal data.
[0100] Optionally, in the embodiment of the present application, the above-mentioned playback rate parameters include: playback speed ratio;
[0101] Optionally, the above step 202 may include the following steps 202b1 and 202b2:
[0102] Step 202b1: Calculate the ratio between the first difference and the above playback speed ratio.
[0103] Step 202b2: Based on the above ratio, a second overlap ratio is obtained.
[0104] The first difference is the difference between 1 and the first overlap ratio, and the second overlap ratio is the difference between 1 and the ratio.
[0105] In some embodiments of the present application, taking the first overlap ratio S1 of 75% as an example, when the playback speed ratio M is 0.5, the first difference is equal to 1 minus S1, that is, 1 minus 75% is equal to 25%, and the ratio of the first difference to the playback speed ratio M is 25% / 0.5. The second overlap ratio S2 is equal to 1 minus 25% / 0.5. It is calculated that S2 is 50%, that is, the second overlap ratio S2 is 50%.
[0106] Exemplarily, the audio signal processing device may calculate the second overlap ratio by using the speed ratio calculation formula (8).
[0107] In some embodiments of the present application, taking the first overlap ratio S1 as 75% as an example, when the playback speed ratio M is 0.5, the audio signal processing device substitutes the first overlap ratio S1 and the playback speed ratio M into the above formula (8) to obtain the following relationship:
[0108] According to this relationship, it can be calculated that S2 is equal to 50%, that is, the second overlap ratio S2 is 50%. Similarly, taking the first overlap ratio S1 as 75% as an example, when the playback speed ratio M is 1.5, the second overlap ratio S2 is approximately equal to 83.33%; when the playback speed ratio M is 2, the second overlap ratio S2 is approximately equal to 87.5%; when the playback speed ratio M is 3, the second overlap ratio S2 is approximately equal to 91.67%.
[0109] It should be noted that the above-mentioned playback speed ratios are only some examples provided in this application. The playback speed ratio can select other values according to actual needs, for example, 0.75, 2.5, etc., and the embodiments of this application are not limited to this.
[0110] Exemplarily, when the second overlapping ratio is obtained, the audio signal processing device performs a frame division operation on the audio signal data (i.e., the first audio signal) using the overlapping ratio S1 as above, and then performs a frame merging operation using the overlapping ratio S2 as above, to achieve the corresponding M-speed audio speed playback function.
[0111] In this way, the audio signal processing device can calculate the overlap ratio between adjacent frames during frame combination processing in the above manner, and realize the double-speed audio playback function by controlling the overlap ratio during frame division and frame combination.
[0112] Optionally, in an embodiment of the present application, when the playback speed ratio is less than 1, the audio duration of the second audio signal is greater than the audio duration of the first audio signal.
[0113] When the playback speed ratio is greater than 1, the audio duration of the second audio signal is shorter than the audio duration of the first audio signal.
[0114] It should be noted that the playback speed ratio of the audio signal is less than 1, indicating that the audio signal needs to be played back slowly.
[0115] Exemplarily, taking the audio duration of the first audio signal as T1 and the audio duration of the second audio signal as T2 as an example, after the first audio signal is framed, the duration of the second audio signal obtained is T2. If T2 is greater than T1, it means that the audio duration of the first audio signal becomes longer after the frame processing, that is, the audio is played at a slower speed, that is, the playback speed ratio is less than 1.
[0116] Exemplarily, in combination with the above embodiment, if T2 is less than T1, it means that the audio duration of the first audio signal becomes shorter after the frame combination processing, that is, the audio is played at an accelerated speed, that is, the playback speed ratio is greater than 1.
[0117] The audio signal processing method provided by the embodiment of the present application is described below through a complete embodiment. Figure 3 As shown, the audio signal processing method may include the following steps 11 to 19:
[0118] Step 11: The audio framework receives the audio signal data and starts frame preprocessing
[0119] Exemplarily, the window time length during frame division is selected, the value range is between 20ms-50ms, and the initial frame combination overlap ratio is set to a default value of 75%.
[0120] Step 12: Frame the audio signal data
[0121] Exemplarily, the preset parameters of step 11 are used to perform frame processing on the audio signal data to obtain a sequence of all signal frames after processing, and obtain a total number of frames n.
[0122] Step 13: Determine whether the last frame meets the window duration requirement
[0123] Exemplarily, if the last frame duration is less than a preset window duration parameter, the signal frame data is padded with zeros to form a complete and valid signal frame sequence for the next step of data calculation.
[0124] Step 14: Use the speed ratio formula to calculate the frame overlap ratio S2
[0125] The audio playback rate adjustment multiple M input by the user is received, and the frame overlap ratio S2 is calculated using the speed ratio formula (8).
[0126] Step 15: Combine the signal frame sequence
[0127] Exemplarily, according to the overlap ratio S2 calculated in step 14, the signal frame sequence obtained in step 13 is merged to finally obtain a complete audio signal data segment.
[0128] Step 16: Check for illegal audio signal data
[0129] Exemplarily, it is checked whether the end data of the audio data after framing is invalid data padded with zeros. If a zero-padded data segment is detected at the end, data is polled backward from the tail until the detected data is valid data, and the polled invalid data segment is discarded.
[0130] Step 17: Audio signal data playback
[0131] The signal data that has passed the legality check is sent to the audio framework streaming playback interface for playback.
[0132] Step 18: Check whether the user has modified the playback rate
[0133] Step 19: If there are any changes, re-execute the speed playback process
[0134] Exemplarily, if the user re-modifies the playback rate, the updated multiple-speed M value is obtained, and the process returns to step 11 to re-execute the multiple-speed playback process.
[0135] In the audio signal processing method provided in the embodiment of the present application, the audio signal processing device can achieve audio speed playback with a small amount of calculation, which is particularly suitable for electronic devices with limited running memory and performance, such as embedded wearable electronic devices. It can enrich the audio playback control functions on embedded electronic devices, meet the user's needs to speed up and slow down the audio playback speed when playing audio, and improve the user experience of the audio and video application functions of the wearable device. For third-party audio and music developers, it can also achieve richer and more advanced audio functions.
[0136] The audio signal processing method provided in the embodiment of the present application can be executed by an audio signal processing device. In the embodiment of the present application, an audio signal processing device executing the audio signal processing method is taken as an example to illustrate the audio signal processing device provided in the embodiment of the present application.
[0137] Figure 4 A schematic diagram of the structure of an audio signal processing device provided in an embodiment of the present application is shown in FIG. Figure 4As shown, the audio signal processing device may include: an acquisition module 401, a determination module 402 and a processing module 403, wherein:
[0138] an acquisition module, configured to acquire a first audio signal frame sequence corresponding to the first audio signal, the first audio signal frame sequence comprising n audio signal frames, where n is an integer greater than 1;
[0139] A determination module, configured to obtain a second overlap ratio based on a first overlap ratio corresponding to the first audio signal frame sequence acquired by the acquisition module and a playback rate parameter of the first audio signal;
[0140] A processing module, configured to perform synthesis processing on the first audio signal frame sequence according to a second overlapping ratio to obtain a second audio signal;
[0141] The first overlapping ratio is: an overlapping ratio between two adjacent audio signal frames in the n audio signal frames.
[0142] Optionally, in the embodiment of the present application,
[0143] The determination module is also used to determine the target window duration;
[0144] The processing module is further used to perform frame processing on the first audio signal according to the target window duration and the first overlapping ratio coefficient determined by the determination module to obtain a first audio signal frame sequence.
[0145] Optionally, in the embodiment of the present application,
[0146] The processing module is further used to determine whether the duration of the target audio signal frame in the first audio signal frame sequence is equal to the target window duration;
[0147] The processing module is further configured to perform zero padding processing on the target audio signal frame when the duration of the target audio signal frame is less than the duration of the target window.
[0148] Optionally, in the embodiment of the present application,
[0149] a processing module, specifically configured to perform synthesis processing on the first audio signal frame sequence according to the second overlapping ratio to obtain a third audio signal;
[0150] The processing module is specifically configured to discard the invalid data when detecting that the third audio signal includes invalid data, so as to obtain the second audio signal.
[0151] Optionally, in the embodiment of the present application,
[0152] A determination module, specifically used to calculate the ratio of the first difference and the playback speed ratio;
[0153] A determination module, specifically configured to obtain a second overlap ratio based on the ratio;
[0154] The first difference is the difference between 1 and the first overlap ratio, and the second overlap ratio is the difference between 1 and the ratio.
[0155] In the audio signal processing device provided in the embodiment of the present application, the audio signal processing device obtains a first audio signal frame sequence corresponding to a first audio signal, the first audio signal frame sequence includes n audio signal frames, n is an integer greater than 1, and based on the first overlap ratio corresponding to the first audio signal frame sequence and the playback rate parameter of the first audio signal, obtains a second overlap ratio, and then synthesizes the first audio signal frame sequence according to the second overlap ratio to obtain a second audio signal; wherein the first overlap ratio is: the overlap ratio between two adjacent audio signal frames in the n audio signal frames. Through this method, the audio signal processing device can determine the second overlap ratio according to the overlap ratio between two adjacent audio signal frames in the n audio signal frames and the audio playback rate parameter, and synthesizes the n audio signal frames according to the second overlap ratio to achieve audio compression or expansion of the audio signal frame sequence, thereby obtaining an audio signal played according to the audio playback rate parameter. The entire algorithm process is relatively simple and has a small amount of calculation, which greatly improves the processing efficiency of the audio signal.
[0156] The audio signal processing device in the embodiment of the present application can be an electronic device, or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or other devices other than a terminal. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmented reality, AR) / virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0157] The audio signal processing device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0158] The audio signal processing device provided in the embodiment of the present application can achieve Figures 1 to 3 To avoid repetition, the various processes implemented by the method embodiment are not described here.
[0159] Alternatively, if Figure 5 As shown, an embodiment of the present application further provides an electronic device 500, including a processor 501 and a memory 502, wherein the memory 502 stores a program or instruction that can be executed on the processor 501, and when the program or instruction is executed by the processor 501, the various steps of the above-mentioned audio signal processing method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0160] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.
[0161] Figure 6 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present application.
[0162] The electronic device 100 includes but is not limited to components such as a radio frequency unit 101, a network module 102, an audio output unit 103, an input unit 104, a sensor 105, a display unit 106, a user input unit 107, an interface unit 108, a memory 109, and a processor 110.
[0163] Those skilled in the art will appreciate that the electronic device 100 may also include a power source (such as a battery) for supplying power to various components, and the power source may be logically connected to the processor 110 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Figure 6 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.
[0164] The processor 110 is configured to obtain a first audio signal frame sequence corresponding to the first audio signal, where the first audio signal frame sequence includes n audio signal frames, where n is an integer greater than 1;
[0165] The processor 110 is configured to obtain a second overlapping ratio based on a first overlapping ratio corresponding to the first audio signal frame sequence obtained by the processor 110 and a playback rate parameter of the first audio signal;
[0166] The processor 110 is configured to perform synthesis processing on the first audio signal frame sequence according to a second overlapping ratio to obtain a second audio signal;
[0167] The first overlapping ratio is: an overlapping ratio between two adjacent audio signal frames in the n audio signal frames.
[0168] Optionally, in the embodiment of the present application,
[0169] The processor 110 is further configured to determine a target window duration;
[0170] The processor 110 is further configured to perform frame processing on the first audio signal according to the target window duration and the first overlapping ratio coefficient determined by the processor 110 to obtain a first audio signal frame sequence.
[0171] Optionally, in the embodiment of the present application,
[0172] The processor 110 is specifically configured to calculate a ratio between the first difference and the playback speed ratio;
[0173] The processor 110 is specifically configured to obtain a second overlap ratio based on the ratio;
[0174] The first difference is the difference between 1 and the first overlap ratio, and the second overlap ratio is the difference between 1 and the ratio.
[0175] Optionally, in the embodiment of the present application,
[0176] When the playback speed ratio is less than 1, the audio duration of the second audio signal is greater than the audio duration of the first audio signal;
[0177] When the playback speed ratio is greater than 1, the audio duration of the second audio signal is shorter than the audio duration of the first audio signal.
[0178] Optionally, in an embodiment of the present application, the first overlap ratio is predefined, and a value of the first overlap ratio is within a first preset interval.
[0179] In the electronic device provided in the embodiment of the present application, the electronic device obtains a first audio signal frame sequence corresponding to a first audio signal, the first audio signal frame sequence includes n audio signal frames, n is an integer greater than 1, and based on the first overlap ratio corresponding to the first audio signal frame sequence and the playback rate parameter of the first audio signal, obtains a second overlap ratio, and then synthesizes the first audio signal frame sequence according to the second overlap ratio to obtain a second audio signal; wherein the first overlap ratio is: the overlap ratio between two adjacent audio signal frames in the n audio signal frames. Through this method, the electronic device can determine the second overlap ratio according to the overlap ratio between two adjacent audio signal frames in the n audio signal frames and the audio playback rate parameter, and synthesizes the n audio signal frames according to the second overlap ratio to achieve audio compression or expansion of the audio signal frame sequence, thereby obtaining an audio signal played according to the audio playback rate parameter, and the entire algorithm process is relatively simple and has a small amount of calculation, which greatly improves the processing efficiency of the audio signal.
[0180] It should be understood that in the embodiment of the present application, the input unit 104 may include a graphics processor (Graphics Processing Unit, GPU) 1041 and a microphone 1042, and the graphics processor 1041 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 106 may include a display panel 1061, and the display panel 1061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 107 includes a touch panel 1071 and at least one of other input devices 1072. The touch panel 1071 is also called a touch screen. The touch panel 1071 may include two parts: a touch detection device and a touch controller. Other input devices 1072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.
[0181] The memory 109 can be used to store software programs and various data. The memory 109 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 109 may include a volatile memory or a non-volatile memory, or the memory 109 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory 109 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.
[0182] The processor 110 may include one or more processing units; optionally, the processor 110 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 110.
[0183] An embodiment of the present application further provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned audio signal processing method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0184] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
[0185] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned audio signal processing method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0186] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0187] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned audio signal processing method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0188] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0189] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0190] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. An audio signal processing method, characterized in that: The method comprises: Acquire a first audio signal frame sequence corresponding to the first audio signal, where the first audio signal frame sequence includes n audio signal frames, where n is an integer greater than 1; obtaining a second overlapping ratio based on a first overlapping ratio corresponding to the first audio signal frame sequence and a playback rate parameter of the first audio signal; performing synthesis processing on the first audio signal frame sequence according to the second overlapping ratio to obtain a second audio signal; The first overlapping ratio is: an overlapping ratio between two adjacent audio signal frames in the n audio signal frames; The playback rate parameters include: playback speed ratio; The obtaining of a second overlapping ratio based on a first overlapping ratio corresponding to the first audio signal frame sequence and a playback rate parameter of the first audio signal comprises: Calculating a ratio of the first difference value to the playback speed ratio; Based on the ratio, obtaining a second overlap ratio; The first difference is the difference between 1 and the first overlap ratio, and the second overlap ratio is the difference between 1 and the ratio.
2. The method according to claim 1, characterized in that The obtaining of a first audio signal frame sequence corresponding to the first audio signal includes: Determine the target window duration; The first audio signal is subjected to frame processing according to the target window duration and the first overlap ratio to obtain the first audio signal frame sequence.
3. The method according to claim 2, characterized in that After the first audio signal is subjected to frame processing according to the target window duration and the first overlap ratio to obtain the first audio signal frame sequence, the method includes: Determining whether the duration of a target audio signal frame in the first audio signal frame sequence is equal to the target window duration; When the duration of the target audio signal frame is shorter than the duration of the target window, zero padding is performed on the target audio signal frame.
4. The method according to claim 1, characterized in that: The step of synthesizing the first audio signal frame sequence according to the second overlapping ratio to obtain a second audio signal includes: performing synthesis processing on the first audio signal frame sequence according to the second overlapping ratio to obtain a third audio signal; In the case where it is detected that the third audio signal includes invalid data, the invalid data is discarded to obtain the second audio signal.
5. An audio signal processing device, characterized in that: The device comprises: an acquisition module, a determination module and a processing module, wherein: The acquisition module is configured to acquire a first audio signal frame sequence corresponding to the first audio signal, wherein the first audio signal frame sequence includes n audio signal frames, where n is an integer greater than 1; The determining module is configured to obtain a second overlapping ratio based on the first overlapping ratio corresponding to the first audio signal frame sequence acquired by the acquiring module and a playback rate parameter of the first audio signal; The processing module is used to perform synthesis processing on the first audio signal frame sequence according to the second overlapping ratio to obtain a second audio signal; The first overlapping ratio is: an overlapping ratio between two adjacent audio signal frames in the n audio signal frames; The playback rate parameters include: playback speed ratio; The determination module is specifically used to calculate the ratio of the first difference and the playback speed ratio; The determining module is specifically configured to obtain a second overlapping ratio based on the ratio; The first difference is the difference between 1 and the first overlap ratio, and the second overlap ratio is the difference between 1 and the ratio.
6. The device according to claim 5, characterized in that The determination module is further used to determine the target window duration; The processing module is further configured to perform frame processing on the first audio signal according to the target window duration and the first overlapping ratio coefficient determined by the determination module to obtain the first audio signal frame sequence.
7. The device according to claim 6, characterized in that The processing module is further used to determine whether the duration of the target audio signal frame in the first audio signal frame sequence is equal to the target window duration; The processing module is further configured to perform zero padding processing on the target audio signal frame when the duration of the target audio signal frame is shorter than the duration of the target window.
8. The device according to claim 5, characterized in that The processing module is specifically configured to perform synthesis processing on the first audio signal frame sequence according to the second overlapping ratio to obtain a third audio signal; The processing module is specifically configured to discard the invalid data when detecting that the third audio signal includes invalid data, so as to obtain the second audio signal.
9. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a program or instruction that can be run on the processor, and when the program or instruction is executed by the processor, the steps of the audio signal processing method according to any one of claims 1 to 4 are implemented.
10. A readable storage medium, characterized in that: The readable storage medium stores a program or an instruction, and when the program or the instruction is executed by the processor, the steps of the audio signal processing method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Sound speed change method
CN102074239A
Image recognition method, video playing method, related equipment and medium
CN111310744A
Voice processing method and device, electronic equipment and storage medium
CN111739544A
Audio recording method, electronic equipment, medium and program product
CN113643728A
Audio signal time-scale modification method using variable length synthesis and reduced cross-correlation computation
CN1669070A
