Public void onVoipDataOutput (byte [] bytes, int I)
Bytes sent to my MIC is the underlying data, I is the length of the data;
Now I want to write a speech file, the data and use the player out,
Using the Java code, who has experience in this field? Give advice or comments please!
CodePudding user response:
Use avilib. C to write this file, general process is as follows:Avi_fd=AVI_open_output_file (mFd);
If (avi_fd!=NULL)
{
/* 1 here refers to a single channel, 44100 refers to the sampling rate, 16: what is the sampling rate refers to the unit, 255 refers to aac, 128 refers to the bit rate */
AVI_set_audio (avi_fd, 1, 44100, 16, 255, 128);
AVI_write_audio (avi_fd, (char *) bytes, I);
AVI_close (avi_fd);
}
If your voice is PCM format, that the above 255, be WAVE_FORMAT_PCM,
CodePudding user response:
Avilib. C code, you can go to my blog resources to download, you use the Java code, it can be encapsulated into a nativie interface is ok,