Pitch detection method and apparatus

Information

  • Patent Application
  • 20100211384
  • Publication Number
    20100211384
  • Date Filed
    April 09, 2010
    14 years ago
  • Date Published
    August 19, 2010
    14 years ago
Abstract
A pitch detection method and apparatus are disclosed. The method includes: performing pitch detection on an input signal in a signal domain, and obtaining a candidate pitch; performing linear prediction (LP) on the input signal, and obtaining an LP residual signal; setting a candidate pitch range that includes the candidate pitch; searching the candidate pitch range for the LP residual signal, and obtaining a selected pitch.
Description
FIELD OF THE INVENTION

The present invention relates to a speech and audio signal encoding technology, and in particular, to a pitch detection method and apparatus.


BACKGROUND OF THE INVENTION

To save bandwidths for transmitting and storing speech and audio signals, the speech and audio encoding technology has been widely used. The technology includes lossy encoding and lossless encoding. For lossy encoding, the reconstructed signal may not keep the same as the original signal, but the signal redundancy information may be minimized according to the features of the sound source and the human auditory perception, little coding information is transmitted and high speech and audio quality is achieved. For lossless encoding, the reconstructed signal may be the same as the original signal, so that the final decoding quality is not degraded. Generally, the lossy encoding compression efficiency is high, but the quality of the reconstructed speech and audio signal cannot be guaranteed. Lossless encoding can guarantee the speech quality because it can reconstruct signals without distortion, but the compression rate is only about 50%.


The pitch is an important parameter either in lossy encoding or lossless encoding. The final encoding performance depends on the accuracy of the pitch detection. In the prior art, a lot of pitch detection methods are available, one of which includes: mapping a signal to a domain, performing search pre-processing, performing coarse search on an open loop basis, and then performing refined search on a closed loop basis, and finally performing post-processing such as pitch smoothing. All these operations are performed in one domain, for example, time domain, frequency domain, cepstrum domain, signal domain, or residual domain.


During the implementation of the present invention, the inventor finds the prior art has the following problems: A lot of operations need be performed in different domains in the actual algorithm, and the pitch detection algorithm shows different levels of performance and complexity in different domains. For example, in the time domain, the pitch detection complexity is low; in the frequency domain, the pitch detection accuracy is higher; in the signal domain, the pitch is better, and is easy to detect; in the residual domain, the pitch is poor, and thus is difficult to detect.


SUMMARY OF THE INVENTION

Embodiments of the present invention provide a pitch detection method and apparatus to overcome the weakness of detecting a pitch in a single domain in the prior art.


To achieve the above objective, embodiments of the present invention provide the following technical solution:


A pitch detection method includes:


performing a pitch detection on an input signal in a signal domain, and obtaining a candidate pitch;


performing a linear prediction (LP) on the input signal, and obtaining an LP residual signal;


setting a candidate pitch range that includes the candidate pitch; and


searching for the LP residual signal in the candidate pitch range, and obtaining a selected pitch.


A pitch detection apparatus includes:


a signal-domain pitch detecting unit, configured to perform pitch detection on the input signal in the signal domain, and obtain a candidate pitch;


a linear predicting unit, configured to perform LP on the input signal and obtain an LP residual signal;


a setting unit, configured to set a candidate pitch range that includes the candidate pitch; and


a residual-domain refined detecting unit, configured to search for the LP residual signal in the candidate pitch range, and obtain a selected pitch.


The method and apparatus provided in some embodiments of the present invention detect pitches with different accuracy in the signal and residual domains in sequence according to different features of the signal in the two domains. This overcomes the weakness in the prior art. Thus, the complexity of the algorithm is reduced and the accuracy of the pitch detection is guaranteed.





BRIEF DESCRIPTION OF THE DRAWINGS

The accompanying drawings are intended to make the present invention clearer and are part of this application, without constituting any limitation on the present invention: In the accompanying drawings:



FIG. 1 is a flowchart of a method according to an embodiment of the present invention;



