Android-Wave-Recorder icon indicating copy to clipboard operation
Android-Wave-Recorder copied to clipboard

Not working with ENCODING_PCM_FLOAT

Open sixdaystudio opened this issue 2 years ago • 3 comments

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.

sixdaystudio avatar Nov 17 '22 04:11 sixdaystudio

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 avatar Nov 19 '22 07:11 squti

@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 avatar Jan 24 '23 16:01 farfromrefug

@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.

squti avatar Jan 29 '23 05:01 squti

Commit 6e5558285a94a772f6d32962a545cbe1e3c12a13 resolves this issue.

squti avatar Aug 10 '24 16:08 squti