i am using audio streamer to record and audio from microphone
thats how i initialize the audio streamer
on some phones the data.length is too big gives 2048 and some phones its 640
i wanted to low that big length 2048
like dividing the big number by 4
i have been doing this in other ide like following
so stream 2048 is divided by 4 should give 512 i couldn't figure how to do the same in b4a
thats how i initialize the audio streamer
B4X:
audioStream.Initialize2(1, "AudioStream", 8000, True, 16, audioStream.VOLUME_MUSIC)
B4X:
Sub AudioStream_RecordBuffer (Data() As Byte)
Dim Packet As UDPPacket
ToastMessageShow(Data.Length, False)
End Sub
on some phones the data.length is too big gives 2048 and some phones its 640
i wanted to low that big length 2048
like dividing the big number by 4
i have been doing this in other ide like following
B4X:
BUFFSIZE := TJAudioRecord.JavaClass.getMinBufferSize(8000,
TJAudioFormat.JavaClass.CHANNEL_IN_MONO,
TJAudioFormat.JavaClass.ENCODING_PCM_16BIT);
stream := TJavaArray<byte>.Create(BUFFSIZE div 4);
AudioRecorder := TJAudioRecord.JavaClass.init
(TJMediaRecorder_AudioSource.JavaClass.MIC, 8000,
TJAudioFormat.JavaClass.CHANNEL_IN_MONO,
TJAudioFormat.JavaClass.ENCODING_PCM_16BIT, BUFFSIZE);
(AudioRecorder as JAudioRecord).startRecording;
so stream 2048 is divided by 4 should give 512 i couldn't figure how to do the same in b4a