FIG. 2 is a flowchart of method according to another embodiment of the present invention;



FIG. 3 is a schematic diagram illustrating the pitch search according to an embodiment of the present invention;



FIG. 4 is a block diagram illustrating components of an apparatus according to an embodiment of the present invention; and



FIG. 5 is a block diagram illustrating components of an apparatus according to another embodiment of the present invention.





DETAILED DESCRIPTION OF THE INVENTION

For better understanding of the objective, technical solution and merits of the invention, embodiments of the present invention are hereinafter described in detail with reference to the accompanying drawings. Embodiments of the present invention and explanations thereof are intended to make the present invention clearer, and the present invention is not limited to such embodiments.


Embodiment 1

This embodiment provides a pitch detection method, which is hereinafter described in detail with reference to the accompanying drawings.



FIG. 1 is a flowchart of a method according to one embodiment of the present invention. As shown in FIG. 1, the pitch detection method includes the following steps:


Block 101: Perform pitch detection on the input signal in the signal domain, and obtain a candidate pitch.


In this embodiment, some pre-processing operations may be performed on the input signal prior to the pitch detection in the signal domain, for example, low pass filtering, median clipping and down sampling; then pitch search is performed on the pre-processed signal. Thus, before block 101, the method may further include pre-processing the input signal and obtaining a pre-processed signal. The process of pre-processing may include: performing low pass filtering and down sampling on the input signal, and obtaining a down sampled signal. In this case, the down sampled signal is provided as the pre-processed signal according to one embodiment, and then the pitch detection is performed on the down sampled signal in the signal domain.


In this embodiment, a lot of signal domain pitch search methods may be available to search the pre-processed signal for the pitch. To guarantee the accuracy and continuity of the pitch, the searched pitch needs to undergo post-processing algorithms such as pitch smoothing and double frequency detection. The pitch detected in the signal domain is used as the candidate pitch for refined detection in the residual domain.


Block 102: Perform a linear prediction on the input signal, and obtain a linear prediction residual signal.


According to one embodiment, the LP residual signal may be obtained by performing linear prediction on the input signal after windowing the input signal.


Block 103: Set a candidate pitch range that includes the candidate pitch.


A lot of encoders transfer the signal to the LP residual domain for processing, these encoders need to obtain an accurate pitch according to the LP residual signal. Thus, a refined pitch needs to be searched refinedly near the candidate pitch on the residual signal to meet the requirements of the encoders.


The minimum value of the candidate pitch range is equal to the difference between the candidate pitch and a first threshold, and the maximum value of the candidate pitch range is equal to the sum of the candidate pitch and a second threshold. The first threshold and the second threshold may be determined according to the performance and complexity of the algorithm. The first threshold may be the same as or different from the second threshold.


Block 104: Search for the LP residual signal refinedly in the candidate pitch range, and obtain a selected pitch.


In this embodiment, the LP residual signal is searched refinedly based on an auto correlation function. A pitch within the candidate pitch range that enables the auto correlation function to be the largest is used as the selected pitch. The LP residual signal may also be searched by comparing the energy of the long-term prediction (LTP) residual signal. The minimum value of the energy of the LTP residual signal is selected within the candidate pitch range; a pitch corresponding to the minimum value of the energy of the LTP residual signal is used as the selected pitch (T′).


According to this embodiment, the pitch obtained through the refined search needs to undergo post-processing operations such as pitch smoothing and double frequency detection according to actual conditions, and an optimal pitch that is found through the refined detection in the residual domain is used as the selected pitch.


The method provided in this embodiment detects pitch with different accuracy in the signal and residual domains in sequence according to different features of the signal in the two domains. This overcomes the weakness of pitch detection in a single domain. Thus, the complexity of the algorithm is reduced and the accuracy of the pitch detection is guaranteed.


Embodiment 2

This embodiment provides another pitch detection method, which is hereinafter described in detail with reference to the accompanying drawings.



FIG. 2 is a flowchart of a method according to another embodiment of the present invention. The method takes the frame length (L) of 160 samples as an example. As shown in FIG. 2, the method includes the following steps:


