I have read in data from a wave file, using Java, into a short array because the wave data is stored as 16 bit, twos compliment numbers.
I am using fftw to extract frequency information from the wave data, but it only accepts a double array.
So I think I need to add 32768 to the negative numbers before storing them into the double array and add 32768 to the positive numbers after storing them into the double array. This seems like it would take a lot of cpu power to me.
Is this the correct way to preserve the wave data for fftw? Is there a better way to convert the shorts into doubles while preserving the wave data?
beundead gave the answer in the comments:
"Have you considered (double) Short.toUnsignedInt(yourShortHere);?"