This description relates generally to the processing of speech.
Speech is generally considered to be a non-stationary signal having signal properties that change over time. These changes in signal properties are generally linked to changes made in the properties of a person's vocal tract to produce different sounds. A sound is typically sustained for some short period, such as 10-100 ms, and then the vocal tract is changed again to produce the next sound. The transition between sounds may be slow and continuous or it may be rapid as in the onset of speech.
A speech signal corresponding to recorded or transmitted speech may be processed to enhance the quality and intelligibility of the speech. This processing may be part of speech encoding, which is also known as speech compression, which seeks to reduce the data rate needed to represent a speech signal without substantially reducing the quality or intelligibility of the speech. Speech compression techniques may be implemented by a speech coder, which also may be referred to as a voice coder or vocoder.
A speech coder is generally viewed as including an encoder and a decoder. The encoder produces a compressed stream of bits from a digital representation of speech, such as may be generated at the output of an analog-to-digital converter having as an input an analog signal produced by a microphone. The decoder converts the compressed bit stream into a digital representation of speech that is suitable for playback through a digital-to-analog converter and a speaker. In many applications, the encoder and the decoder are physically separated, and the bit stream is transmitted between them using a communication channel.
A key parameter of a speech coder is the amount of compression the coder achieves, which is measured by the bit rate of the stream of bits produced by the encoder. The bit rate of the encoder is generally a function of the desired fidelity (i.e., speech quality) and the type of speech coder employed. Different types of speech coders have been designed to operate at different bit rates. For example, low to medium rate speech coders may be used in mobile communication applications. These applications typically require high quality speech and robustness to artifacts caused by acoustic noise and channel noise (e.g., bit errors).
One approach for low to medium rate speech coding is a model-based speech coder or vocoder. A vocoder models speech as the response of a system to excitation over short time intervals. Examples of vocoder systems include linear prediction vocoders such as MELP, homomorphic vocoders, channel vocoders, sinusoidal transform coders (“STC”), harmonic vocoders and multiband excitation (“MBE”) vocoders. In these vocoders, speech is divided into short segments (typically 10-40 ms), with each segment being characterized by a set of model parameters. These parameters typically represent a few basic elements of each speech segment, such as the segment's pitch, voicing state, and spectral envelope. A vocoder may use one of a number of known representations for each of these parameters. For example, the pitch may be represented as a pitch period, a fundamental frequency or pitch frequency (which is the inverse of the pitch period), or a long-term prediction delay. Similarly, the voicing state may be represented by one or more voicing metrics, by a voicing probability measure, or by a set of voicing decisions. The spectral envelope may be represented by a set of spectral magnitudes or other spectral measurements. Since they permit a speech segment to be represented using only a small number of parameters, model-based speech coders, such as vocoders, typically are able to operate at medium to low data rates. However, the quality of a model-based system is dependent on the accuracy of the underlying model. Accordingly, a high fidelity model must be used if these speech coders are to achieve high speech quality.
An MBE vocoder is a harmonic vocoder based on the MBE speech model that has been shown to work well in many applications. The MBE vocoder combines a harmonic representation for voiced speech with a flexible, frequency-dependent voicing structure based on the MBE speech model. This allows the MBE vocoder to produce natural sounding unvoiced speech and makes the MBE vocoder robust to the presence of acoustic background noise. These properties allow the MBE vocoder to produce higher quality speech at low to medium data rates and have led to its use in a number of commercial mobile communication applications.
The MBE vocoder (like other vocoders) analyzes speech at fixed intervals, with typical intervals being 10 ms or 20 ms. The result of the MBE analysis is a set of MBE model parameters including a fundamental frequency, a set of voicing errors, a gain value, and a set of spectral magnitudes. The model parameters are then quantized at a fixed interval, such as 20 ms, to produce quantizer bits at the vocoder bit rate. At the decoder, the model parameters are reconstructed from the received bits. For example, model parameters may be reconstructed at 20 ms intervals, and then overlapping speech segments may be synthesized and added together at 10 ms intervals.
Techniques are provided for detecting whether a speech signal has been “muffled” by a mask being worn by the person who spoke to produce the speech signal, and for boosting the speech to reverse the muffling caused by the mask, while limiting the boosting of background noise.
In one general aspect, compensating a speech signal for the presence of a speaker mask includes receiving a speech signal, dividing the speech signal into subframes, generating speech parameters for a subframe, and determining whether the subframe is suitable for use in detecting a mask. If the subframe is suitable for use in detecting a mask, the speech parameters for the subframe are used in determining whether a mask is present. If a mask is present, the speech parameters for the subframe are modified to produce modified speech parameters that compensate for the presence of the mask.
Implementations may include one or more of the following features. For example, the speech parameters for the subframe may include a speech spectrum and spectral band energies for multiple voice bands, and using the speech parameters for the subframe in determining whether a mask is present may include examining a spectral slope for a subset of the voice bands. For example, a subset of the voice bands in the frequency range from 750 Hz to 4000 Hz may be examined. Determining whether a mask is present may include comparing the spectral slope to a threshold value and determining that a mask is present when the spectral slope exceeds the threshold value. Determining whether a mask is present also may include updating an average spectral slope corresponding to multiple subframes using the speech parameters for the subframe and examining the updated average spectral slope for a subset of the voice bands.
Determining whether the subframe is suitable for use in detecting a mask also may include determining whether signal energy of the subframe exceeds a threshold value.
Modifying the speech parameters for the subframe to produce modified speech parameters that compensate for the presence of the mask may include boosting gains in a subset of voice bands affected by the presence of a mask. Boost levels may vary between voice bands in the subset of voice bands. For example, boost levels may be reduced for any voice bands in the subset of voice bands that do not include signal energy that exceeds noise energy by a threshold margin.
The speech parameters may be model parameters of a Multi-Band Excitation speech model.
In another general aspect, a communications device configured to compensate a speech signal for the presence of a speaker mask includes a microphone, a speech encoder that receives a speech signal from the microphone and generates digital speech parameters, and a transmitter that receives the digital speech parameters from the speech encoder and transmits the digital speech parameters. The speech encoder may be configured to divide the speech signal into subframes, generate speech parameters for a subframe, and determine whether the subframe is suitable for use in detecting a mask. If the subframe is suitable for use in detecting a mask, the speech encoder may use the speech parameters for the subframe in determining whether a mask is present. If a mask is present, the speech encoder may modify the speech parameters for the subframe to produce modified speech parameters that compensate for the presence of the mask and provide the modified speech parameters to the transmitter as the digital speech parameters.
Implementations may include one or more of the features discussed above.
In another general aspect, a speech encoder configured to compensate a speech signal for the presence of a speaker mask is configured to receive a speech signal, divide the speech signal into subframes, generate speech parameters for a subframe, and determine whether the subframe is suitable for use in detecting a mask. If the subframe is suitable for use in detecting a mask, the speech encoder may use the speech parameters for the subframe in determining whether a mask is present. If a mask is present, the speech encoder may modify the speech parameters for the subframe to produce modified speech parameters that compensate for the presence of the mask and provide the modified speech parameters to the transmitter as the digital speech parameters.
Implementations may include one or more of the features discussed above.
Other features will be apparent from the following description, including the drawings, and the claims.
Referring to
The mask compensator 110 receives the indication 120 and speech parameters 125 and, when a mask is present, modifies the speech parameters 125 to account for the presence of the mask. The mask compensator then produces output speech 130 that has been modified to account for the presence of a mask. The output speech may include speech parameters, an analog or digital speech signal, or sound produced by a speaker within the mask compensator 110.
Wearing a mask while speaking has been observed to cause negative impact to the quality and intelligibility of speech, such as speech corresponding to the speech signal 115. The mask, whether it is a cloth mask or an N95 mask, acts like a filter. As shown in
In one implementation, the mask detector 105 determines whether a mask is present by examining the spectral slope of the speech signal. When a mask is detected, the mask compensator 110 applies an inverse filter to correct for the mask by boosting impacted portions of the speech signal. This correction is complicated by the presence of background noise, as simply applying a static inverse filter to the signal would amplify the background noise as well as the signal. To account for noise, the mask compensator 110 dynamically weights the filter such that the mask correcting boost is eliminated when the signal is primarily noise. The mask compensator 110 also may apply the boost in frequency bands that contain primarily signal while not applying the boost in frequency bands that are dominated by noise.
Referring to
Speech parameters then are generated for a subframe (step 310). This includes computing a 256-point DFT on the windowed speech corresponding to the subframe to produce a speech spectrum. The speech spectrum is used to calculate sixteen spectral band energies for bands that are each 250 Hz wide, where the mask detector 105 examines the spectral slope of voice bands in the spectrum between 750 Hz and 4000 Hz to determine whether a mask is present. The spectral band energies are used to estimate noise levels in the sixteen bands. The noise estimation is made by averaging the signal levels in each band over time and by tracking the minimum signal level observed in each band.
The mask detector 105 maintains a Boolean state variable that tracks whether a mask has been detected. The average gain and the average spectral slope over multiple subframes also computed and tracked. Certain subframes that are low in energy or have a slope that is too small are excluded from the average spectral slope calculation. Bands that are dominated by noise also are excluded from the slope calculation.
When a subframe is processed, the mask detector 105 determines whether the subframe is suitable for use in updating the average spectral slope (step 315). If the subframe is suitable, the mask detector 105 updates the average spectral slope (step 320) and compares the updated average to a threshold (step 325). If the average exceeds the threshold, a mask is determined to be present and the mask detector 105 updates the Boolean state variable to indicate that a mask is present (step 330). If the average does not exceed the threshold, no mask is determined to be present and the mask detector 105 updates the Boolean state variable to indicate that no mask is present (step 335).
The mask compensator 110 generates an initial frequency boost curve for the subframe (step 340). The mask compensator does so using the speech parameters for the subframe and the state variable indicating whether a mask is present. When a mask is present, the initial boost curve provides 12 dB of gain at 4 kHz and tapers linearly to 0 dB of gain at 750 Hz. When no mask is present, the boost is 0 dB for all frequencies. This initial boost curve would be the best filter to correct the signal if no background noise were present.
The mask compensator 110 then weights the boost curve to account for noise (step 345). This weighting is undertaken to prevent boosting of bands that are dominated by noise. For each band, the mask compensator 110 compares the signal level for the band to the noise level for the band. When the signal level exceeds the noise level by enough margin, the boost weighting for the band is set to 1.0 (full boost) for the current subframe and several subsequent subframes. When the signal level exceeds the noise level by another smaller margin, then the boost weighting for the band is set to 0.5 (half boost) for the current subframe and several subsequent subframes. Otherwise, the boost weighting for the band is set to 0.0 (no boost) to disable boosting for the band. As long as the presence or absence of a mask doesn't change, the weights are held for several subframes because it is not desirable to switch the dynamic weighting excessively. The overall effect is to reduce or eliminate the boost for bands where the signal-to-noise ratio is low.
The mask compensator 110 then applies the weighted boost curve to the spectrum (step 350). For example, the log2 boost curve may be converted to a linear scale at each DFT frequency and the DFT coefficients may be scaled accordingly. This eliminates or reduces the attenuation to the spectrum imposed by the mask without boosting the background noise. The resulting boosted spectrum then may be used to estimate the spectral magnitudes of each voice harmonic.
The modified spectrum then is used to generate enhanced output speech (step 355) before proceeding to the next subframe.
The speech processing system 100 may be operated independently to enhance a signal that is potentially degraded by a mask, or it may be incorporated into a speech coder, such as a AMBE vocoder that uses the spectrum to estimate the magnitudes for each voice harmonic. When mask detection and compensation is employed, this spectrum gets scaled to compensate for the mask. However, an inverse-DFT also may be applied to the spectrum to produce a modified spectrum that then is overlap-added with neighboring spectra to get a resulting compensated speech signal.
A mask detector and a mask compensator, such as the mask detector 105 and the mask compensator 110, may be incorporated most efficiently in the MBE speech encoder unit 415, but may also be employed in the MBE speech decoder unit 430. And the mask detector and the mask compensator may be divided, with the mask detector being included in the MBE speech encoder unit 415 and the mask compensator being included in the MBE speech decoder unit 430. And some implementations may include only a mask compensator, with the presence of the mask being determined by other means, such as a camera or an indication by a user (e.g., by pressing a button).
The details of a particular implementation of the procedure 300 in an MBE vocoder are provided below.
Spectrum Measurement
The input to the process is an 8 kHz speech signal, s(n). However, the process can be adjusted to work for different sampling rates. For each subframe, the spectrum, Sm(k), is measured from s(n) and stored for later use in estimating the MBE spectral amplitude model parameters. The spectrum is measured by first windowing s(n) and transforming the result into the frequency domain using DFT:
Where wm(n) is a 25 ms hamming window defined as follows:
The square magnitude of the result is stored as the spectrum measurement, Sm(k) for the subframe:
S
m(k)=|Sw
Computation of Spectral Band Energies
The spectrum, Sm(k), is used to compute the spectral energy in 16 frequency bands:
e
i=0.5 log2[Σk=8i8i+15Sm(k)]−7.0 for 0≤i<16
Estimation of the Noise Spectrum
The spectral energies in each band are then used to update an estimate of the noise energy in each band. The following process is used:
The process updates three vectors. The vector ai for 0≤i<16 stores the average noise level for each band. The vector mi for 0≤i<16 tracks the minimum noise level for each band. The vector ci for 0≤i<16 contains a 3 second counter for each band. Note that the process is designed to be called at 10 ms intervals such that 300 iterations of the process corresponds to 3 seconds. Generally, a speaker pauses to breathe more often than once every 3 seconds.
The initial conditions for each of the state variables above are as follows:
a0=7.0, a1=6.0, a2=5.0, a3=4.0, a4=3.0, a5=2.0
ai=1.0 where 6≤i<16
mi=16.0 where 0≤i<16
ci=16.0 where 0≤i<16
Vcount=0
Note that, in the process above, the superscript notation, v(0), refers to the new value for variable v in the current subframe. Whereas, v(−1), refers to the prior value for variable in the prior subframe.
Calculating the Dynamic Boost Weighting
The spectral band energies from the current subframe, Sb(n), and the current estimate of noise spectrum, are used to compute a set of weights. Integer counters, CFB(n) for 0≤n<16, are updated as follows:
When CFB(n)>0, for band n, the weight for that band will allow full boost. Additionally, integer counters, CHB(n) for 0≤n<16, are updated as follows:
When CFB(n)>0, for band n, the weight for that band is 1.0, enabling full boost for that band. When CHB(n)>0, for band n, the weight for that band is 0.5, which will allow half boost for the band. Otherwise, the weight for the band is 0.0, which disables boost for the band.
Later, these weights will be applied to the boost filter. The weights can reduce or eliminate the boost in particular bands that are noisy.
Mask Detection
Mask detection uses the spectral band energies, ei for 0≤i<16, and the average noise levels, ai for 0≤i<16. Mask detection also uses three state variables: is the detector state, GM is the maximum gain, and MA is the average slope. Variable d is a Boolean where 0 indicates that a mask has not been detected and 1 means that a mask has been detected. d(−1) refers to the value of variable d in the prior subframe, whereas d(0) (or simply d) refers to the value of variable d in the current subframe. The initial value for d is 0. Similarly, the superscripts (−1) and (0) can be used to refer to values of variables GM and MA in the prior and current subframes. The initial values are: GM=0 and MA=9.0/16.
As an initial step in mask detection, the noise cutoff band is determined. This is the lowest frequency band for which the signal energy does not exceed the noise energy by at least 3 dB.
if ei←1−0.5<ai→1 then C=i
If C<6, then this subframe does not have enough bands with voice and the mask detection process ends and returns the detection state of the prior subframe. If the mask detection process ends at this point, then state variables GM and MA are not updated.
If C<6 then {d(0)=d(−1),GM(0)=GM(−1),MA(0)=MA(−1)}
Next, a gain value is computed by computing the average spectral band energy in the lowest 6 frequency bands.
Next, the maximum gain is updated as follows:
If G<GM−1.0, then the mask detection process ends and returns the detection state of the prior subframe. The mask detector excludes low energy subframes from detection.
d
(0)
=d
(−1) when G<GM−1.0
M
A
(0)
=M
A
(−1) when G<GM−1.0
Otherwise, the detection process continues and the spectral slope of the current subframe is computed as follows:
If the spectral slope is less than 3.0, then the detection process ends and returns the detection state from the prior subframe.
d
(0)
=d
(−1) when MC<3.0
M
A
(0)
=M
A
(−1) when MC<3.0
The average spectral slope, MA, is then computed as follows:
Note that this approach allows the average slope to capture abrupt increases in slope, while accounting for decreases in slope over a longer time period. This allows for earlier detection when a mask is present.
The average spectral slope is used to update the current mask detection state, d(0), as follows:
Next, the log2 boost at 4 Khz is computed. If a mask was detected, the log2 boost is 2.0, representing a 12 dB gain at 4 kHz. Otherwise, the log boost is set to 0.0 if no mask is detected.
M
B=2.0d(0)
As a variation of the mask detection process, the boost required to compensate for the mask can be derived from the average spectral slope in relation to a typical spectral slope. This allows the amount of boost to vary depending upon different mask characteristics. This also may allow for correction of muffling caused by something other than a mask.
Calculation of the Boost Required to Compensate for the Mask
After the mask detection process determines the appropriate boost, MB, the amount of boost, B(i), to be applied to the spectrum at each DFT frequency is calculated as follows
The variable corresponds to frequency, where i=0 represents 0 Hz and i=128 represents 4 KHz
Applying the Boost Weighting Function to the Boost Filter
The weighting function, w(n), was computed previously for sixteen bands. The weighting is next applied to the boost as follows:
Applying the Boost to the Spectrum
{dot over (B)}(i) represents the log2 boost to be applied to the spectrum, Sm(i). The boosted spectrum is denoted, {dot over (S)}m(i), and is calculated as follows:
{dot over (S)}
m(i)=22{dot over (B)}(i)·Sm(i)
Since Sm(t) represents the squared magnitude, the scale factor is 22B(i) rather than just 2B(i).
This is what would happen if the scale factor was applied to the real and imaginary components of the spectrum prior to squaring and summing them.
Magnitude Estimation
The magnitudes for each harmonic of the subframe are estimated by using a weighted sum of the boosted spectral energies.
The spectral weighting function, wME(k,l,f), is defined as
As can be seen in this equation, the weight at a particular frequency is 0.0 for energy that is wholly contained in another harmonic (or band). The weight is 1.0 when the energy is entirely contained within the current harmonic (or band). The weight is between 0.0 and 1.0 when the energy at a particular frequency is split between the current harmonic (or band) and an adjacent harmonic (or band).
While the techniques are described largely in the context of a MBE vocoder, the described techniques may be readily applied to other systems and/or vocoders. For example, other MBE type vocoders may also benefit from the techniques regardless of the bit rate or frame size. In addition, the techniques described may be applicable to many other speech coding systems that use a different speech model with alternative parameters (such as STC, MELP, MB-HTC, CELP, HVXC or others) or which use different methods for analysis, quantization. Other implementations are within the scope of the following claims.