Block 201: Perform low pass filtering on the input signal s(n), and obtain a low pass filtered signal y(n):








y


(
n
)


=



s


(
n
)


+

y


(

n
-
1

)



2


,




where n=0, 1, . . . , L


Block 202: The low pass filtered signal y(n) is downsampled, and obtain a downsampled signal y2(n):






y2(n)=y(2n), where







n
=
0

,
1
,





,


(


L
2

-
1

)

.





Block 203: Pitch search is performed for the downsampled signal y2(n).


Because the pitch generally ranges from 2 ms to 20 ms, the pitch range is limited to [20, 83] (8 kHz sampling) in this embodiment and the pitch parameter may be encoded with 6-bit in consideration of encoding efficiency and performance. In addition, the pitch cannot be too long for the frame length of 160 samples; otherwise, few samples in a frame signal participate in the LTP calculation, which may reduce the LTP performance.


In one embodiment, assume that L is equal to 160 samples. In the down sampled signal domain, the pitch range is changed to [10, 41], that is, PMIN=10 and PMAX=41, as shown in FIG. 3.


In one embodiment, step 203 may further include:


Block 2031: According to the pitch range, find a pulse with the maximum amplitude in the second half-frame signal of the down sampled signal in the down sampled signal domain, where the pulse position is recorded as p0.







p





0

=


{



p





0

>

abs


(

y





2


(
n
)


)



,

n


[


P
MAX

,


L
2

-
1


]


,

n


p





0



}

.





Block 2032: Add a target window with the size of [smin, smax] around p0, where:











s





min

=

s_





max


(



p





0

-
K

,
42

)



,








s





max

=

s_min


(



p





0

+
K

,


L
2

-
1


)



,





K


[

0
,


L
2

-
42


]


,







and the window length (len) is equal to the difference between smax and smin, where s_max( ) denotes returning a maximum value in the included elements; and s_min( ) denotes returning a minimum value in the included elements.


Block 2033: Obtain an initial pitch according to the pre-processed signal in the target window and sliding windows of the target window.


In this embodiment, the method for obtaining the initial pitch includes but is not limited to the following three methods:


First Method


Calculate the energy E(k) of the LTP residual signal xk(i), and use the pitch corresponding to the minimum energy as the initial pitch:






x
k(i)=y2(i)−g·y2(i−k),i=smin, . . . , smax,


where g indicates an LTP gain factor and kε[10,41].


Then,








E


(
k
)


=




i
=

s





min



s





max






x
k



(
i
)


·


x
k



(
i
)





,




where kε[10,41].


Select the minimum value in E(k) and the pitch corresponding to the minimum value as follows:






P={E(P)<E(k),kε[10,41],k≠P}.


Second Method


Match the signals around the pulse with the maximum amplitude in the down sampled signal, obtain the correlation coefficients by calculating the following correlation function, and use the pitch corresponding to the maximum correlation coefficient as the initial pitch.


The correlation function may be








corr
[
k
]

=




i
=

s





min




s





max

-




1




y





2


(
i
)

*
y





2


(

i
-
k

)




,




where kε[10,41]. The k value corresponding to the maximum correlation coefficient (corr [.]) is used as the initial pitch (P).


Third Method


Calculate the sum of absolute values of the LTP residual signal xk(i), and use the pitch corresponding to the minimum sum of absolute values as the initial pitch:






x
k(i)=y2(i)−g·y2(i−k),i=smin, . . . , smax,


where g indicates an LTP gain factor and kε[10,41].








E


(
k
)


=




i
=

s





min



s





max




abs


(


x
k



(
i
)


)




,




where kε[10, 41].


Select the minimum value in E(k) and the pitch corresponding to the minimum value as follows:






P={E(P)>E(k),kε[10,41],k≠P}.


