Virtual stereo synthesis method and apparatus
09763020 · 2017-09-12
Assignee
Inventors
Cpc classification
H04S1/002
ELECTRICITY
H04S2420/01
ELECTRICITY
H04S2400/15
ELECTRICITY
H04R5/04
ELECTRICITY
H04S2400/11
ELECTRICITY
International classification
H04S7/00
ELECTRICITY
H04R5/04
ELECTRICITY
H04S3/00
ELECTRICITY
Abstract
A virtual stereo synthesis method includes acquiring at least one sound input signal on a first side and at least one sound input signal on a second side, separately performing ratio processing on a preset head related transfer function (HRTF) left-ear component and a preset HRTF right-ear component of each sound input signal on the second side, to obtain a filtering function of each sound input signal on the second side, separately performing convolution filtering on each sound input signal on the second side and the filtering function of the sound input signal on the second side, to obtain the filtered signal on the second side, and synthesizing all of the sound input signals on the first side and all of the filtered signals on the second side into a virtual stereo signal where the method may alleviate a coloration effect, and reduce calculation complexity.
Claims
1. A virtual stereo synthesis method, comprising: acquiring at least one sound input signal on a first side and at least one sound input signal on a second side; separately performing ratio processing on a preset head related transfer function (HRTF) left-ear component and a preset HRTF right-ear component of each sound input signal on the second side, to obtain a filtering function of each of the sound input signals on the second side; separately performing convolution filtering on each of the sound input signals on the second side and the filtering function of each of the sound input signals on the second side, to obtain filtered signals on the second side; and synthesizing all of the sound input signals on the first side and all of the filtered signals on the second side into a virtual stereo signal, wherein synthesizing all of the sound input signals on the first side and all of the filtered signals on the second side comprises: summating all of the sound input signals on the first side and all of the filtered signals on the second side to obtain a synthetic signal; performing, using a fourth-order infinite impulse response (IIR) filter, timbre equalization on the synthetic signal; and using the timbre-equalized synthetic signal as the virtual stereo signal.
2. The method according to claim 1, wherein separately performing the ratio processing comprises: separately using a ratio of a left-ear frequency domain parameter to a right-ear frequency domain parameter of each of the sound input signals on the second side as a frequency-domain filtering function of each of the sound input signals on the second side, wherein the left-ear frequency domain parameter is related to the preset HRTF left-ear component and wherein-the right-ear frequency domain parameter is related to the preset HRTF right-ear component; separately transforming the frequency-domain filtering function of each of the sound input signals on the second side to a time-domain function; and using the time-domain function as the filtering function of each of the sound input signals on the second side.
3. The method according to claim 2, wherein separately transforming the frequency-domain filtering function of each of the sound input signals on the second side comprises separately performing minimum phase filtering on the frequency-domain filtering function of each of the sound input signals on the second side.
4. The method according to claim 2, further comprising: separately using a frequency domain of the preset HRTF left-ear component of each of the sound input signals on the second side as the left-ear frequency domain parameter of each of the sound input signals on the second side, and separately using a frequency domain of the preset HRTF right-ear component of each of the sound input signals on the second side as the right-ear frequency domain parameter of each of the sound input signals on the second side; separately using a frequency domain of the preset HRTF left-ear component of each of the sound input signals on the second side as the left-ear frequency domain parameter of each of the sound input signals on the second side after diffuse-field equalization or subband smoothing, and separately using the frequency domain of the preset HRTF right-ear component of each of the sound input signals on the second side as the right-ear frequency domain parameter of each of the sound input signals on the second side after the diffuse-field equalization or the subband smoothing; or separately using the frequency domain of the preset HRTF left-ear component of each of the sound input signals on the second side as the left-ear frequency domain parameter of each of the sound input signals on the second side after diffuse-field equalization and subband smoothing is performed in sequence, and separately using the frequency domain of the preset HRTF right-ear component of each of the sound input signals on the second side as the right-ear frequency domain parameter of each of the sound input signals on the second side after diffuse-field equalization and subband smoothing is performed in sequence.
5. The method according to claim 1, wherein separately performing convolution filtering on each of the sound input signals on the second side and the filtering function of each of the sound input signals on the second side comprises: separately performing reverberation processing on each of the sound input signals on the second side; using the reverberation processed signals as sound reverberation signals on the second side; and separately performing convolution filtering on each of the sound reverberation signals on the second side and the filtering function of the corresponding sound input signals on the second side, to obtain the filtered signals on the second side.
6. The method according to claim 5, wherein separately performing the reverberation processing on each of the sound input signals on the second side, and using the reverberation processed signals as the sound reverberation signals on the second side comprises: separately passing each of the sound input signals on the second side through an all-pass filter, to obtain a reverberation signal of each of the sound input signals on the second side; and separately synthesizing each of the sound input signals on the second side and the reverberation signal of each of the sound input signals on the second side into the sound reverberation signals on the second side.
7. A virtual stereo synthesis apparatus, comprising: a memory comprising instructions; and a processor coupled to the memory, wherein the instructions cause the processor to be configured to: acquire at least one sound input signal on a first side and at least one sound input signal on a second side; separately perform ratio processing on a preset head related transfer function (HRTF) left-ear component and a preset HRTF right-ear component of each sound input signal on the second side, to obtain a filtering function of each of the sound input signals on the second side; separately perform convolution filtering on each of the sound input signals on the second side and on the filtering function of each of the sound input signals on the second side, to obtain filtered signals on the second side; and synthesize all of the sound input signals on the first side and all of the filtered signals on the second side; summate all of the sound input signals on the first side and all of the filtered signals on the second side to obtain a synthetic signal; perform, using a fourth-order infinite impulse response (IIR) filter, timbre equalization on the synthetic signal; and use the timbre-equalized synthetic signal as a virtual stereo signal.
8. The virtual stereo synthesis apparatus according to claim 7, wherein the instructions further cause the processor to be configured to: separately use a ratio of a left-ear frequency domain parameter to a right-ear frequency domain parameter of each of the sound input signals on the second side as a frequency-domain filtering function of each of the sound input signals on the second side, wherein the left-ear frequency domain parameter is related to the preset HRTF left-ear component, and wherein the right-ear frequency domain parameter is related to the preset HRTF right-ear component; separately transform the frequency-domain filtering function of each of the sound input signals on the second side to a time-domain function; and use the time-domain function as the filtering function of each of the sound input signals on the second side.
9. The virtual stereo synthesis apparatus according to claim 8, wherein the instructions further cause the processor to be configured to separately perform minimum phase filtering on the frequency-domain filtering function of each of the sound input signals on the second side.
10. The virtual stereo synthesis apparatus according to claim 8, wherein the instructions further cause the processor to be configured to: separately use a frequency domain of the preset HRTF left-ear component of each of the sound input signals on the second side as the left-ear frequency domain parameter of each of the sound input signals on the second side, and separately use a frequency domain of the preset HRTF right-ear component of each of the sound input signals on the second side as the right-ear frequency domain parameter of each of the sound input signals on the second side; separately use a frequency domain of the preset HRTF left-ear component of each of the sound input signals on the second side as the left-ear frequency domain parameter of each of the sound input signals on the second side after diffuse-field equalization or subband smoothing, and separately use the frequency domain of the preset HRTF right-ear component of each of the sound input signals on the second side as the right-ear frequency domain parameter of each of the sound input signals on the second side after the diffuse-field equalization or the subband smoothing; or separately use the frequency domain, after diffuse-field equalization and subband smoothing is performed in sequence, of the preset HRTF left-ear component of each of the sound input signals on the second side as the left-ear frequency domain parameter of each of the sound input signals on the second side, and separately use the frequency domain of the preset HRTF right-ear component of each of the sound input signals on the second side as the right-ear frequency domain parameter of each of the sound input signals on the second side after diffuse-field equalization and subband smoothing is performed in sequence.
11. The virtual stereo synthesis apparatus according to claim 7, wherein the instructions further cause the processor to be configured to: separately perform reverberation processing on each of the sound input signals on the second side; use the reverberation processed signals as sound reverberation signals on the second side; and separately perform convolution filtering on each of the sound reverberation signals on the second side and the filtering function of the corresponding sound input signals on the second side, to obtain the filtered signals on the second side.
12. The virtual stereo synthesis apparatus according to claim 11, wherein the instructions further cause the processor to be configured to: separately pass each of the sound input signals on the second side through an all-pass filter, to obtain a reverberation signal of each of the sound input signals on the second side; and separately synthesize each of the sound input signals on the second side and the reverberation signal of each of the sound input signals on the second side into the sound reverberation signals on the second side.
13. A non-transitory computer readable storage medium including at least one computer program code stored therein to perform virtual stereo synthesis associated with a computing device wherein when executed on a processor, the computer readable medium causes the processor to: acquire at least one sound input signal on a first side and at least one sound input signal on a second side; separately perform ratio processing on a preset head related transfer function (HRTF) left-ear component and a preset HRTF right-ear component of each sound input signal on the second side, to obtain a filtering function of each of the sound input signals on the second side; separately perform convolution filtering on each of the sound input signals on the second side and the filtering function of each of the sound input signals on the second side, to obtain filtered signals on the second side; and synthesize all of the sound input signals on the first side and all of the filtered signals on the second side; summate all of the sound input signals on the first side and all of the filtered signals on the second side to obtain a synthetic signal; perform, using a fourth-order infinite impulse response (IIR) filter, timbre equalization on the synthetic signal; and use the timbre-equalized synthetic signal as a virtual stereo signal.
14. The non-transitory computer readable storage medium according to claim 13, wherein the computer readable medium further causes the processor to be configured to: separately use a ratio of a left-ear frequency domain parameter to a right-ear frequency domain parameter of each of the sound input signals on the second side as a frequency-domain filtering function of each of the sound input signals on the second side, wherein the left-ear frequency domain parameter is related to the preset HRTF left-ear component, and wherein the right-ear frequency domain parameter is related to the preset HTRF right-ear component; separately transform the frequency-domain filtering function of each of the sound input signals on the second side to a time-domain function; and use the time-domain function as the filtering function of each of the sound input signals on the second side.
15. The non-transitory computer readable storage medium according to claim 14, wherein the computer readable medium further causes the processor to be configured to: separately perform minimum phase filtering on the frequency-domain filtering function of each of the sound input signals on the second side; transform the frequency-domain filtering function to the time-domain function; and use the time-domain function as the filtering function of each of the sound input signals on the second side.
16. The non-transitory computer readable storage medium according to claim 14, wherein the computer readable medium further causes the processor to be configured to: separately use a frequency domain of the preset HRTF left-ear component of each of the sound input signals on the second side as the left-ear frequency domain parameter of each of the sound input signal on the second side, and separately use a frequency domain of the preset HRTF right-ear component of each of the sound input signals on the second side as the right-ear frequency domain parameter of each of the sound input signals on the second side; separately use a frequency domain of the preset HRTF left-ear component of each of the sound input signals on the second side as the left-ear frequency domain parameter of each of the sound input signals on the second side after diffuse-field equalization or subband smoothing, and separately use the frequency domain of the preset HRTF right-ear component of each of the sound input signals on the second side as the right-ear frequency domain parameter of each of the sound input signals on the second side after diffuse-field equalization or subband smoothing; or separately use the frequency domain of the preset HRTF left-ear component of each of the sound input signals on the second side as the left-ear frequency domain parameter of each of the sound input signals on the second side after diffuse-field equalization and subband smoothing is performed in sequence, and separately use the frequency domain of the preset HRTF right-ear component of each of the sound input signals on the second side as the right-ear frequency domain parameter of each of the sound input signals on the second side after diffuse-field equalization and subband smoothing is performed in sequence.
17. The non-transitory computer readable storage medium according to claim 13, wherein the computer readable medium further causes the processor to be configured to: separately perform reverberation processing on each of the sound input signals on the second side; use the reverberation processed signals as sound reverberation signals on the second side; and separately perform convolution filtering on each of the sound reverberation signals on the second side and the filtering function of the corresponding sound input signals on the second side, to obtain the filtered signals on the second side.
18. The non-transitory computer readable storage medium according to claim 17, wherein the computer readable medium further causes the processor to be configured to: separately pass each of the sound input signals on the second side through an all-pass filter, to obtain a reverberation signal of each of the sound input signals on the second side; and separately synthesize each of the sound input signals on the second side and the reverberation signal of each of the sound input signals on the second side into the sound reverberation signals on the second side.
19. A virtual stereo synthesis method, comprising: acquiring at least one sound input signal on a first side and at least one sound input signal on a second side; separately performing ratio processing on a preset head related transfer function (HRTF) left-ear component and a preset HRTF right-ear component of each sound input signal on the second side, to obtain a filtering function of each of the sound input signals on the second side; separately performing convolution filtering on each of the sound input signals on the second side and the filtering function of each of the sound input signals on the second side, to obtain filtered signals on the second side; summating all of the sound input signals on the first side and all of the filtered signals on the second side to obtain a synthetic signal; performing, using a fourth-order infinite impulse response (IIR) filter, timbre equalization on the synthetic signal; and using the timbre-equalized synthetic signal as a virtual stereo signal.
20. A virtual stereo synthesis apparatus, comprising: a memory comprising instructions; and a processor coupled to the memory, wherein the instructions cause the processor to be configured to: acquire at least one sound input signal on a first side and at least one sound input signal on a second side; separately perform ratio processing on a preset head related transfer function (HRTF) left-ear component and a preset HRTF right-ear component of each sound input signal on the second side, to obtain a filtering function of each of the sound input signals on the second side; separately perform convolution filtering on each of the sound input signals on the second side and on the filtering function of each of the sound input signals on the second side, to obtain filtered signals on the second side; summate all of the sound input signals on the first side and all of the filtered signals on the second side to obtain a synthetic signal; perform, using a fourth-order infinite impulse response (IIR) filter, timbre equalization on the synthetic signal; and use the timbre-equalized synthetic signal as a virtual stereo signal.
Description
BRIEF DESCRIPTION OF DRAWINGS
(1)
(2)
(3)
(4)
(5)
(6)
(7)
(8)
DESCRIPTION OF EMBODIMENTS
(9) Descriptions are provided in the following with reference to the accompanying drawings and specific implementation manners.
(10) Referring to
(11) Step S201: A virtual stereo synthesis apparatus acquires at least one sound input signal s.sub.l.sub.
(12) In the present disclosure, an original sound signal is processed to obtain an output sound signal that has a stereo sound effect. In this implementation manner, there are a total of M simulated sound sources located on one side, which accordingly generate M sound input signals on the one side, and there are a total of K simulated sound sources located on the other side, which accordingly generate K sound input signals on the other side. The virtual stereo synthesis apparatus acquires the M sound input signals s.sub.1.sub.
(13) Generally, in the present disclosure, the sound input signals on the one side and the other side simulate sound signals that are sent from left side and right side positions of an artificial head center in order to be distinguished from each other. For example, if the sound input signal on the one side is a left-side sound input signal, the sound input signal on the other side is a right-side sound input signal, or if the sound input signal on the one side is a right-side sound input signal, the sound input signal on the other side is a left-side sound input signal, where the left-side sound input signal is a simulation of a sound signal that is sent from the left side position of the artificial head center, and the right-side sound input signal is a simulation of a sound signal that is sent from the right side position of the artificial head center. For example, in a dual-channel mobile terminal, a left channel signal is a left-side sound input signal, and a right channel signal is a right-side sound input signal. When a sound is played by a headset, the virtual stereo synthesis apparatus separately acquires the left and right channel signals that are used as original sound signals, and separately uses the left and the right channel signals as the sound input signals on the one side and the other side. Alternatively, for some mobile terminals whose replay signal sources include four channel signals, horizontal angles between simulated sound sources of the four channel signals and the front of the artificial head center are separately ±30° and ±110°, and elevation angles of the simulated sound sources are 0°. It is generally defined that, channel signals whose horizontal angles are positive angles (+30° and +110°) are right-side sound input signals, and channel signals whose horizontal angles are negative angles (−30° and −110°) are left-side sound input signals. When a sound is played by a headset, the virtual stereo synthesis apparatus acquires the left-side and right-side sound input signals that are separately used as the sound input signals on the one side and the other side.
(14) Step S202: The virtual stereo synthesis apparatus separately performs ratio processing on a preset function HRTF left-ear component h.sub.θ.sub.
(15) A preset HRTF is briefly described herein, HRTF data h.sub.θ,φ(n) is filter model data, measured in a laboratory, of transmission paths that are from a sound source at a position to two ears of an artificial head, and expresses a comprehensive filtering function of a human physiological structure on a sound wave from the position of the sound source, where a horizontal angle between the sound source and the artificial head center is θ, and an elevation angle between the sound source and the artificial head center is φ. Different HRTF experimental measurement databases can already be provided in the prior art. In the present disclosure, HRTF data of a preset sound source may be directly acquired, without performing measurement, from the HRTF experimental measurement databases in the prior art, and a simulated sound source position is a sound source position during measurement of corresponding preset HRTF data. In this implementation manner, each sound input signal correspondingly comes from a different preset simulated sound source, and therefore a different piece of HRTF data is correspondingly preset for each sound input signal. The preset HRTF data of each sound input signal can express a filtering effect on the sound input signal that is transmitted from a preset position to the two ears. Furthermore, preset HRTF data h.sub.θ.sub.
(16) The virtual stereo synthesis apparatus performs ratio processing on the left-ear component h.sub.θ.sub.
(17) Step S203: The virtual stereo synthesis apparatus separately performs convolution filtering on each sound input signal s.sub.2.sub.
(18) The virtual stereo synthesis apparatus calculates the filtered signal s.sub.2.sub.
(19) Step S204: The virtual stereo synthesis apparatus synthesizes all of the sound input signals s.sub.1.sub.
(20) The virtual stereo synthesis apparatus synthesizes, according to
(21)
all of the sound input signals s.sub.1.sub.
(22) In this implementation manner, ratio processing is performed on left-ear and right-ear components of preset HRTF data of each sound input signal on the other side, to obtain a filtering function that retains orientation information of the preset HRTF data such that during synthesis of a virtual stereo, convolution filtering processing needs to be performed on only the sound input signal on the other side using the filtering function, and the sound input signal on the other side and a sound input signal on one side are synthesized to obtain the virtual stereo, without a need to simultaneously perform convolution filtering on the sound input signals that are on the two sides, which greatly reduces calculation complexity, and during synthesis, convolution processing does not need to be performed on the sound input signal on the one side, and therefore an original audio is retained, which further alleviates a coloration effect, and improves sound quality of the virtual stereo.
(23) It should be noted that, in this implementation manner, the generated virtual stereo is a virtual stereo that is input to an ear on one side, for example, if the sound input signal on the one side is a left-side sound input signal, and the sound input signal on the other side is a right-side sound input signal, the virtual stereo signal obtained according to the foregoing steps is a left-ear virtual stereo signal that is directly input to the left ear, or if the sound input signal on the one side is a right-side sound input signal, and the sound input signal on the other side is a left-side sound input signal, the virtual stereo signal obtained according to the foregoing steps is a right-ear virtual stereo signal that is directly input to the right ear. In the foregoing manner, the virtual stereo synthesis apparatus can separately obtain a left-ear virtual stereo signal and a right-ear virtual stereo signal, and output the signals to the two ears using a headset, to achieve a stereo effect that is like a natural sound.
(24) In addition, in an implementation manner in which positions of virtual sound sources are all fixed, it is not limited that the virtual stereo synthesis apparatus executes step S202 each time virtual stereo synthesis is performed (for example, each time replay is performed using a headset). HRTF data of each sound input signal indicates filter model data of paths for transmitting the sound input signal from a sound source to two ears of an artificial head, and in a case in which a position of the sound source is fixed, the filter model data of the path for transmitting the sound input signal, generated by the sound source, from the sound source to the two ears of the artificial head is fixed. Therefore, step S202 may be separated out, and step 202 is executed in advance to acquire and save a filtering function of each sound input signal, and when the virtual stereo synthesis is performed, the filtering function, saved in advance, of each sound input signal is directly acquired to perform convolution filtering on a sound input signal on the other side generated by a virtual sound source on the other side. The foregoing case still falls within the protection scope of the virtual stereo synthesis method in the present disclosure.
(25) Referring to
(26) Step S301: A virtual stereo synthesis apparatus acquires at least one sound input signal s.sub.1.sub.
(27) The virtual stereo synthesis apparatus acquires the at least one sound input signal s.sub.1.sub.
(28) Step S302: Separately perform ratio processing on a preset HRTF left-ear component h.sub.θ.sub.
(29) The virtual stereo synthesis apparatus performs ratio processing on the left-ear component h.sub.θ.sub.
(30) A specific method for obtaining the filtering function of each sound input signal on the other side is described using an example. Referring to
(31) Step S401: The virtual stereo synthesis apparatus performs diffuse-field equalization on preset HRTF data h.sub.θ.sub.
(32) A preset HRTF data of the k.sup.th sound input signal on the other side is represented by h.sub.θ.sub.
(33) (1) Furthermore, it is calculated that a frequency domain of the preset HRTF data h.sub.θ.sub.
(34) (2) An average energy spectrum DF _avg(n), in all directions, of the preset HRTF data frequency domain H.sub.θ.sub.
(35)
where |H.sub.θ.sub.
(36) (3) The average energy spectrum DF _avg(n) is inversed, to obtain an inversion DF _inv(n) of the average energy spectrum of the preset HRTF data frequency domain H.sub.θ.sub.
(37)
(38) (4) The inversion DF _inv(n) of the average energy spectrum of the preset HRTF data frequency domain H.sub.θ.sub.
df _inv(n)=real(InvFT(DF _inv(n))),
where InfFT( ) represents inverse Fourier transform, and real(x) represents calculation of a real number part of a complex number x.
(39) (5) Convolution is performed on the preset HRTF data h.sub.θ.sub.
where conv(x,y) represents a convolution of vectors x and y, and
(40) The virtual stereo synthesis apparatus performs the foregoing processing (1) to (5) on the preset HRTF data h.sub.θ.sub.
(41) Step S402: Perform subband smoothing on the diffuse-field-equalized preset HRTF data
(42) The virtual stereo synthesis apparatus transforms the diffuse-field-equalized preset HRTF data
(43) The virtual stereo synthesis apparatus performs subband smoothing on the frequency domain
(44)
bw(n)=└0.2*n┘, └x┘ represents a maximum integer that is not greater than x, and hann(j)=0.5*(1−cos(2*π*j/(2*bw(n)+1))), j=0 . . . (2*bw(n)+1).
(45) Step S403: Use a preset HRTF left-ear frequency domain component Ĥ.sub.θ.sub.
(46) Step S404: Separately use a ratio of the left-ear frequency domain parameter of the sound input signal on the other side to the right-ear frequency domain parameter of the sound input signal on the other side as a frequency-domain filtering function H.sub.θ.sub.
(47) The ratio of the left-ear frequency domain parameter of the sound input signal on the other side to the right-ear frequency domain parameter of the sound input signal on the other side further includes a modulus ratio and an argument difference between the left-ear frequency domain parameter and the right-ear frequency domain parameter, where the modulus ratio and the argument difference are correspondingly used as a modulus and an argument in the frequency-domain filtering function of the sound input signal on the other side, and the obtained filtering function can retain orientation information of the preset HRTF left-ear component and the preset HRTF right-ear component of the sound input signal on the other side.
(48) In this implementation manner, the virtual stereo synthesis apparatus performs a ratio operation on the left-ear frequency domain parameter and the right-ear frequency domain parameter of the sound input signal on the other side. Further, the modulus of the frequency-domain filtering function H.sub.θ.sub.
(49)
the argument of the frequency-domain filtering function H.sub.θ.sub.
(50) It should be noted that, in the foregoing description, when diffuse-field equalization and subband smoothing are performed, the preset HRTF data h.sub.θ.sub.
(51) Step S405: Separately perform minimum phase filtering on the frequency-domain filtering function H.sub.θ.sub.
(52) The obtained frequency-domain filtering function H.sub.θ.sub.
(53) (1) The virtual stereo synthesis apparatus extends the modulus of the obtained frequency-domain filtering function H.sub.θ.sub.
(54)
where ln(x) is a natural logarithm of x, N.sub.1 is a time-domain transformation length of a time domain h.sub.θ.sub.
(55) (2) Hilbert transform is performed on the modulus |H.sub.θ.sub.
H.sub.θ.sub.
where Hilbert( ) represents Hilbert transform.
(56) (3) A minimum phase filter H.sub.θ.sub.
(57)
where n=1 . . . N.sub.2.
(58) (4) A delay τ(θ.sub.k,φ.sub.k) is calculated:
(59)
(60) (5) The minimum phase filter H.sub.θ.sub.
h.sub.θ.sub.
where InvFT( ) represents inverse Fourier transform, and real( ) represents a real number part of a complex number x.
(61) (6) The time domain h.sub.θ.sub.
(62)
(63) Relatively large coefficients of the minimum phase filter H.sub.θ.sub.
(64) A tailored filtering function h.sub.θ.sub.
(65) It should be noted that, the foregoing example of obtaining the filtering function h.sub.θ.sub.
(66)
arg(H.sub.θ.sub.
(67)
formula arg(H.sub.θ.sub.
(68)
the left-ear component and the right-ear component of the subband-smoothed preset HRTF data are separately used as the left-ear frequency domain parameter and the right-ear frequency domain parameter, ratio calculation is performed according to a formula
(69)
arg(H.sub.θ.sub.
(70) Step S303: Separately perform reverberation processing on each sound input signal s.sub.2.sub.
(71) After acquiring the at least one sound input signal s.sub.2.sub.
(72) (1) As shown in
where conv(x,y) represents a convolution of vectors x and y, d.sub.k is a preset delay of the k.sup.th sound input signal on the other side, h.sub.k(n) is an all-pass filter of the k.sup.th sound input signal on the other side, and a transfer function thereof is
(73)
where g.sub.k.sup.1, g.sub.k.sup.2, and g.sub.k.sup.3 are preset all-pass filter gains corresponding to the k.sup.th sound input signal on the other side, and M.sub.k.sup.1, M.sub.k.sup.2, and M.sub.k.sup.3 are preset all-pass filter delays corresponding to the k.sup.th sound input signal on the other side.
(74) (2) Separately add each sound input signal s.sub.2.sub.
ŝ.sub.2.sub.
where w.sub.k is a preset weight of the reverberation signal
(75) Step S304: Separately perform convolution filtering on each sound reverberation signal
(76) After separately performing reverberation processing on each of the at least one sound input signal on the other side to obtain the sound reverberation signal ŝ.sub.2.sub.
(77) Step S305: Summate all of the sound input signals s.sub.1.sub.
(78) Furthermore, the virtual stereo synthesis apparatus obtains the synthetic signal s.sup.−1(n) corresponding to the one side according to a formula
(79)
For example, if the sound input signal on the one side is a left-side sound input signal, a left-ear synthetic signal is obtained, or if the sound input signal on the one side is a right-side sound input signal, a right-ear synthetic signal is obtained.
(80) Step S306: Perform, using a fourth-order IIR filter, timbre equalization on the synthetic signal s.sup.−1(n) and then use the timbre-equalized synthetic signal as a virtual stereo signal s.sup.1(n).
(81) The virtual stereo synthesis apparatus performs timbre equalization on the synthetic signal s.sup.−1(n), to reduce a coloration effect, on the synthetic signal, from the convolution-filtered sound input signal on the other side. In this implementation manner, timbre equalization is performed using a fourth-order IIR filter eq(n). Furthermore, the virtual stereo signal s.sup.1(n) that is finally output to the ear on the one side is obtained according to a formula s.sup.1(n)=conv(eq(n),s.sup.−1(n)).
(82) A transfer function of eq(n) is
(83)
(84) For better comprehension of practical use of the virtual stereo synthesis method of this application, descriptions are further provided using an example, in which a sound generated by a dual-channel terminal is replayed by a headset, where a left channel signal is a left-side sound input signal s.sub.l(n), and a right channel signal is a right-side sound input signal s.sub.r(n), where preset HRTF data of the left-side sound input signal s.sub.l(n) is h.sub.θ,φ.sup.l(n) h.sub.θ,φ.sup.l(n), and preset HRTF data of the right-side sound input signal s.sub.r(n) is h.sub.θ,φ.sup.r(n).
(85) A virtual stereo synthesis apparatus separately processes the preset HRTF data h.sub.θ,φ.sup.l(n) of the left-side sound input signal and the preset HRTF data h.sub.θ,φ.sup.r(n) of the right-side sound input signal separately according to steps S401 to S405 above, to obtain a tailored filtering function h.sub.θ,φ.sup.c.sup.
(86) The virtual stereo synthesis apparatus acquires the left-side sound input signal s.sub.l(n) as a sound input signal on one side, and the right-side sound input signal s.sub.r(n) as a sound input signal on the other side. The virtual stereo synthesis apparatus executes step S303 to perform reverberation processing on the right-side sound input signal. A reverberation signal
(87)
and a right-side sound reverberation signal ŝ.sub.r(n) is obtained according to ŝ.sub.r(n)=s.sub.r(n)+w.sub.r□
(88)
and a left-side sound reverberation signal ŝ.sub.l(n) is obtained according to ŝ.sub.l(n)=s.sub.l(n)+w.sub.l□
(89) Values of constants in the foregoing example are: T=72, P=1, N=512, N.sub.0=48, fs=44100, d.sub.l=220, d.sub.r=264, g.sub.l.sup.1=g.sub.l.sup.2=g.sub.l.sup.3=g.sub.r.sup.1=g.sub.r.sup.2=g.sub.r.sup.3=0.6, M.sub.l.sup.1=M.sub.r.sup.1=220, M.sub.l.sup.2=M.sub.r.sup.2=132, M.sub.l.sup.3=M.sub.r.sup.3=74, w.sub.l==w.sub.r=0.4225, θ=45°, and φ=0°.
(90) The values of the constants are numerical values that are obtained by means of multiple experiments and that provide an optimal replay effect for a virtual stereo signal. Certainly, in another implementation manner, other numerical values may also be used. The values of the constants in this implementation manner are not further limited herein.
(91) In this implementation manner, which is used as an optimized implementation manner, steps S303, S304, S305, and S306 are executed to perform reverberation processing, convolution filtering operation, virtual stereo synthesis, and timbre equalization is performed in sequence, to finally obtain a virtual stereo. However, in another implementation manner, steps S303 and S306 may be selectively performed, for example, steps S303 and S306 are not executed, while convolution filtering is directly performed on the sound input signal on the other side using the filtering function of the sound input signal on the other side, to obtain the filtered signal ŝ.sub.2.sub.
(92) In this implementation manner, reverberation processing is performed on a sound input signal on the other side, which enhances a sense of space of a synthetic virtual stereo, and during synthesis of a virtual stereo, timbre equalization is performed on the virtual stereo using a filter, which reduces a coloration effect. In addition, in this implementation manner, existing HRTF data is improved. Diffuse-field equalization is first performed on the HRTF data, to eliminate interference data from the HRTF data, and then a ratio operation is performed on a left-ear component and a right-ear component that are in the HRTF data, to obtain improved HRTF data in which orientation information of the HRTF data is retained, that is, a filtering function in this application such that corresponding convolution filtering needs to be performed on only the sound input signal on the other side, and then a virtual stereo with a relatively good replay effect can be obtained. Therefore, virtual stereo synthesis in this implementation manner is different from that in the prior art, in which the convolution filtering is performed on sound input signals on both sides, and therefore, calculation complexity is greatly reduced. Moreover, an original input signal is completely retained on one side, which reduces a coloration effect. Further, in this implementation manner, the filtering function is further processed by means of subband smoothing and minimum phase filtering, which reduces a data length of the filtering function, and therefore further reduces the calculation complexity.
(93) Referring to
(94) The acquiring module 610 is configured to acquire at least one sound input signal s.sub.1.sub.
(95) In the present disclosure, an original sound signal is processed to obtain an output sound signal that has a stereo sound effect. In this implementation manner, there are a total of M simulated sound sources located on one side, which accordingly generate M sound input signals on the one side, and there are a total of K simulated sound sources located on the other side, which accordingly generate K sound input signals on the other side. The acquiring module 610 acquires the M sound input signals s.sub.1.sub.
(96) Generally, in the present disclosure, the sound input signals on the one side and the other side simulate sound signals that are sent from left side and right side positions of an artificial head center in order to be distinguished from each other, for example, if the sound input signal on the one side is a left-side sound input signal, the sound input signal on the other side is a right-side sound input signal, or if the sound input signal on the one side is a right-side sound input signal, the sound input signal on the other side is a left-side sound input signal, where the left-side sound input signal is a simulation of a sound signal that is sent from the left side position of the artificial head center, and the right-side sound input signal is a simulation of a sound signal that is sent from the right side position of the artificial head center.
(97) The generation module 620 is configured to separately perform ratio processing on a preset HRTF left-ear component h.sub.θ.sub.
(98) Different HRTF experimental measurement databases can already be provided in the prior art. The generation module 620 may directly acquire, without performing measurement, HRTF data from the HRTF experimental measurement databases in the prior art, to perform presetting, and a simulated sound source position of a sound input signal is a sound source position during measurement of corresponding preset HRTF data. In this implementation manner, each sound input signal correspondingly comes from a different preset simulated sound source, and therefore a different piece of HRTF data is correspondingly preset for each sound input signal. The preset HRTF data of each sound input signal can express a filtering effect on the sound input signal that is transmitted from a preset position to the two ears. Furthermore, preset HRTF data h.sub.θ.sub.
(99) The generation module 620 performs ratio processing on the left-ear component h.sub.θ.sub.
(100) The convolution filtering module 630 is configured to separately perform convolution filtering on each sound input signal s.sub.2.sub.
(101) The convolution filtering module 630 calculates the filtered signal s.sub.2.sub.
(102) The synthesis module 640 is configured to synthesize all of the sound input signals s.sub.1.sub.
(103) The synthesis module 640 is configured to synthesize, according to
(104)
all of the received sound input signals s.sub.1.sub.
(105) In this implementation manner, ratio processing is performed on left-ear and right-ear components of preset HRTF data of each sound input signal on the other side, to obtain a filtering function that retains orientation information of the preset HRTF data such that during synthesis of a virtual stereo, convolution filtering processing needs to be performed on only the sound input signal on the other side using the filtering function, and the sound input signal on the other side and a sound input signal on one side are synthesized to obtain the virtual stereo, without a need to simultaneously perform convolution filtering on the sound input signals that are on the two sides, which greatly reduces calculation complexity, and during synthesis, convolution processing does not need to be performed on the sound input signal on the one side, and therefore an original audio is retained, which further alleviates a coloration effect, and improves sound quality of the virtual stereo.
(106) It should be noted that, in this implementation manner, the generated virtual stereo is a virtual stereo that is input to an ear on one side, for example, if the sound input signal on the one side is a left-side sound input signal, and the sound input signal on the other side is a right-side sound input signal, the virtual stereo signal obtained by the foregoing module is a left-ear virtual stereo signal that is directly input to the left ear, or if the sound input signal on the one side is a right-side sound input signal, and the sound input signal on the other side is a left-side sound input signal, the virtual stereo signal obtained by the foregoing module is a right-ear virtual stereo signal that is directly input to the right ear. In the foregoing manner, the virtual stereo synthesis apparatus can separately obtain a left-ear virtual stereo signal and a right-ear virtual stereo signal, and output the signals to the two ears using a headset, to achieve a stereo effect that is like a natural sound.
(107) Referring to
(108) The acquiring module 710 is configured to acquire at least one sound input signal s.sub.1.sub.
(109) The generation module 720 is configured to separately perform ratio processing on a preset HRTF left-ear component h.sub.θ.sub.
(110) Further optimized, the generation module 720 includes a processing unit 721, a ratio unit 722, and a transformation unit 723.
(111) The processing unit 721 is configured to separately use a frequency domain, after diffuse-field equalization and subband smoothing is performed in sequence, of the preset HRTF left-ear component h.sub.θ.sub.
(112) a. The processing unit 721 performs diffuse-field equalization on preset HRTF data h.sub.θ.sub.
(113) (1) Furthermore, the processing unit 721 calculates that a frequency domain of the preset HRTF data h.sub.θ.sub.
(114) (2) The processing unit 721 calculates an average energy spectrum DF _avg(n), in all directions, of the preset HRTF data frequency domain H.sub.θ.sub.
(115)
where |H.sub.θ.sub.
(116) (3) The processing unit 721 inverses the average energy spectrum DF _avg(n), to obtain an inversion DF inv(n) of the average energy spectrum of the preset HRTF data frequency domain H.sub.θ.sub.
(117)
(118) (4) The processing unit 721 transforms the inversion DF _inv(n) of the average energy spectrum of the preset HRTF data frequency domain H.sub.θ.sub.
df _inv(n)=real(InvFT(DF_inv(n))),
where InvFT( ) represents inverse Fourier transform, and real(x) represents calculation of a real number part of a complex number x.
(119) (5) The processing unit 721 performs convolution on the preset HRTF data h.sub.θ.sub.
where conv(x,y) represents a convolution of vectors x and y, and
(120) The processing unit 721 performs the foregoing processing (1) to (5) on the preset HRTF data h.sub.θ.sub.
(121) b. The processing unit 721 performs subband smoothing on the diffuse-field-equalized preset HRTF data
(122) The processing unit 721 performs subband smoothing on the frequency domain
(123)
bw(n)=└0.2*n┘, └x┘ represents a maximum integer that is not greater than x, and
hann(j)=0.5*(1−cos(2*π*j/(2*bw(n)+1))),j=0 . . . (2*bw(n)+1).
(124) c. The processing unit 721 uses a preset HRTF left-ear frequency domain component Ĥ.sub.θ.sub.
(125) It should be noted that, in the foregoing description, when diffuse-field equalization and subband smoothing are performed, the preset HRTF data h.sub.θ.sub.
(126) The ratio unit 722 is configured to separately use a ratio of the left-ear frequency domain parameter of the sound input signal on the other side to the right-ear frequency domain parameter of the sound input signal on the other side as a frequency-domain filtering function H.sub.θ.sub.
(127) In this implementation manner, the ratio unit 722 performs a ratio operation on the left-ear frequency domain parameter and the right-ear frequency domain parameter of the sound input signal on the other side. Further, the modulus of the frequency-domain filtering function H.sub.θ.sub.
(128)
the argument of the frequency-domain filtering function H.sub.θ.sub.
(129) The transformation unit 723 is configured to separately perform minimum phase filtering on the frequency-domain filtering function H.sub.θ.sub.
(130) (1) The transformation unit 723 extends the modulus of the frequency-domain filtering function H.sub.θ.sub.
(131)
where ln(x) is a natural logarithm of x, N.sub.1 is a time-domain transformation length of a time domain h.sub.θ.sub.
(132) (2) The transformation unit 723 performs Hilbert transform on the modulus |H.sub.θ.sub.
H.sub.θ.sub.
where Hilbert( ) represents Hilbert transform.
(133) (3) The transformation unit 723 obtains a minimum phase filter H.sub.θ.sub.
(134)
where n=1 . . . N.sub.2.
(135) (4) The transformation unit 723 calculates a delay τ(θ.sub.k,φ.sub.k):
(136)
(137) (5) The transformation unit 723 transforms the minimum phase filter H.sub.θ.sub.
h.sub.θ.sub.
where InvFT( ) represents inverse Fourier transform, and real( ) represents a real number part of a complex number x.
(138) (6) The transformation unit 723 truncates the time domain h.sub.θ.sub.
(139)
(140) Relatively large coefficients of the minimum phase filter H.sub.θ.sub.
(141) It should be noted that, the foregoing example in which the generation module obtains the filtering function h.sub.θ.sub.
(142) The reverberation processing module 750 is configured to separately perform reverberation processing on each sound input signal s.sub.2.sub.
(143) After acquiring the at least one sound input signal s.sub.2.sub.
(144) (1) As shown in
where conv(x, y) represents a convolution of vectors x and y, d.sub.k is a preset delay of the k.sup.th sound input signal on the other side, h.sub.k(n) is an all-pass filter of the k.sup.th sound input signal on the other side, and a transfer function thereof is:
(145)
where g.sub.k.sup.1, g.sub.k.sup.2, and g.sub.k.sup.3 are preset all-pass filter gains corresponding to the k.sup.th sound input signal on the other side, and M.sub.k.sup.1, M.sub.k.sup.2, and M.sub.k.sup.3 are preset all-pass filter delays corresponding to the k.sup.th sound input signal on the other side.
(146) (2) The reverberation processing module 750 separately adds each sound input signal s.sub.2.sub.
ŝ.sub.2.sub.
where w.sub.k is a preset weight of the reverberation signal
(147) The convolution filtering module 730 is configured to separately perform convolution filtering on each sound reverberation signal ŝ.sub.2.sub.
(148) After receiving all the sound reverberation signals ŝ.sub.2.sub.
(149) The synthesis unit 741 is configured to summate all of the sound input signals s.sub.1.sub.
(150) Furthermore, the synthesis unit 741 obtains the synthetic signal
(151)
For example, if the sound input signal on the one side is a left-side sound input signal, a left-ear synthetic signal is obtained, or if the sound input signal on the one side is a right-side sound input signal, a right-ear synthetic signal is obtained.
(152) The timbre equalization unit 742 is configured to perform, using a fourth-order IIR filter, timbre equalization on the synthetic signal
(153) The timbre equalization unit 742 performs timbre equalization on the synthetic signal
(154) A transfer function of eq(n) is
(155)
(156) In this implementation manner, which is used as an optimized implementation manner, reverberation processing, convolution filtering operation, virtual stereo synthesis, and timbre equalization are performed in sequence, to finally obtain a virtual stereo. However, in another implementation manner, reverberation processing and/or timbre equalization may not be performed, which is not limited herein.
(157) It should be noted that, the virtual stereo synthesis apparatus of this application may be an independent sound replay device, for example, a mobile terminal such as a mobile phone, a tablet computer, or an MP3 player, and the foregoing functions are also performed by the sound replay device.
(158) Referring to
(159) The memory 820 is configured to store a computer instruction executed by the processor 810 and data that the processor 810 needs to store at work.
(160) The processor 810 executes the computer instruction stored in the memory 820, to acquire at least one sound input signal s.sub.1.sub.
(161) Further, the processor 810 acquires the at least one sound input signal s.sub.1.sub.
(162) The processor 810 is configured to separately perform ratio processing on a preset HRTF left-ear component h.sub.θ.sub.
(163) Further optimized, the processor 810 separately uses a frequency domain, after diffuse-field equalization and subband smoothing is performed in sequence, of the preset HRTF left-ear component h.sub.θ.sub.
(164) The processor 810 separately uses a ratio of the left-ear frequency domain parameter of the sound input signal on the other side to the right-ear frequency domain parameter of the sound input signal on the other side as a frequency-domain filtering function H.sub.θ.sub.
(165)
an argument of the frequency-domain filtering function H.sub.θ.sub.
(166) The processor 810 separately performs minimum phase filtering on the frequency-domain filtering function H.sub.θ.sub.
(167) It should be noted that, the foregoing example in which the processor obtains the filtering function h.sub.θ.sub.
(168) The processor 810 is configured to separately perform reverberation processing on each sound input signal s.sub.2.sub.
(169) The processor 810 is configured to separately perform convolution filtering on each sound reverberation signal ŝ.sub.2.sub.
(170) The processor 810 is configured to summate all of the sound input signals s.sub.1.sub.
(171) Further, the processor 810 obtains the synthetic signal
(172)
For example, if the sound input signal on the one side is a left-side sound input signal, a left-ear synthetic signal is obtained, or if the sound input signal on the one side is a right-side sound input signal, a right-ear synthetic signal is obtained.
(173) The processor 810 is configured to perform, using a fourth-order IIR filter, timbre equalization on the synthetic signal
(174) In this implementation manner, which is used as an optimized implementation manner, reverberation processing, convolution filtering operation, virtual stereo synthesis, and timbre equalization are performed in sequence, to finally obtain a left-ear or right-ear virtual stereo. However, in another implementation manner, the processor may not perform reverberation processing and the timbre equalization may be not performed, which is not limited herein.
(175) By means of the foregoing solutions, in this application, ratio processing is performed on left-ear and right-ear components of preset HRTF data of each sound input signal on the other side, to obtain a filtering function that retains orientation information of the preset HRTF data such that during synthesis of a virtual stereo, convolution filtering processing needs to be performed on only the sound input signal on the other side using the filtering function, and then the sound input signal on the other side and an original sound input signal on one side are synthesized to obtain the virtual stereo, without a need to simultaneously perform convolution filtering on the sound input signals that are on the two sides, which greatly reduces calculation complexity, and during synthesis, convolution processing does not need to be performed on the sound input signal on one of the sides, and therefore an original audio is retained, which further alleviates a coloration effect, and improves sound quality of the virtual stereo.
(176) In the several implementation manners provided in this application, it should be understood that the disclosed system, apparatus, and method may be implemented in other manners. For example, the described apparatus embodiment is merely exemplary. For example, the module or unit division is merely logical function division and may be other division in actual implementation. For example, a plurality of units or components may be combined or integrated into another system, or some features may be ignored or not performed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections may be implemented through some interfaces. The indirect couplings or communication connections between the apparatuses or units may be implemented in electronic, mechanical, or other forms.
(177) The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one position, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
(178) In addition, functional units in the embodiments of this application may be integrated into one processing unit, or each of the units may exist alone physically, or two or more units are integrated into one unit. The integrated unit may be implemented in a form of hardware, or may be implemented in a form of a software functional unit.
(179) When the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, the integrated unit may be stored in a computer-readable storage medium. Based on such an understanding, the technical solutions of this application essentially, or the part contributing to the prior art, or all or a part of the technical solutions may be implemented in the form of a software product. The software product is stored in a storage medium and includes several instructions for instructing a computer device (which may be a personal computer, a server, or a network device) or a processor to perform all or a part of the steps of the methods described in the implementation manners of this application. The foregoing storage medium includes any medium that can store program code, such as a universal serial bus (USB) flash drive, a removable hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disc.