Hi
I have been using the AudioTrack class (android) to playback audio on an app I am developing and it has been great... very easy to use...I
create an array of shorts (wav data) on the fly and simply write it in a loop to an AudioTrack instance that is set to 'play'.
I now want to do similar in Java (for PC/Mac version) but the Java SDK doesn't seen to have anything as easy to use. I know that Java uses lines etc and I have examples (complicated!) of getting a wav file (from disk), and then sending to a line for playback, but I am struggling to see how to send to my array of shorts. I know I need to send bytes and that's OK... but it's the actual raw data I am struggling to send instead of a file on disk...
Does anybody have a neat way to do this... maybe something that replicates the android AudioTrack class in some way, or skeleton Java code that does this that I can adapt?
OR... can Minim do this... all I can get it to do is to play snippets or files that are pre-loaded, nothing that allows me to generate raw 16-bit audio data on the fly and use an output buffer to stream it to an output.
Perhaps someone has done this...?
Many thanks
Mark
ps an AudioTrack clone as a Processing core feature would be a great addition, even just with play/stop/close methods... dreaming...
1