The k value within the range of [T−Td1,T+Td2] that enables nor_cor[.] to be the largest is used as the optimal pitch (T′), that is, the selected pitch. The first threshold (Td1) and the second threshold (Td2) may be determined according to the performance and complexity of the algorithm. For example, both Td1 and Td2 may be set to 2.


In another embodiment, the pitch may be searched out by comparing the energy of the LTP residual signal as follows:






u
k(n)=e(n)−g′·e(n−k),i=k, . . . , L−1,


where uk(n) indicates the LTP residual signal, g′ indicates the LTP gain factor and kε[T−Td1,T+Td2].








E


(
k
)


=




i
=
k


L
-
1






u
k



(
n
)


·


u
k



(
n
)





,




kε[T−Td1,T+Td2]. Alternatively, E(k) may also be represented by the sum of absolute values of uk(n).


The minimum value in E(k) is selected and a pitch corresponding to the minimum value is used as the selected pitch (T′).


In this embodiment, according to different features of the signal in different domains and requirements of the actual algorithm, a pitch is searched coarsely in the signal domain and then a refined pitch search is performed in the residual domain according to the pitch obtained in the coarse search. The method provided in this embodiment detects pitches with different accuracy in the signal and residual domains in sequence according to different features of the signal in the two domains. This overcomes the weakness in the prior art. Thus, the complexity of the algorithm is reduced and the accuracy of the pitch detection is guaranteed.


Embodiment 3

This embodiment provides a pitch detection apparatus, which is hereinafter described in detail with reference to the accompanying drawing.



FIG. 4 is a block diagram illustrating components of the apparatus according to one embodiment of the present invention. As shown in FIG. 4, the pitch detection apparatus includes:


a signal-domain pitch detecting unit 41, configured to detect the pitch of the input signal in the signal domain, and obtain a candidate pitch;


a linear predicting unit 42, configured to perform LP on the input signal, and obtain an LP residual signal;


a setting unit 43, configured to set a candidate pitch range that includes the candidate pitch; and a residual-domain refined detecting unit 44, configured to search for the LP residual signal refiinedly within the candidate pitch range, and obtain a selected pitch.


The components of the apparatus provided in this embodiment are configured to implement each step of the method in the Embodiment 1 of the present invention. Because each step of the method has been described in detail in the first embodiment, these components will not be further described.


The apparatus provided in this embodiment detects pitches with different accuracy in the signal and residual domains in sequence according to different features of the signal in the two domains. This overcomes the weakness in the prior art. Thus, the complexity of the algorithm is reduced and the accuracy of the pitch detection is guaranteed.


Embodiment 4

This embodiment provides a pitch detection apparatus, which is hereinafter described in detail with reference to the accompanying drawing.



FIG. 5 is a block diagram illustrating an apparatus according to another embodiment of the present invention. In this embodiment, the pitch detection apparatus includes a signal-domain pitch detecting unit 51, a linear predicting unit 52, a setting unit 53, a residual-domain refined detecting unit 54, and


a pre-processing unit 55, configured to pre-process the input signal, obtain a pre-processed signal, and provide the pre-processed signal to the signal-domain pitch detecting unit 51 in the signal domain.


The pre-processing unit 55 may include:


a low pass filtering module 551, configured to perform low pass filtering on the input signal; and


a down sampling module 552, configured to down sample the input signal that has undergone the low pass filtering by the low pass filtering module 551, and obtain a down sampled signal.


In one embodiment, the signal domain pitch detecting unit 51 may include:


a first windowing module 511, configured to add a target window around a pulse position with the maximum amplitude in the second half-frame signal of the pre-processed signal;


an initial pitch obtaining module 512, configured to obtain an initial pitch according to the pre-processed signal in the target window and sliding windows of the target window; and


a candidate pitch obtaining module 513, configured to perform double frequency detection on the initial pitch, and obtain a candidate pitch.


