I am a bit confused about how to use the byte[]
-buffer from Java's SourceDataLine.write()
-method: In my program, I try to generate audio data which I am playing back through a SourceDataLine. However, I am generating double
-values and I use 4 bytes for one sample (my AudioFormat
: new AudioFormat(8000f, 32, 1, true, true)
).
What is the best way to convert one double
into four byte
s (/ to "play" a double)?
[PS: Is a sample size of 32 bis good for normal audio playback?]