## 2 Materials and Methods
### OneBitPitch Algorithm
The common definition for the autocorrelation of a signal \(x\) is [30]:  
\[r_{xx}(l)=\frac{1}{\text{N}}\sum_{k=1}^{N}x(k)x(k+l) \tag{2}\]  
Figure 2: Period of a periodic signal and its quantized versions. The time at which the signal is measured to be repeating (period) is in orange. The “quantized” version is at N = 4 bits (16 values) and the “sign” version is quantized with 1 bit. With \(l\) being the \"lag\" (progressive shift of a signal to have it slide on the other), \(N\) is the length of the signal in terms of the number of samples, and \(k\) is the discrete time (number of samples). Implementing a full autocorrelation function has some drawbacks: it is relatively computationally expensive due to the need for reiterated multiplications, leading to a complexity of \(\mathcal{O}(\mathrm{N}^{2})\), and further normalization is required because the output is heavily dependent on the magnitude of the input signal and its variations, which skew the autocorrelation [20]. However, for a periodic signal, which can be defined as \(x(k)\), which repeats after a period of \(T\) samples, so that \(x(k)=x(k+T)\), a \"difference function\" can be defined so that its minimum corresponds to the period. The formula, expressed in terms of the lag \(l\) as the independent variable (in a digital sequence simply refers to the sample number), is the following:  
\[d_{xx}(l)=\sum_{k=1}^{N}\lvert x(k)-x(k+l)\rvert \tag{3}\]  
with \(l\) being the lag (sample), and \(N\) is the length of the signal x in samples. This formula will be referred to, for simplicity, as \"modified autocorrelation\", with the basic idea that instead of searching for the maximum of the product like pitch detection algorithms employing \"usual\" autocorrelation, we can search for the minimum of the difference. Moreover, this function is inherently independent of the input amplitude and its variations [31]. Figure 3 displays an example comparing the autocorrelation and the difference function (\"modified autocorrelation\"), showing how the maxima of the first roughly correspond to the minima of the latter. The operation to make the sum independent from negative values can be the square, as implemented by [PERSON] and [PERSON] [20], or the absolute, as we chose. In our specific case, this actually becomes irrelevant due to the 1-bit quantization, which essentially renders this formula into an XOR operation, which is inherently optimized for hardware implementations and parallelization. However, for more than 1-bit quantization, the absolute is still more efficient, especially for FPGA implementations, because it can essentially be realized with a multiplexer for the MSB and a conditioned re-assign of the sign. Figure 3: Comparison of autocorrelation versus the modified difference function version, computed on a signal from the “full2” category (F0 = 100 Hz). Notice how a maximum of the autocorrelation corresponds to a minimum in the difference function. From the O(N\({}^{2}\)) computational complexity of the normal autocorrelation function, a single-bit XOR implementing the difference autocorrelation yields a theoretical constant complexity of O(1), being essentially a binary addiction without carry [32; 33]. The idea behind the OBP algorithm is thus to apply an optimized autocorrelation-based pitch detection to a 1-bit version of the original signal, which drastically decreases computation complexity, especially considering that common bit depths employ 16 to 64 bits. Within this picture, [PERSON] and [PERSON] explored the probabilistic properties of quantizers [34]. The operation of using 1 bit is logically equal to the \"sign\" operation. In the most common digital representations (two's complement, floating-point IEEE-754 [35], sign/magnitude [36]), the MSB (most significant bit) is used as the sign and thus a simple truncation of the original sequence is required--this could also be performed in the hardware domain for maximum speed.