First, it compresses the audio by dividing it into blocks of 32 samples. These are then transformed using HWT, and samples with the least difference between these are subsequently removed. The inverse of the transform is found and audio is played. The amount of compressed samples could range from zero (no compression) to 31 (no signal left). This technique can effectively save at least one-tenth of the samples without any noticeable change.
Spectral-peak extraction module
The audio-processing library has a dedicated module for determining spectral peaks. The module computes a short-time Fourier transform (STFT) followed by the determination of the frequency bins having higher energy levels with the help of a median filter. Inclusion of phase information into the processing significantly improves the frequency estimation.
Spectral information and peak locations along with the noise floor computed with the help of the median filter are returned for each fast Fourier transform (FFT) frame. In Fig. 3, we can see the spectral peaks of a flute. Here, the peaks are spread over the entire spectrum harmonically, till its Nyquist frequency.
Constant-Q transformation for music-processing applications
The function of Constant-Q transform is same as that of an FFT. But this transformation is much suitable for the applications involving the processing of music. The reason is that, each octave has the same amount of bins in case of Constant-Q transformation. A selection of 12 bins per octave can correspond with the western style of music. Fig. 5 shows Constant-Q transformation with an overlay of pitch estimations.
Catering to the academia
Owing to the needs of academics, preference is given to the readability of the code rather than the speed of executions. Algorithms are kept as pure as possible without obscure optimisations. The main intention is to meet the needs of people who are new to music analysis and synthesis. Those who are in the industry can optimise the codes in Java itself or in other alternatives like C++, as per their requirements.
The author is an electronics enthusiast from Kerala