# Wearable Voice Dosimetry System
## 3 Materials and Methods
### Signal Processing
#### 3.2.5 \(F_{0}\) Estimation  
Existing devices estimate \(F_{0}\) using either the magnitude of the short-time spectrum or its autocorrelation [41]. In the first method, the spectral peaks are found that correspond to \(F_{0}\) and its harmonics. In the second method, the autocorrelation of the magnitude spectrum is computed and the first peak corresponds to \(F_{0}\). Both methods have their limitations. The magnitude spectrum approach fails when the voice signal intensity and \(F_{0}\) are low, as the spectral peak of any of the harmonics can be easily confused with spectral peaks due to noise. In the case of the autocorrelation method, at least two harmonics (\(F_{0}\) counts as a harmonic) must fall within the frequency range analysed, that is 0-\(F_{s}/2\), where \(F_{s}\) is the sampling rate. If the \(F_{0}>F_{s}/6\) (340 Hz in our case), only two harmonics will be present in the signal spectrum, and if \(F_{0}>F_{s}/4\) (512 Hz in our case), there will be only one, which is when the method will fail as shown in Figure 5. Merging the two methods allows us to combine the strengths of both while avoiding the pitfalls of either. The strategy is to use the autocorrelation of the magnitude spectrum for \(F_{0}\) estimation whenever possible and only if that fails, resort to \(F_{0}\) estimation from the magnitude spectrum. Autocorrelation is  
Figure 4: Example of accelerometer signal processing: (**a**) signal waveform, (**b**) FFT magnitude with the voiced activity detection threshold, and (**c**) FFT magnitude low-pass filtered. more robust at low frequencies (\(F_{0}\) < 480 Hz) and for analysis intervals that contain signals with more than one \(F_{0}\) (for example the ending of one vowel, a pause, and the beginning of another vowel). 1. \(F_{0}\) estimation from magnitude spectrum:  
The speech signal of voiced phonemes is assumed to be quasi-periodic and, consequently, the \(F_{0}\) and its harmonics are equidistant in frequency. Intuitively, we expect that the frequency corresponding to the highest peak of the magnitude spectrum is \(F_{0}\) (up to the frequency resolution, which is 4 Hz in our case). Although in many cases this is true, it may also happen that the \(F_{0}\) peak is not the one with the highest magnitude and, consequently, this fact must be determined for every analysis interval. We have observed experimentally  
Figure 5: Magnitude spectra, their filtered versions and the autocorrelation functions of their filtered magnitude spectra for the test signals used to verify algorithm implementation. All harmonics signals are sines. The test signals are as follows: (**a**) \(F_{0}\) = 120 Hz, three harmonics (1, 1, 1); (**b**) \(F_{0}\) = 200 Hz, three harmonics (0.5, 0.7, 1); (**c**) \(F_{0}\) = 400 Hz, two harmonics (0.5, 1); (**d**) \(F_{0}\) = 600 Hz, one harmonic. that, if there is any harmonic peak prior to the one with the highest magnitude, its magnitude is always greater than \(1/3\) of the maximum of the magnitude spectrum vector, which we will denote by \(v_{\rm FFT}\). We will consider two cases: the highest peak corresponds to the second harmonic, or the highest peak corresponds to the third harmonic. In the first case, we denote the sample position of the second harmonic peak by \(p_{\rm FFT}\). Consequently, there must be another peak corresponding to the first harmonic at the sample position \(p_{\rm FFT}/2\). As the peak positions can only be integer numbers, we extend the search to round \((p_{\rm FFT}/2)\) - \(1\ldots\) round\((p_{\rm FFT}/2)\) + \(1\). Out of the three, the position that has the maximum magnitude is selected and if that magnitude is greater than \(1/3\)\(v_{\rm FFT}\), that position is declared the \(F_{0}\) (in samples). In the second case, we test if the maximum corresponds to the third harmonic: we repeat the above procedure, except that the \(p_{\rm FFT}\) is divided by three. The value of frequency \(F_{0}\) is stored in \(p_{\rm FFT}\) and the corresponding magnitude is in \(v_{\rm FFT}\). See Algorithm A1 in Appendix A for a formal description;  
2.