This repository contains an example of computing a HFTNN - a modified version of a discrete Fourier transform, suitable for training neural networks on content that is harmonic in nature.
The resulting transforms may greatly reduce the required size of the input layer of a NN. For data such as e.g. piano performances or synthesizer pads, a HFTNN of a given discrete signal removes redundant information, which includes any inharmonic noise that may be present in the dataset.
For example usage, you may refer to the demo contained in the repository.
For a temporal HFTNN forward transform, the following steps are done:
- Given a discrete signal
$x[n]$ , the signal is split into non-overlapping, windowed chunks of length$N$ . Each chunk is denoted as$x_{chunk}[k]$ , where$k$ is the index of the chunk.
- The Fourier transform of each chunk
$x_{chunk}[k]$ is denoted as$X_{\text{chunk}}[k]$ .
- For each Fourier transform bin, harmonics are selected within a specified range of octaves, including neighboring bins. Let
$HFT$ be the resulting array.
Here,
- The frequency corresponding to each harmonic is calculated using a function
$\text{freq}(j)$ . The corresponding FFT bin index is denoted as$\text{binIdx}(j)$ .
- To handle edge cases where the computed bin index
$binIdx$ and neighboring indices$idx$ may go beyond the bounds of the array, a conditional statement is used.
In summary, the abstraction involves the concept of signal chunking, Fourier transformation, harmonic selection, frequency calculation, and handling edge cases for each selected harmonic. The resulting
A similar algorithm is used for the inverse temporal transform.
Note
This document is currently a work in progress, and does not describe the full operation of the HFTNN algorithm.