DFT for audio classification - signals of different lengths If I have a set of signals each with $n$ points, I can take the DFT of each and then use the resulting frequency domain vectors as features for some classification algorithm. If the signals are differing lengths, the frequency basis used by the DFT is no longer the same. This means I can no longer directly use DFT as features if I want to compare signals of varying length. What should I do about this?

In other words, I want to convert each audio signal into a length $m$ vector of frequency components, and use the same $m$ for all signals.

I realise there is fundamentally more information in a longer signal, so any conversion will involve some loss of information.
As you explicitly mention, that you are aware of a loss of information and are willing to accept that, a possible solution will be modulo-N reduction or wrapping, as described by Orfanidis in the freely available book "Introduction to Signal Processing" on pages 489ff.

In modulo-$N$ reduction, a vector $x$ with length $L &gt; N$, where $N$ is the DFT length, is divided into non-overlapping blocks of length $N$. These blocks are summed up, resulting in one vector $\tilde{x}$ of length $N$ .


Figure taken from Orfanidis (linked above), Fig. 9.5.1 on page 489.

You then apply the DFT on $\tilde{x}$, which results in $\tilde{X} = \text{DFT}\{ \tilde{x} \}$ with length $N$. Orfanidis proves that $\tilde{X}$ is exactly equal to the $N$-point DFT of $x$, so is equal to $X$.

In your case, that would mean you could find a minimal length $N$, which is guaranteed for all input signals. You then apply a modulo-$N$ reduction on all your input signals and compare these length-$N$ DFTs. Of course, a higher resolution would be possible for longer signals, and you just ignore this by using the modulo-$N$ reduction method.

Similarly, you could just zero-pad all signals to a maximal length $M$. All your signals will then have a high frequency resolution defined by $M$. Important point: you do have that computational frequency resolution, but the physical frequency resolution is still determined by the length of your signals $L$. More details on this are given in any decent signal processing class or on pages 482ff in Orfanidis.