1

I have an array of bytes representing data from a .wav file. I want to convert it to an array of doubles, so that I can do operations such as FFT on it to determine whether one file is contained in the other.

Right now, I simply cast the bytes to doubles, which gives me decent results, but not as precise as I would like. I know this is improper conversion, and I feel like it is causing me to miss data, because of the difference in what bytes and doubles represent.

How can I convert the byte array to a double array properly before doing the FFT correlation?

1
  • How do you want to convert it to double? I mean if you have byte[] bArr; where size of bArr is 8, do you want to convert 8 bytes to 1 double, or do you want to convert such array to array of 8 doubles? Commented Dec 1, 2010 at 0:54

1 Answer 1

4

If each byte actually represents a signed 8-bit sample value, then the data has been lost when the sample was recorded, and there is nothing improper or imprecise about casting to double (which can accurately represent all values that byte can) - there isn't really anything else you can do.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.