Hey Paul! I hit a point where a little audio mixer would be a big plus, so I started working on one as well. You are surely further along than I am, but there's stuff you plan to do which I am going to take a pass on, like offering a broad range of format conversions.
The program I wrote today mixes six lines, but still lacks channel and master volumes, and needs some click prevention for the starts & stops. Four lines are for standard signed PCM .wav files (stereo, 16-bit, little endian). Two are for an Interface I am calling (unless someone has a better suggestion) NormalizedFloatAudioLine. This functions sort of like a TargetDataLine, in that you can read audio data from it. It delivers an array of floats assumed to be between -1 and 1 rather than bytes. (But I don't do anything in the program of the Interface to enforce this.)
Maybe there is already something out there like this? It seems like a logical thing for audio.
1 2 3 4 5 6 7
| public interface NormalizedFloatAudioLine { int read(float[] buffer, int n); void start(); void stop(); boolean isRunning(); } |
The point of this is that I'm starting to do more with synthesizing sounds on the fly, and most of the work is done with floats. It seems pointless to make the output a byte stream only to convert back to floats when the mixing happens. Yes?
Because the data is generated at the time of the read, there is no need to hassle with draining lines. Lots of other DataLine & TargetDataLine methods seem unnecessary as well. I don't know if this is something you'd consider supporting, but I thought I'd put it out there.
I just started playing with FM synthesis (frequency modulation), using the WaveTables from the JTheremin code. I wrote my first sirens and ray guns this week! It is marvelously efficient way to do SF/X, imho, and I just need to get a little mixer running so that I can show them off more easily.
