I have multiple audio files converted into byte array for each, and i have start time and end time of each audio file (these audio files are converted from video so i have its time stamps).
Now i want to merge these byte array of audio files to create one single audio mp3 file. I tried to simply merge these two array and it successfully creates a single mp3 file but it doesn't have any pause in between.
I want to add silent audio between each file based on the difference of start time and end time of each file. To achieve that, i added 0 bytes for each second difference between each array but it doesn't add sufficient pause.
Is there any way to determine how many bytes it will require to add for each second?
Every audio has 8000 sample Rate Hertz.
Following is the code i am using to add 0 bytes.
ArrayList<Byte> buffer = previousTranslation.getAudioBuffer();
// to get gape in seconds between two audio files from a video
int diff = (int)differenceBetweenTwoCalendar(
previousTranslation.getSentenceEndTime(),
translation.getSentenceStartTime());
// Add 0 bytes for each second between two audio buffers(bytes array)
for(int j = 0; j < diff; j++)
buffer.add((byte) 0);
// Add seconds part of audio buffer byte array
buffer.addAll(translation.getAudioBuffer();
question from:
https://stackoverflow.com/questions/65851553/adding-silent-pause-between-byte-array-of-two-audio 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…