Thanks for the reply! Agreed, I’ve had to take multiple passes on the Java Audio documentation and I really don’t understand why the best example code is so far back.
The point of using a floats array is that this is a good data representation for DSP. I think it is pretty much standard, like using unit vectors. I don’t know that anything is saved in terms of memory or RAM or speed. A single float requires several bytes, and you are still using 44100 frames per second, presumably. A friend has a “stretching” algorithm that I want to try, but it assumes a float array.
(My task today, if I get time this evening, is to take my float array and convert it back to a wav for playback. Have to make a .wav FileFormat, attach it to a SourceDataLine that supports wav playback, yada yada. We’ll get to the stretching part later.)
About protecting composition, I’m not sure what to say. If you have a good ear, you can pretty much pick apart (transcribe) anything. And of course, you can direct a sound stream into a DAW. With a book, every word is there. With a painting or film, all the visuals are right there in the open. Software is also possible to decompile, as witnessed by several threads on this site, including a rather humorous one in which one of my own bright attempts at a Captcha Applet was decompiled. (Within hours of posting, Markus Persson & Dzzd had pretty much shredded it to pieces.)
http://www.java-gaming.org/index.php/topic,23389.0.html
If you embed your mp3’s or ogg’s or wav’s or whatever as a resource, I’m sure it can be decompiled. But what else is there? It’s too slow/unreliable to stream (except for maybe some very special cases where it could work…), so audio content should be delivered with the game, I think. I suppose one could make some sort of scrambler and include that as a layer. But the code for the descrambling would also be easy to decompile and redo. Costs/benefits.
Another thought: I’ll put off worry about theft until it becomes apparent someone likes something enough to actually steal it.