Loudspeaker playing signal generation method and related device
By performing signal delay processing, inversion and filtering processing on the audio frame data, combined with the accumulation operation of odd and even items, the speaker playback signal is generated, which solves the crosstalk problem when dual speakers transmit left and right channel information, and improves audio quality. quality.
Patent Information
- Application Number
- CN202411538142.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-30
- Publication Date
- 2025-01-24
AI Technical Summary
Dual speakers are easily affected by audio crosstalk when transmitting left and right channels information, causing left channel information to be transmitted to the right ear and right channel information to be transmitted to the left ear, which in turn affects the sound effect. The crosstalk cancellation method will cause spectrum staining and destroy the audio. quality.
By performing signal delay processing on the audio frame data, inverting the audio signal, and filtering using a bidirectional filter, the maximum loudness value is calculated until it is less than the threshold, and the odd and even items of the audio frame data of the left and right channels are calculated. Accumulate separately to generate the playback signal of the speaker.
While ensuring the elimination of string disturbances, improve audio quality, avoid the negative effects of spectrum dyeing on audio quality, and realize the accurate transmission of speakers on left and right channel information.
Smart Images

Figure CN119364257A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of players, and in particular to a method for generating a loudspeaker playback signal and a related device. Background Art
[0002] For the same source, the sound effect of dual speakers is not as good as that of headphones. The reason is that the left and right channel information transmitted by headphones do not interfere with each other, and the left channel information can be accurately transmitted to the left ear and the right channel information to the right ear. However, dual speakers are affected by audio crosstalk and will transmit the left channel to the right ear and the right channel to the left ear. In order to solve the problem that dual speakers can accurately transmit left and right channel information, most of the current methods use crosstalk elimination. However, crosstalk elimination will bring about spectrum coloration problems, which will damage the audio quality. Summary of the invention
[0003] In view of the above problems, the present application provides a method and a related device for generating a speaker playback signal to achieve the purpose of improving audio quality while ensuring crosstalk elimination. The specific scheme is as follows:
[0004] A first aspect of the present application provides a method for generating a loudspeaker playback signal, comprising:
[0005] Performing signal delay processing on the audio frame data to obtain a delayed audio signal; wherein the audio frame data includes left channel audio frame data and right channel audio frame data;
[0006] Inverting the delayed audio signal to obtain an opposite signal;
[0007] Performing filtering on the opposite signal to obtain filtered audio frame data;
[0008] Calculating the maximum loudness value of the filtered audio frame data, and when the maximum loudness value is greater than a threshold, saving the filtered audio frame data, and performing the signal delay processing on the audio frame data until the maximum loudness value is less than the threshold, thereby obtaining audio frame saved data; wherein the audio frame saved data includes left channel audio frame saved data and right channel audio frame saved data;
[0009] Accumulate the odd-numbered items of the data stored in the left channel audio frame to obtain a left channel odd-numbered item signal, and accumulate the even-numbered items of the data stored in the left channel audio frame to obtain a left channel even-numbered item signal; accumulate the odd-numbered items of the data stored in the right channel audio frame to obtain a right channel odd-numbered item signal, and accumulate the even-numbered items of the data stored in the right channel audio frame to obtain a right channel even-numbered item signal; add the left channel odd-numbered item signal and the right channel even-numbered item signal to obtain a left channel playback signal of the speaker, and add the right channel odd-numbered item signal and the left channel even-numbered item signal to obtain a right channel playback signal of the speaker.
[0010] In a possible implementation, filtering the opposite signal to obtain filtered audio frame data includes:
[0011] Calculate the azimuth from the center of the listener's head to the speaker;
[0012] Get the gain factor coefficient corresponding to the current audio scene;
[0013] Obtaining a filter gain factor according to the azimuth angle and the gain factor coefficient;
[0014] Obtaining a filter coefficient according to the filter gain factor;
[0015] According to the filter coefficient, a bidirectional filter is used to filter the inverse signal to obtain the filtered audio frame data.
[0016] In a possible implementation, filtering the opposite signal to obtain the filtered audio frame data includes:
[0017] Determine the number of frame buffers according to the filter order; wherein the number of frame buffers is M, when the filter order is 1, M=1, and when the filter order is 2, M=2;
[0018] Adding the last M forward filtering input data of the previous frame before the opposite signal to obtain the forward filtering input data of the current frame;
[0019] Inputting the current frame forward filtering input data into a bidirectional filter for forward filtering to obtain the current frame forward filtering output data;
[0020] Invert the forward filtering output data of the current frame, and add the last M data of the reverse filtering output data of the previous frame before the inverted data to obtain the reverse filtering input data of the current frame;
[0021] Inputting the current frame reverse filtering input data into the bidirectional filter for reverse filtering to obtain the current frame reverse filtering output data;
[0022] The current frame reverse filtering output data is inverted to obtain the filtered audio frame data.
[0023] In a possible implementation, performing signal delay processing on the audio frame data to obtain a delayed audio signal includes:
[0024] The delay point is calculated based on the distance difference between the speaker and the listener's ears and the audio sampling rate;
[0025] Calculating integer and fractional values of the delay point using a fractional delay method;
[0026] Add the last integer value of the previous audio frame data before the current audio frame data to obtain the current sampling point;
[0027] Obtaining a delayed processing signal using a linear interpolation method according to the current sampling point, the integer value and the fractional value;
[0028] The delayed processed signal is normalized to obtain the delayed audio signal.
[0029] In a possible implementation, after obtaining the filtered audio frame data, the method further includes:
[0030] Calculate the air attenuation coefficient based on the distance from the loudspeaker to the listener's ears;
[0031] The filtered audio frame data is multiplied by the air attenuation coefficient to obtain attenuated audio frame data.
[0032] In a possible implementation, after the maximum loudness value is less than the threshold and the audio frame storage data is obtained, the method further includes:
[0033] Obtaining the number of cycles when the condition that the maximum loudness value is less than the threshold is satisfied;
[0034] In the case that the number of cycles is less than the preset number of cycles, a difference between the preset number of cycles and the number of cycles is obtained, and a number of 0s equal to the difference is added to the audio frame saved data.
[0035] A second aspect of the present application provides a speaker playback signal generation system, comprising:
[0036] A delay processing module, used for performing signal delay processing on the audio frame data to obtain a delayed audio signal; wherein the audio frame data includes left channel audio frame data and right channel audio frame data;
[0037] An inversion module, used for inverting the delayed audio signal to obtain an opposite signal;
[0038] A filtering module, used for filtering the opposite signal to obtain filtered audio frame data;
[0039] a loudness calculation module, configured to calculate the maximum loudness value of the filtered audio frame data, and when the maximum loudness value is greater than a threshold value, save the filtered audio frame data, and perform the signal delay processing on the audio frame data until the maximum loudness value is less than the threshold value, thereby obtaining audio frame saved data; wherein the audio frame saved data includes left channel audio frame saved data and right channel audio frame saved data;
[0040] The playback signal generating module is used to accumulate the odd-numbered items of the data stored in the left channel audio frame to obtain the left channel odd-numbered item signal, accumulate the even-numbered items of the data stored in the left channel audio frame to obtain the left channel even-numbered item signal; accumulate the odd-numbered items of the data stored in the right channel audio frame to obtain the right channel odd-numbered item signal, and accumulate the even-numbered items of the data stored in the right channel audio frame to obtain the right channel even-numbered item signal; add the left channel odd-numbered item signal and the right channel even-numbered item signal to obtain the left channel playback signal of the speaker, and add the right channel odd-numbered item signal and the left channel even-numbered item signal to obtain the right channel playback signal of the speaker.
[0041] A third aspect of the present application provides a computer program product, including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements the speaker playback signal generation method of the first aspect or any implementation of the first aspect.
[0042] A fourth aspect of the present application provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein:
[0043] The memory is used to store computer programs;
[0044] The processor is used to execute the computer program so that the electronic device can implement the speaker playback signal generation method of the above-mentioned first aspect or any implementation manner of the first aspect.
[0045] A fifth aspect of the present application provides a computer storage medium, which carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can use the speaker playback signal generation method of the above-mentioned first aspect or any implementation of the first aspect.
[0046] By means of the above technical solution, the speaker playback signal generation method and related device provided by the present application, when the maximum loudness value of the filtered audio data is less than the threshold value, it means that after a series of crosstalk elimination operations such as signal delay processing, inverted audio signal processing and filtering processing, the obtained elimination signal is reduced to the threshold value relative to the original signal, thereby achieving crosstalk elimination. At the same time, the present application does not use the filtered audio frame data obtained in the last cycle as the crosstalk elimination result, but instead uses the method of accumulating the audio frame data saved in each cycle to obtain the speaker playback signal, because the filtered audio frame data obtained in the last cycle has the greatest impact on the spectrum coloration, and the accumulation operation can effectively enhance the spectrum signal, thereby improving the audio quality while ensuring crosstalk elimination. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0048] Figure 1 A flow chart of a method for generating a loudspeaker playback signal provided in this application;
[0049] Figure 2 A structural diagram of a speaker playback signal generation system provided in this application;
[0050] Figure 3 A schematic diagram of the structure of an electronic device provided in this application. DETAILED DESCRIPTION
[0051] The following describes the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation method section of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.
[0052] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0053] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0054] Reference Figure 1 , Figure 1 A flow chart of a method for generating a loudspeaker playback signal provided in an embodiment of the present application is shown as follows: Figure 1 As shown, a method for generating a speaker playback signal provided in an embodiment of the present application may include steps 101 to 105, and these steps are described in detail below.
[0055] Step 101: performing signal delay processing on audio frame data to obtain a delayed audio signal; wherein the audio frame data includes left channel audio frame data and right channel audio frame data.
[0056] The audio frame data may be PCM (Pulse Code Modulation) data obtained by decoding the audio data in the player, and the audio sampling rate may also be obtained by decoding. The decoded PCM data and the audio sampling rate may be put into the data buffer, and one frame of data may be read from the buffer each time. The standard of AAC (Advanced Audio Coding) audio decoding is 1024*number of audio channels, where 1024 is the audio sampling point.
[0057] The audio frame data includes left channel audio data and right channel audio data. The signal delay processing of the audio frame data is to perform signal delay processing on the left channel audio data and the signal delay processing on the right channel audio data respectively. Since there is a difference in the time when the signal reaches the left and right ears, it is called interaural time difference (ITD) in the binaural effect. In order to eliminate this difference, the audio frame data can be subjected to signal delay processing to maintain signal consistency.
[0058] In an optional implementation, performing signal delay processing on the audio frame data to obtain a delayed audio signal includes:
[0059] The delay point is calculated based on the distance difference between the speaker and the listener's ears and the audio sampling rate;
[0060] The fractional delay method is used to calculate the integer and fractional values of the delay points;
[0061] Add the last integer value of the previous audio frame data before the current audio frame data to obtain the current sampling point;
[0062] According to the current sampling point, the integer value and the fractional value, a delayed processing signal is obtained by using a linear interpolation method;
[0063] The delayed processed signal is normalized to obtain a delayed audio signal.
[0064] The speaker may be a dual speaker. The distance from the speaker to the same-side ear is assumed to be d1, and the distance from the speaker to the opposite-side ear is assumed to be d2. The distance d1 from the speaker to the same-side ear can be calculated by the distance L from the listener to the midpoint of the speaker, half the distance S between the speakers, and the listener's head radius r. The specific formula is: The distance d2 from the speaker to the opposite ear can be obtained based on d1. The specific formula is: , the distance difference between the loudspeaker and the listener's ears , where the angle .
[0065] In practical applications, the listener's head radius can be obtained based on the standard of adult face size, for example, the distance can be 15.5 cm. The dual speaker distance can be queried based on different mobile phone models, for example, the distance can be 16 cm. The vertical distance from the human ear to the dual speakers can be set to be in daily use, such as when watching videos or listening to music, the user may place the mobile phone on the table, and the distance from the face to the mobile phone may be between 30 cm and 1 meter, for example, the distance can be 50 cm.
[0066] Before calculating the delay point, you can first calculate the delay time time_delay, which is the ratio of the absolute value of the distance difference between the speaker and the listener's ears to the speed of sound propagation in the air. The specific formula is: , where C is the speed of sound in air. The delay point is the product of the delay time and the audio sampling rate. The specific formula is sample_delay , where sr is the audio sampling rate.
[0067] After the delay point is obtained, the integer value f and the fractional value i of the delay point are calculated using the fractional delay method. The fractional value of the delay point is calculated because the fractional delay can provide a smoother and more natural signal delay effect and reduce the artificial traces in audio processing.
[0068] For the first frame of audio data, an integer value of f zero points can be added before the audio frame data, and the other data is equivalent to being moved backward by an integer value of f positions. For non-first frame audio data, such as the second frame audio data, the third frame audio data, etc., the last integer value of the previous audio frame data can be added before the current audio frame data to obtain the current sampling point. For example, the integer value f is 2, the first frame audio data is 0, 1, 2, 3, and the first frame audio data after delay is 0, 0, 0, 1, 2, 3. The second frame audio data is 4, 5, 6, 7, and the second frame audio data after delay is 2, 3, 4, 5, 6, 7. If there is a third frame audio data of 8, 9, 10, 11, the third frame audio needs to buffer 2 integer point values of the audio signal of the second frame, that is, the third frame audio data after delay is 6, 7, 8, 9, 10, 11.
[0069] After the integer delay, the fractional delay is performed. Specifically, linear interpolation can be used to process the remaining fractional delay. The delayed processing signal can be obtained by linear interpolation method according to the current sampling point, integer value and fractional value. The specific formula is: , where is the interpolation result, that is, the delayed processing signal. is the current sampling point, is the next sampling point.
[0070] Finally, the delayed processed signal is normalized to obtain a delayed audio signal. When performing the normalization process, the delayed processed signal may be multiplied by a reference amplitude ref divided by the maximum absolute value of the delayed processed signal so that its maximum amplitude is the same as the maximum amplitude of the original signal. The reference amplitude ref is the maximum absolute value of the audio frame data.
[0071] It should be noted that if the second frame of audio data adds an integer value of f zeros, i.e. 0, 0, 4, 5, 6, 7, like the first frame of audio data, then the fractional delay value calculated in the second frame of audio data will be significantly different from the fractional delay calculation result of the second half of the entire audio signal. However, if the last half of the audio signal of the first frame is buffered, The integer point value is buffered, that is, 2,3. When the integer delay is performed in the second frame, the buffer data of the previous frame is used. The result is 2,3,4,5,6,7. The decimal part delay result of the audio signal 0,1,2,3,4,5,6,7 is consistent, so there will be no data discontinuity problem caused by no buffering.
[0072] Step 102: Invert the delayed audio signal to obtain an opposite signal.
[0073] The inverted delayed audio signal is to arrange the delayed audio signal in a backward order. For example, if the delayed audio signal is 2, 3, 4, 5, 6, 7, then after the signal is inverted, the opposite signal obtained is 7, 6, 5, 4, 3, 2.
[0074] The speaker has two left signals, one is the left channel audio signal transmitted to the left ear , and the other is the right channel audio signal transmitted to the left ear Similarly, there are two signals on the right, one is the left channel audio signal transmitted to the right ear , and the other is the right channel signal transmitted to the right ear The purpose of inverting the audio signal is to create a phase difference. The addition of completely opposite signals can cancel each other out and the amplitude is 0. , and Infinitely close to 0, making the matrix close to a unit matrix, can ensure that the sound on the left can only be heard by the left ear, and the sound on the right can only be heard by the right ear, thus achieving crosstalk elimination.
[0075] Step 103: Filter the opposite signal to obtain filtered audio frame data.
[0076] A bidirectional filter can be used when filtering opposite signals, because the phase must be consistent, and a normal filter will cause the phase to shift backward, so a bidirectional filter is needed to ensure that the phase does not change. The operation process of the bidirectional filter is to first perform forward filtering, then invert the filtered signal, then perform reverse filtering, and finally invert the filtered signal to obtain the filter output signal. The bidirectional filter can be a first-order filter or a second-order filter. The filter can be a head shadow filter.
[0077] The coefficient of the head shadow filter can be determined by the azimuth angle theta from the center of the head to the speaker, as follows: .
[0078] Taking a first-order filter as an example, the coefficients of the first-order filter are:
[0079]
[0080]
[0081] in,
[0082]
[0083] Where a and b are first-order filter coefficients, w0 is an intermediate parameter, c is the speed of sound propagation in the air, sr is the audio sampling rate, and r is the head radius.
[0084] The first-order filter is a fixed gain filter and cannot simulate a complex loudness change curve, which will result in poor audio quality of the final speaker playback signal. Therefore, the first-order filter can be modified to enhance the ability to simulate complex audio scenes (such as head shadow effect).
[0085] In an optional implementation, the reverse signal is filtered using a bidirectional filter to obtain filtered audio frame data, including:
[0086] Calculate the azimuth from the center of the listener's head to the speaker;
[0087] Get the gain factor coefficient corresponding to the current audio scene;
[0088] Obtaining a filter gain factor according to the azimuth angle and the gain factor coefficient;
[0089] Obtaining filter coefficients according to the filter gain factor;
[0090] According to the filter coefficient, a bidirectional filter is used to filter the opposite signal to obtain filtered audio frame data.
[0091] The formula for the above filter gain factor is as follows:
[0092]
[0093] In the formula, is the filter gain factor, theta is the azimuth, and the gain factor coefficients are alpha_min and theta0 respectively. alpha_min is the gain fluctuation amplitude control parameter, and theta0 is the period control parameter. 1 represents the DC component of the gain, which means that when theta is 0, the base value of the gain alpha is 1, and no gain or attenuation occurs. alpha_min can be 0.5, which is taken from half of the amplitude of cos(x), indicating the fluctuation range of the gain within one and a half cycles of the cosine waveform. A smaller alpha_min value will reduce the gain variation and make the sound smoother; a larger alpha_min value will increase the gain fluctuation, which may cause more obvious sound changes or have an "impact" effect. (1-alpha_min) is the amplitude of the gain fluctuation, which indicates the range of gain variation between the maximum and minimum values. When theta changes, the gain will vary between 2alpha_min and 2. The modulation part of the cosine function takes theta as input and theta0 as the parameter to adjust the period of the cosine waveform. The value range of this cosine waveform is [-1, 1].
[0094] Create a gain factor coefficient that varies with the angle theta. This fluctuation can be used to simulate the propagation characteristics of sound in space, suitable for head shadow effect, and ensure that the intensity of the sound changes with the change of the sound source relative to the listener. Theta0 affects the period of the cosine wave and can be taken as , thus affecting the frequency at which the gain changes with angle. A smaller theta0 value will increase the period of the cosine wave, causing the gain to change more slowly, which is suitable for simulating slowly changing sound field effects; a larger theta0 value will reduce the period, causing the gain to change faster, which is suitable for simulating rapidly changing sound field effects.
[0095] According to the filter gain factor The filter coefficients of the two-way filter are obtained, and the filter coefficients of the two-way filter are as follows:
[0096]
[0097]
[0098] According to the filter coefficients, the opposite signal is filtered using a bidirectional filter to obtain filtered audio frame data. Since the modified first-order filter introduces a dynamic response, the ability to simulate complex audio scenes can be enhanced.
[0099] Since the player audio playback uses AAC audio frame processing, the above method will cause data discontinuity, thereby introducing noise problems. In order to solve the problem of data discontinuity and support real-time playback of the player, this application adopts a frame buffer method. The specific processing process is as follows:
[0100] The opposite signal is filtered to obtain filtered audio frame data, including:
[0101] The number of frame buffers is determined according to the filter order; wherein the number of frame buffers is M, when the filter order is 1, M=1, and when the filter order is 2, M=2;
[0102] Add the last M forward filtering input data of the previous frame before the opposite signal to obtain the forward filtering input data of the current frame;
[0103] Performing forward filtering on the current frame forward filtering input data in the bidirectional filter to obtain the current frame forward filtering output data;
[0104] Reverse the forward filtering output data of the current frame, and add the last M data of the reverse filtering output data of the previous frame before the reversed data to obtain the reverse filtering input data of the current frame;
[0105] Reverse filtering the reverse filtering input data of the current frame in the bidirectional filter to obtain reverse filtering output data of the current frame;
[0106] Invert the current frame reverse filtering output data to obtain filtered audio frame data.
[0107] It should be noted that when the audio frame data is the first frame, because there is no reference frame, when filtering, the reverse signal obtained after processing is directly input into the bidirectional filter for forward filtering, and then the forward filtering output data is inverted, and then reverse filtering is performed, and then the reverse filtering output data is inverted to obtain the filtered audio frame data corresponding to the first frame audio data. When the audio frame data is the second frame or the third frame, there is a reference frame, so frame buffer processing is required.
[0108] The number of frame buffers of a first-order filter is 1, and the number of frame buffers of a second-order filter is 2. The frame buffer processing process involved in the filtering process is further explained below by taking the second-order filter as an example.
[0109] In the first cycle, for the first frame, the forward filtering input data is a1, a2, a3, a4, a5. After the forward filtering process of the two-way filter, the forward filtering output data is b1, b2, b3, b4, b5. The forward filtering output data is inverted to obtain the reverse filtering input data of b5, b4, b3, b2, b1. After the reverse filtering process of the two-way filter, the reverse filtering output data is c1, c2, c3, c4, c5. For the second frame, the opposite signal obtained after processing in step 101 and step 102 is a6, a7, a8, a9, a10. In order to solve the problem of data discontinuity, it is necessary to add the last two forward filtering input data of the first frame before the opposite signal, that is, the forward filtering input data is a4, a5, a6, a7, a8, a9, a10. After the forward filtering process of the two-way filter, the forward filtering output data is b6, b7, b8, b9, b10. The forward filtering output data is inverted to obtain the reverse filtering input data of b5, b4, b3, b2, b1. After the reverse filtering process of the two-way filter, the forward filtering output data is b6, b7, b8, b9, b10. According to the reverse filtering, the reverse filtering input data is b10, b9, b8, b7, b6; but before reverse filtering, the frame buffer operation is also required, and the last two data of the reverse filtering output data of the first frame after inversion need to be added before the data, that is, c2 and c1 need to be added, so that the reverse filtering input data is c2, c1, b10, b9, b8, b7, b6. After reverse filtering by the bidirectional filter, the reverse filtering output data is c6, c7, c8, c9, c10. The frame buffer processing method of the third frame and subsequent audio frames is the same as that of the second frame, which will not be repeated here.
[0110] In the second cycle, for the first frame, the forward filtering input data is the previous reverse filtering output data c1, c2, c3, c4, c5 obtained after being processed by steps 101 and 102. For example, the forward filtering input data can be d1, d2, d3, d4, d5. After the forward filtering process of the bidirectional filter, the forward filtering output data is e1, e2, e3, e4, e5; the forward filtering output data is inverted to obtain the reverse filtering input data of e5, e4, e3, e2, e1. After the reverse filtering process of the bidirectional filter, the reverse filtering output data is f1, f2, f3, f4, f5. For the second frame, the opposite signal obtained after processing in step 101 and step 102 is d6, d7, d8, d9, d10. To solve the data discontinuity problem, it is necessary to add the last two forward filtering input data of the first frame before the opposite signal, that is, the forward filtering input data is d4, d5, d6, d7, d8, d9, d10. After the forward filtering process of the bidirectional filter, the forward filtering output data is e6, e7, e8, e9, e10; the forward filtering output data is inverted, and the reverse filtering input data is e10, e9, e8, e7, e6; but before the reverse filtering is performed, the frame buffer operation is also required, and the last two data of the reverse filtering output data of the first frame after the inversion need to be added before the data, that is, f2 and f1 need to be added, so that the reverse filtering input data is f2, f1, e10, e9, e8, e7, e6, after reverse filtering by the bidirectional filter, the reverse filtering output data is f6, f7, f8, f9, f10. The frame buffer processing method of the third frame and subsequent audio frames is similar to that of the second frame, which will not be repeated here.
[0111] It should be noted that the first cycle and the second cycle mentioned above refer to performing signal delay processing on the audio frame data to obtain a delayed audio signal, inverting the delayed audio signal to obtain an opposite signal, and using a bidirectional filter to filter the opposite signal to obtain the filtered audio frame data, which is a one-cycle process.
[0112] Of course, if the filter is a first-order filter, you only need to keep the last value of the previous frame's forward filtering input data and add it before the current frame's forward filtering input data; you also need to keep the first value of the previous frame's reverse filtering output data and add it before the current frame's reverse filtering input data.
[0113] In order to verify that the frame buffering processing provided by this application can solve the problem of data discontinuity, a second-order filter is used for forward filtering for exemplary explanation. Assuming the second-order filter coefficients b = [0.5, -2.0, 1.0], a = [1.0, -1.0, 0.5], and the audio frame data x = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15], with three cycles and 5 data per frame, it is explained how to buffer the data to avoid the noise problem caused by data discontinuity, thereby ensuring real-time effect.
[0114] The forward filter input data is
[0115] [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15];
[0116] The output data of forward filtering three times is
[0117] [0.5 -0.5 -2.25 -4.0 -5.375
[0118] -6.375 -7.1875 -8.0 -8.90625 -9.90625
[0119] -10.953125 -12.0 -13.0234375 -14.0234375 -15.01171875]
[0120] [0.25 -1.0 -0.75 1.75 5.1875 7.875 9.0625 9.125 8.953125 9.25 10.203125 11.578125 13.01171875 14.2578125 15.26953125]
[0123] [0.125 -0.875 0.9375 2.75 0.625
[0124] -5.4375 -11.78125 -14.75 -13.5703125 -10.3515625
[0125] -8.01171875 -8.203125 -10.64453125 -13.859375 -16.40625]
[0126] When processing 5 data per frame, the first frame has no reference frame;
[0127] The first frame input data is [1 2 3 4 5];
[0129] After forward filtering three times, the output data of the first frame is
[0130] [ 0.5 -0.5 -2.25 -4.0 -5.375 ]
[0131] [ 0.25 -1.0 -0.75 1.75 5.1875]
[0132] [ 0.125 -0.875 0.9375 2.75 0.625 ]
[0133] Keep the last two values of the first frame input data [4,5] and the last two values of the first frame output data of each filtering, and the resulting matrix is [-4.0, -5.375, 1.75, 5.1875, 2.75, 0.625].
[0134] For the second frame,
[0135] The first forward filtering input data is [4 5 6 7 8 9 10]
[0137] The first forward filtering output data is
[0138] [-6.375 -7.1875 -8.0 -8.90625 -9.90625]
[0139] Keep the last two values of the first frame output data of the first filtering [-4.0 -5.375], and update the matrix [1.75, 5.1875 2.75 0.625 -8.90625 -9.90625].
[0140] The second forward filtering input data is
[0141] [-4.0 -5.375 -6.375 -7.1875 -8.0 -8.90625 -9.90625]
[0142] The second forward filtering output data is [7.875 9.0625 9.125 8.953125 9.25]
[0144] Keep the last two values of the first frame output data of the second filtering [1.75 5.1875], and update the matrix [2.75, 0.625 -8.90625 -9.90625 8.953125 9.25].
[0145] The third forward filtering input data is [1.75 5.1875 7.875 9.0625 9.125 8.953125 9.25]
[0147] The third forward filtering output data is
[0148] [-5.4375 -11.78125 -14.75 -13.5703125 -10.3515625]
[0149] So far, the input data of the second frame is [4 5 6 7 8 9 10]
[0151] The output data of the second frame is
[0152] [-6.375 -7.1875 -8.0 -8.90625 -9.90625] [7.875 9.0625 9.125 8.953125 9.25]
[0154] [-5.4375 -11.78125 -14.75 -13.5703125 -10.3515625]
[0155] It can be seen that the output data of the second frame calculated at the frame level is consistent with the output data result of the second frame calculated in the whole process, which can avoid the noise problem caused by discontinuous data and support real-time playback of the player.
[0156] Since the calculation process of the third frame is similar to that of the second frame, it will not be repeated here.
[0157] In an optional embodiment, in order to reduce the number of cycles, after obtaining the filtered audio frame data, the following steps may be further included:
[0158] Calculate the air attenuation coefficient based on the distance from the loudspeaker to the listener's ears;
[0159] The filtered audio frame data is multiplied by the air attenuation coefficient to obtain attenuated audio frame data.
[0160] Since the left and right channels are distinguished, the sizes of d1 and d2 will change, so it is necessary to ensure that the simulated air attenuation formula is always less than 1, and the air attenuation coefficient is inversely proportional to the distance.
[0161] The simulated air attenuation formula is:
[0162]
[0163] Where attenuation is the air attenuation coefficient.
[0164] Multiply the filtered audio frame data by the air attenuation coefficient to obtain the attenuated audio frame data. The specific formula is: , where y' is the attenuated audio frame data and y is the filtered audio frame data.
[0165] Because there are interaural level differences (ILDs) between the binaural effects, the same signal will have initial and or and There is a difference, so filtering and attenuation need to be calculated after delay inversion.
[0166] Step 104: Calculate the maximum loudness value of the filtered audio frame data. When the maximum loudness value is greater than a threshold, save the filtered audio frame data, and perform signal delay processing on the audio frame data until the maximum loudness value is less than the threshold, thereby obtaining audio frame saved data; wherein the audio frame saved data includes left channel audio frame saved data and right channel audio frame saved data.
[0167] In actual calculations, the standard for being infinitely close to 0 is or The elimination signal is lower than -96db. The dynamic range of 16-bit audio is about 96 decibels. With 0 decibel as the maximum decibel value, -96db can be taken as the threshold.
[0168] When calculating the maximum loudness value, if the maximum loudness value is greater than -96 db, the filtered audio frame data cancel_sig is retained and saved, and the process continues from step 101 to step 103 until the maximum loudness value is less than -96 db.
[0169] Due to the real-time requirement of the playback process, when the loudness calculation determines that the threshold is met, the number of cycles for each frame is actually different. The input and output of the real-time filtering in step 103 requires a one-to-one correspondence between each frame and each cycle. Therefore, after the maximum loudness value is less than the threshold and the audio frame is saved, the following is also included:
[0170] Get the number of loops when the condition that the maximum loudness value is less than the threshold is met;
[0171] When the number of loops is less than the preset number of times, the difference between the preset number of times and the number of loops is obtained, and a number of 0s equal to the difference is added to the audio frame saved data.
[0172] In actual applications, when the current frame calculation has met the loudness calculation judgment requirement (here, it is assumed to be N times), the air attenuation is set to 0, and steps 101 to 103 are cycled N times to prepare the buffer data that may be needed. Each subsequent frame needs to be calculated 2N times. If the number of cycles for the second frame less than -96db is M, the air attenuation is set to 0 and the cycle is continued for 2N-M times to obtain the final audio frame saved data. The number of data saved in the audio frame is 2N.
[0173] It should be noted that, after obtaining the filtered audio frame data, the air attenuation coefficient is calculated according to the distance from the speaker to the listener's ears, and the filtered audio frame data is multiplied by the air attenuation coefficient to obtain the attenuated audio frame data, then in step 104, the maximum loudness value of the attenuated audio frame data needs to be calculated, and when the maximum loudness value is greater than the threshold, the attenuated audio frame data is saved.
[0174] Step 105: accumulate the odd-numbered items of the data stored in the left channel audio frame to obtain the left channel odd-numbered item signal, accumulate the even-numbered items of the data stored in the left channel audio frame to obtain the left channel even-numbered item signal; accumulate the odd-numbered items of the data stored in the right channel audio frame to obtain the right channel odd-numbered item signal, accumulate the even-numbered items of the data stored in the right channel audio frame to obtain the right channel even-numbered item signal; add the left channel odd-numbered item signal and the right channel even-numbered item signal to obtain the left channel playback signal of the speaker, and add the right channel odd-numbered item signal and the left channel even-numbered item signal to obtain the right channel playback signal of the speaker.
[0175] Assuming the number of loops is 2N, accumulating the odd-numbered items of the left channel audio frame data means accumulating the same position data of the audio frame data of the left channel for the first loop, the third loop, ..., and the 2N-1 loop; accumulating the even-numbered items of the left channel audio frame data means accumulating the same position data of the audio frame data of the left channel for the second, fourth, ..., and 2N loops. The audio data of the right channel is similar and will not be repeated here.
[0176] Step 104 can obtain the crosstalk cancellation and as well as and Because each time the phase is reversed, the direction of signal transmission will also change accordingly. Saves the cumulative sum of the odd-numbered items of data for the left channel audio frame, Saves the cumulative sum of the even-numbered items of data for the left channel audio frame, Saves the cumulative sum of the even-numbered items of data for the right channel audio frame, The cumulative sum of the odd-numbered items of the right channel audio frame data is saved. The reason why the last result is not directly used as the crosstalk elimination result but the sum of each time is taken is that the last result has the greatest impact on the spectrum coloration, and accumulation can superimpose the spectrum again and again, which can effectively enhance the spectrum signal and also enhance the crosstalk elimination effect.
[0177] Finally, add the left channel odd-numbered signals and the right channel even-numbered signals, that is, and Add together to get the left channel playback signal of the speaker, because It is the sum of the opposite phase cancellation signals, eliminating the crosstalk between the right ear and the left ear, so that only the left ear can hear the left channel. Add the right channel odd-numbered signals to the left channel even-numbered signals, that is, and Add them together to get the right channel playback signal of the speaker. So far, the actual signal played by the speaker in the current frame is obtained.
[0178] The spectral coloration problem is mainly caused by the problem that the color of the specific frequency spectrum is too dark due to the filter. The present application can effectively enhance the spectrum signal through the accumulation operation of step 105, and through the improvement of the filter in step 103, the number of cycles can be dynamically adjusted to improve the audio quality while ensuring the elimination of crosstalk. In addition, the frame buffer processing in step 103 can solve the problem of data discontinuity and support real-time playback on the mobile terminal of the player. The method provided in this application can solve the problem that the sound effect of dual speakers of the same source is not as good as that of headphones, effectively realize the enhancement of speaker sound effects, and optimize the spectral coloration problem of speaker crosstalk.
[0179] A method for generating a loudspeaker playback signal provided in an embodiment of the present application is introduced above. A system for executing the method for generating a loudspeaker playback signal will be introduced below.
[0180] See also Figure 2 , Figure 2 This is a schematic diagram of the structure of a speaker playback signal generation system provided in an embodiment of the present application. Figure 2 As shown, the speaker playback signal generation system includes:
[0181] The delay processing module 201 is used to perform signal delay processing on the audio frame data to obtain a delayed audio signal; wherein the audio frame data includes left channel audio frame data and right channel audio frame data;
[0182] An inversion module 202, used to invert the delayed audio signal to obtain an opposite signal;
[0183] The filtering module 203 is used to filter the opposite signal using a bidirectional filter to obtain filtered audio frame data;
[0184] The loudness calculation module 204 is used to calculate the maximum loudness value of the filtered audio frame data. When the maximum loudness value is greater than a threshold, the filtered audio frame data is saved, and a signal delay process is performed on the audio frame data until the maximum loudness value is less than the threshold, thereby obtaining audio frame saved data; wherein the audio frame saved data includes left channel audio frame saved data and right channel audio frame saved data;
[0185] The playback signal generating module 205 is used to accumulate the odd-numbered items of the data stored in the left channel audio frame to obtain the left channel odd-numbered item signal, accumulate the even-numbered items of the data stored in the left channel audio frame to obtain the left channel even-numbered item signal; accumulate the odd-numbered items of the data stored in the right channel audio frame to obtain the right channel odd-numbered item signal, and accumulate the even-numbered items of the data stored in the right channel audio frame to obtain the right channel even-numbered item signal; add the left channel odd-numbered item signal and the right channel even-numbered item signal to obtain the left channel playback signal of the speaker, and add the right channel odd-numbered item signal and the left channel even-numbered item signal to obtain the right channel playback signal of the speaker.
[0186] In a possible implementation, the filtering module 203 is specifically configured to:
[0187] Calculate the azimuth from the center of the listener's head to the speaker;
[0188] Get the gain factor coefficient corresponding to the current audio scene;
[0189] Obtaining a filter gain factor according to the azimuth angle and the gain factor coefficient;
[0190] Obtaining filter coefficients according to the filter gain factor;
[0191] According to the filter coefficient, a bidirectional filter is used to filter the opposite signal to obtain filtered audio frame data.
[0192] In another possible implementation, the filtering module 203 is further configured to:
[0193] The number of frame buffers is determined according to the filter order; wherein the number of frame buffers is M, when the filter order is 1, M=1, and when the filter order is 2, M=2;
[0194] Add the last M forward filtering input data of the previous frame before the opposite signal to obtain the forward filtering input data of the current frame;
[0195] Input the current frame forward filtering input data into the bidirectional filter for forward filtering to obtain the current frame forward filtering output data;
[0196] Reverse the forward filtering output data of the current frame, and add the last M data of the reverse filtering output data of the previous frame before the reversed data to obtain the reverse filtering input data of the current frame;
[0197] Inputting the reverse filtering input data of the current frame into the bidirectional filter for reverse filtering to obtain the reverse filtering output data of the current frame;
[0198] Invert the current frame reverse filtering output data to obtain filtered audio frame data.
[0199] In another possible implementation, the delay processing module 201 is specifically configured to:
[0200] The delay point is calculated based on the distance difference between the speaker and the listener's ears and the audio sampling rate;
[0201] The fractional delay method is used to calculate the integer and fractional values of the delay points;
[0202] Add the last integer value of the previous audio frame data before the current audio frame data to obtain the current sampling point;
[0203] According to the current sampling point, the integer value and the fractional value, a delayed processing signal is obtained by using a linear interpolation method;
[0204] The delayed processed signal is normalized to obtain a delayed audio signal.
[0205] In another possible implementation, the speaker playback signal generation system further includes:
[0206] The attenuation module is used to calculate the air attenuation coefficient according to the distance from the speaker to the listener's ears after obtaining the filtered audio frame data; multiply the filtered audio frame data by the air attenuation coefficient to obtain the attenuated audio frame data.
[0207] In another possible implementation, the loudness calculation module 204 is specifically configured to:
[0208] When the maximum loudness value is less than the threshold value and the audio frame saved data is obtained, the number of loops when the condition that the maximum loudness value is less than the threshold value is satisfied is obtained; when the number of loops is less than the preset number of times, the difference between the preset number of times and the number of loops is obtained, and the number of 0s equal to the difference is added to the audio frame saved data.
[0209] The present application also provides an electronic device in an embodiment. Figure 3 As shown, it shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiment of the present application. The electronic device in the embodiment of the present application may include but is not limited to fixed terminals such as mobile phones, laptops, PDAs (personal digital assistants), PADs (tablet computers), desktop computers, etc. Figure 3 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0210] like Figure 3 As shown, the electronic device may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 301, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 302 or a program loaded from a storage device 308 to a random access memory (RAM) 303. When the electronic device is powered on, various programs and data required for the operation of the electronic device are also stored in the RAM 303. The processing device 301, the ROM 302, and the RAM 303 are connected to each other via a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.
[0211] Typically, the following devices may be connected to the I / O interface 305: an input device 306 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 307 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 308 including, for example, a memory card, a hard disk, etc.; and a communication device 309. The communication device 309 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although Figure 3 An electronic device having various devices is shown, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0212] An embodiment of the present application also provides a computer program product including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements any one of the speaker playback signal generation methods provided in the embodiments of the present application.
[0213] A computer-readable storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any of the speaker playback signal generation methods provided in the embodiments of the present application.
[0214] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.
[0215] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0216] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0217] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.
Claims
1. A method for generating a loudspeaker playback signal, characterized in that: include: Performing signal delay processing on the audio frame data to obtain a delayed audio signal; wherein the audio frame data includes left channel audio frame data and right channel audio frame data; Inverting the delayed audio signal to obtain an opposite signal; Performing filtering on the opposite signal to obtain filtered audio frame data; Calculating the maximum loudness value of the filtered audio frame data, and when the maximum loudness value is greater than a threshold, saving the filtered audio frame data, and performing the signal delay processing on the audio frame data until the maximum loudness value is less than the threshold, thereby obtaining audio frame saved data; wherein the audio frame saved data includes left channel audio frame saved data and right channel audio frame saved data; Accumulate the odd-numbered items of the data stored in the left channel audio frame to obtain a left channel odd-numbered item signal, and accumulate the even-numbered items of the data stored in the left channel audio frame to obtain a left channel even-numbered item signal; accumulate the odd-numbered items of the data stored in the right channel audio frame to obtain a right channel odd-numbered item signal, and accumulate the even-numbered items of the data stored in the right channel audio frame to obtain a right channel even-numbered item signal; add the left channel odd-numbered item signal and the right channel even-numbered item signal to obtain a left channel playback signal of the speaker, and add the right channel odd-numbered item signal and the left channel even-numbered item signal to obtain a right channel playback signal of the speaker.
2. The method for generating a loudspeaker playback signal according to claim 1, characterized in that: The filtering the opposite signal to obtain filtered audio frame data includes: Calculate the azimuth from the center of the listener's head to the speaker; Get the gain factor coefficient corresponding to the current audio scene; Obtaining a filter gain factor according to the azimuth angle and the gain factor coefficient; Obtaining a filter coefficient according to the filter gain factor; According to the filter coefficient, a bidirectional filter is used to filter the inverse signal to obtain the filtered audio frame data.
3. The method for generating a loudspeaker playback signal according to claim 1 or 2, characterized in that: The filtering the opposite signal to obtain the filtered audio frame data includes: Determine the number of frame buffers according to the filter order; wherein the number of frame buffers is M, when the filter order is 1, M=1, and when the filter order is 2, M=2; Adding the last M forward filtering input data of the previous frame before the opposite signal to obtain the forward filtering input data of the current frame; Inputting the current frame forward filtering input data into a bidirectional filter for forward filtering to obtain the current frame forward filtering output data; Invert the forward filtering output data of the current frame, and add the last M data of the reverse filtering output data of the previous frame before the inverted data to obtain the reverse filtering input data of the current frame; Inputting the current frame reverse filtering input data into the bidirectional filter for reverse filtering to obtain the current frame reverse filtering output data; The current frame reverse filtering output data is inverted to obtain the filtered audio frame data.
4. The method for generating a loudspeaker playback signal according to claim 1 or 2, characterized in that: The step of performing signal delay processing on the audio frame data to obtain a delayed audio signal includes: The delay point is calculated based on the distance difference between the speaker and the listener's ears and the audio sampling rate; Calculating integer and fractional values of the delay point using a fractional delay method; Add the last integer value of the previous audio frame data before the current audio frame data to obtain the current sampling point; Obtaining a delayed processing signal using a linear interpolation method according to the current sampling point, the integer value and the fractional value; The delayed processed signal is normalized to obtain the delayed audio signal.
5. The method for generating a loudspeaker playback signal according to claim 1 or 2, characterized in that: After obtaining the filtered audio frame data, the method further includes: Calculate the air attenuation coefficient based on the distance from the loudspeaker to the listener's ears; The filtered audio frame data is multiplied by the air attenuation coefficient to obtain attenuated audio frame data.
6. The method for generating a loudspeaker playback signal according to claim 3, characterized in that: When the maximum loudness value is less than the threshold value and the audio frame storage data is obtained, the method further includes: Obtaining the number of cycles when the condition that the maximum loudness value is less than the threshold is satisfied; In the case that the number of cycles is less than the preset number of cycles, a difference between the preset number of cycles and the number of cycles is obtained, and a number of 0s equal to the difference is added to the audio frame saved data.
7. A speaker playback signal generation system, characterized in that: include: A delay processing module, used for performing signal delay processing on the audio frame data to obtain a delayed audio signal; wherein the audio frame data includes left channel audio frame data and right channel audio frame data; An inversion module, used for inverting the delayed audio signal to obtain an opposite signal; A filtering module, used for filtering the opposite signal to obtain filtered audio frame data; a loudness calculation module, configured to calculate the maximum loudness value of the filtered audio frame data, and when the maximum loudness value is greater than a threshold value, save the filtered audio frame data, and perform the signal delay processing on the audio frame data until the maximum loudness value is less than the threshold value, thereby obtaining audio frame saved data; wherein the audio frame saved data includes left channel audio frame saved data and right channel audio frame saved data; The playback signal generating module is used to accumulate the odd-numbered items of the data stored in the left channel audio frame to obtain the left channel odd-numbered item signal, accumulate the even-numbered items of the data stored in the left channel audio frame to obtain the left channel even-numbered item signal; accumulate the odd-numbered items of the data stored in the right channel audio frame to obtain the right channel odd-numbered item signal, and accumulate the even-numbered items of the data stored in the right channel audio frame to obtain the right channel even-numbered item signal; add the left channel odd-numbered item signal and the right channel even-numbered item signal to obtain the left channel playback signal of the speaker, and add the right channel odd-numbered item signal and the left channel even-numbered item signal to obtain the right channel playback signal of the speaker.
8. A computer program product, characterized in that The method comprises computer-readable instructions, and when the computer-readable instructions are executed on an electronic device, the electronic device implements the method for generating a loudspeaker playback signal as claimed in any one of claims 1 to 6.
9. An electronic device, characterized in that: The method comprises at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program so that the electronic device can implement the speaker playback signal generation method according to any one of claims 1 to 6.
10. A computer storage medium, characterized in that: The storage medium carries one or more computer programs, and when the one or more computer programs are executed by an electronic device, the electronic device can implement the speaker playback signal generation method as described in any one of claims 1 to 6.