The initial pitch obtaining module 512 may be configured to calculate the energy of the LTP residual signal according to the pre-processed signal in the target window and sliding windows of the target window, and use a pitch corresponding to the minimum energy as the initial pitch; or match the signal around a pulse with the maximum amplitude in the pre-processed signal, calculate a correlation coefficient, and use a pitch corresponding to the maximum correlation coefficient as the initial pitch; or calculate the sum of absolute values of the LTP residual signal according to the pre-processed signal in the target window and sliding windows of the target window, and use a pitch corresponding to the minimum sum of absolute values as the initial pitch.


In one embodiment, the linear predicting unit 52 may include:


a second windowing module 521, configured to window the input signal; and


a linear predicting module 522, configured to perform LP on the input signal windowed by the windowing module 521, and obtain an LP residual signal.


In one embodiment, the residual-domain refined detecting unit 54 may include:


a refined searching module 541, configured to search for the LP residual signal refinedly by using an auto correlation function or comparing the energy of the LTP residual signal; and


a selected pitch obtaining module 542, configured to use a pitch that enables the auto correlation function to be the largest or the energy of the LTP residual signal to be the smallest within the candidate pitch range as the selected pitch.


The components of the apparatus provided in this embodiment are configured to implement each step of the method in the second embodiment of the present invention. Because each step of the method has been described in detail in the second embodiment, these components will not be further described.


The apparatus provided in this embodiment detects pitches with different accuracy in the signal and residual domains in sequence according to different features of the signal in the two domains. This overcomes the weakness in the prior art. Thus, the complexity of the algorithm is reduced and the accuracy of the pitch detection is guaranteed.


Detailed above are the objective, technical solution and merits of the present invention. Although the present invention has been described through several exemplary embodiments and accompanying drawings, the invention is not limited to such embodiments. It is apparent that those skilled in the art can make various modifications and variations to the invention without departing from the spirit and scope of the invention. The invention shall cover the modifications and variations provided that they fall in the scope of protection defined by the following claims or their equivalents.

