Hello. I'm trying to combine various WAV files as they're being playing into my application. Basically all I'm trying to do is when I click on a JButton it plays a WAV file, and when I click on another JButton it plays different WAV file. I've got about 10 of these JButtons, all with different WAV file attached to them.

When I click on the record button every sound that I play gets merged with the next sound i.e WAV1 + WAV2 + WAV3 + WAV4 = COMBINED.wav.

How I understand that I will need to calculate the frame size of each WAV file and store that within the header of the COMBINED.wav file.

I'm not too sure HOW I will go about doing this. I thought of having a buffer to store the wav files as they're being playing, and calculating their sizes just before they're being stored into the buffer, and when I click stop record, saving the contents of the buffer into a WAV file.

Does anyone have any ideas which buffer I could use, or what?

Thanks