IAudioSamples samples = IAudioSamples.make(sampleCount, channelCount);
// create the tone generator
TestAudioSamplesGenerator generator = new TestAudioSamplesGenerator();
generator.prepare(channelCount, sampleRate);
// write some data, so that the media header will be written
generator.fillNextSamples(samples, sampleCount);
writer.encodeAudio(audioStreamIndex, samples);