Claims
  • 1. A pitch detection method, comprising: performing a pitch detection on an input signal in the signal domain, and obtaining a candidate pitch;performing a linear prediction on the input signal, and obtaining a linear prediction residual signal;setting a candidate pitch range including the candidate pitch; andsearching for the LP residual signal in the candidate pitch range, and obtaining a selected pitch.
  • 2. The method according to claim 1, wherein before the process of performing a pitch detection on an input signal in the signal domain and obtaining a candidate pitch, the method further comprises: pre-processing the input signal and obtaining a pre-processed signal.
  • 3. The method according to claim 2, wherein the process of performing a pitch detection on an input signal in the signal domain and obtaining a candidate pitch comprises: adding a target window around a pulse with the maximum amplitude in the second half-frame of the pre-processed signal;obtaining an initial pitch according to the pre-processed signal in the target window and sliding windows of the target window; anddetecting double frequency of the initial pitch, and obtaining a candidate pitch.
  • 4. The method according to claim 3, wherein the process of obtaining an initial pitch according to the pre-processed signals in the target window and sliding windows of the target window comprises: calculating the energy of the LTP residual signal according to the pre-processed signals in the target window and sliding windows of the target window, and using the pitch corresponding to the minimum energy as the initial pitch.
  • 5. The method according to claim 3, wherein the process of obtaining an initial pitch according to the pre-processed signals in the target window and sliding windows of the target window comprises: according to the pre-processed signals in the target window and sliding windows of the target window, matching the signals around the pulse with the maximum amplitude in the down sampled signal, calculating the correlation function to obtain correlation coefficients, and using the pitch corresponding to the maximum correlation coefficient as the initial pitch.
  • 6. The method according to claim 3, wherein the process of obtaining an initial pitch according to the pre-processed signals in the target window and sliding windows of the target window comprises: calculating the sum of absolute values of the LTP residual signal, according to the pre-processed signals in the target window and sliding windows of the target window, and using the pitch corresponding to the minimum sum of absolute values as the initial pitch.
  • 7. The method according to claim 1, wherein the minimum value of the candidate pitch range is equal to the difference between the candidate pitch and a first threshold, and the maximum value of the candidate pitch range is equal to the sum of the candidate pitch and a second threshold, the first threshold may be the same as or different from the second threshold.
  • 8. The method according to claim 7, wherein the process of searching for the LP residual signal within the candidate pitch range, and obtaining a selected pitch comprises: performing a pitch search on the LP residual signal by using an auto correlation function; andsetting a pitch within the candidate pitch range that enables the auto correlation function to be the largest as the selected pitch.
  • 9. The method according to claim 8, wherein the auto correlation function is:
  • 10. The method according to claim 7, wherein the process of searching for the LP residual signal within the candidate pitch range, and obtaining a selected pitch comprises: performing a pitch search on the LP residual signal by comparing the energy of the long-term prediction (LTP) residual signal; andsetting a pitch within the candidate pitch range that corresponds to the minimum value of the energy of the LTP residual signal as the selected pitch.
  • 11. A pitch detection apparatus, comprising: a signal-domain pitch detecting unit, configured to detect a pitch of an input signal in a signal domain, and obtain a candidate pitch;a linear predicting unit, configured to perform LP on the input signal, and obtain an LP residual signal;a setting unit, configured to set a candidate pitch range that includes the candidate pitch; anda residual-domain refined detecting unit, configured to search for the LP residual signal refined within the candidate pitch range, and obtain a selected pitch.
  • 12. The apparatus according to claim 11, further comprising: a pre-processing unit, configured to pre-process the input signal, obtain a pre-processed signal, and provide the pre-processed signal to the signal-domain pitch detecting unit in the signal domain.
  • 13. The apparatus according to claim 12, wherein the pre-processing unit comprises: a low pass filtering module, configured to perform low pass filtering on the input signal; anda down sampling module, configured to down sample the input signal that has undergone the low pass filtering by the low pass filtering module, and obtain a down sampled signal.
  • 14. The apparatus according to claim 11, wherein the signal domain pitch detecting unit comprises: a windowing module, configured to add a target window around a pulse position with the maximum amplitude in the second half-frame signal of the pre-processed signal;an initial pitch obtaining module, configured to obtain an initial pitch according to the pre-processed signal in the target window and sliding windows of the target window; anda candidate pitch obtaining module, configured to perform double frequency detection on the initial pitch, and obtain a candidate pitch.
  • 15. The apparatus according to claim 14, wherein the initial pitch obtaining module is configured to calculate the energy of the LTP residual signal according to the pre-processed signal in the target window and sliding windows of the target window, and use a pitch corresponding to the minimum energy as the initial pitch.
  • 16. The apparatus according to claim 14, wherein the initial pitch obtaining module is configured to match the signal around a pulse with the maximum amplitude in the pre-processed signal, calculate correlation coefficients, and use a pitch corresponding to the largest correlation coefficient as the initial pitch.
  • 17. The apparatus according to claim 14, wherein the initial pitch obtaining module is configured to calculate the sum of absolute values of the LTP residual signal according to the pre-processed signal in the target window and sliding windows of the target window, and use a pitch corresponding to the minimum sum of absolute values as the initial pitch.
  • 18. The apparatus according to claim 11, wherein the linear predicting unit comprises: a windowing module, configured to window the input signal; anda linear predicting module, configured to perform LP on the input signal windowed by the windowing module, and obtain an LP residual signal.
  • 19. The apparatus according to claim 11, wherein the linear predicting unit comprises: a refined searching module, configured to search for the LP residual signal refinedly by using an auto correlation function or comparing the energy of the LTP residual signal; anda selected pitch obtaining module, configured to use a pitch that enables the auto correlation function to be the largest or the energy of the LTP residual signal to be the smallest within the candidate pitch range as the selected pitch.
CROSS-REFERENCE TO RELATED APPLICATION

This application is a continuation of and claims priority to International Application No. PCT/CN2009/070423, filed on Feb. 13, 2009, which is hereby incorporated by reference in its entirety.

Continuations (1)
Number Date Country
Parent PCT/CN2009/070423 Feb 2009 US
Child 12798715 US