这是我到目前为止所拥有的:
InputStream is = AudioSystem.getAudioInputStream(new File("C:/users/barnao/desktop/uotm.wav"));
byte[] bytes = IOUtils.toByteArray(is);
short[] shorts = new short[bytes.length/2];
ByteBuffer.wrap(bytes).order(ByteOrder.LITTLE_ENDIAN).asShortBuffer().get(shorts);
double[] vals = new double[shorts.length];
for (int i = 0; i < shorts.length; i++)
vals[i] = (double) shorts[i];
FastFourierTransformer fft = new FastFourierTransformer(DftNormalization.STANDARD);
Complex[] freqs = fft.transform(vals, TransformType.FORWARD);
但是我收到的错误信息是输入不是2的幂......
Exception in thread "main" org.apache.commons.math3.exception.MathIllegalArgumentException: 31,590,166 is not a power of 2, consider padding for fix
我该如何解决这个问题?