- Jun 6, 2020
- 11,559
- 4,422
I have been looking for the best way to mix audio tracks with B4x for quite a while. Java basically provides a number of methods which I have tried. The audio Clip class allows skipping through the track, but it does not allow access to the raw byte data necessary to perform audio mixing. Then AudioInputStream (and related classes) do allow access to the raw byte so mixing can be performed, but it does not allow moving to any other positions in the track easily.
I came up with the idea of creating a WavRandomAccessFile class, which is basically a RandomAccessFile that is audio aware. It gets the all important AudioFormat from the file and parses the Wav header to find the start and end of the audio 'data' chunk. This is important as wav files can contain many different chunks, and the data chunk is not necessarily at the end of the file.
The WavRandomAccessFile class can be found in jAudioTrack2 v1.2+
This example app provides 2 code modules that do the mixing of the audio...
I came up with the idea of creating a WavRandomAccessFile class, which is basically a RandomAccessFile that is audio aware. It gets the all important AudioFormat from the file and parses the Wav header to find the start and end of the audio 'data' chunk. This is important as wav files can contain many different chunks, and the data chunk is not necessarily at the end of the file.
The WavRandomAccessFile class can be found in jAudioTrack2 v1.2+
This example app provides 2 code modules that do the mixing of the audio...
برای دیدن لینک ها باید ثبت نام کنید
برای دیدن لینک ها باید ثبت نام کنید