Android-Wave-Recorder
Android-Wave-Recorder copied to clipboard
Not working with ENCODING_PCM_FLOAT
When I configure the wave with waveRecorder.waveConfig.audioEncoding = AudioFormat.ENCODING_PCM_FLOAT
the recorder bugs and creates a audio file with 44bytes. Any chance to implement this feature to allow recording audio with AudioFormat.ENCODING_PCM_FLOAT
?
Thanks.
The library doesn't support ENCODING_PCM_FLOAT and ENCODING_PCM_32BIT currently, But we will try to add this feature in the next release.
@squti i really need this right now. I am ok implementing. Can you explain a bit where it fails with ENCODING_PCM_FLOAT
and ENCODING_PCM_32BIT
?
@farfromrefug You need to add these lines to bitPerSample
function in WaveConfig.kt
file.
AudioFormat.ENCODING_PCM_32BIT -> 32
AudioFormat.ENCODING_PCM_FLOAT -> 32
For ENCODING_PCM_FLOAT You also need to write another function like writeAudioDataToStorage
in WaveRecorder.kt
which reads data in the type of FloatArray
instead of ByteArray
.
You also need a function to check if the device supports ENCODING_PCM_32BIT and ENCODING_PCM_FLOAT before recording.
Commit 6e5558285a94a772f6d32962a545cbe1e3c12a13 resolves this issue.