How to convert a PCM file that was created by the Recorder app?

I have been running e_zangya-userdebug 9 PQ3A.190801.002 eng.root.20220412.18338 dev-keys.dev-release for a couple of years and I never installed any Google apps etc, I disabled basically everything I could, and I have only been using it in a very basic capacity.

One of the features I would use most often is the Voice Recorder app, because in my call of duty this has become a necessary thing.

I have noticed that the files can become quite large when it has been running for a long time, and the app creates a PCM file while it is recording, that it then converts to a wav file when the recording is stopped.

I have on occasion ran into a problem where the pcm file is not converted into a wav file, usually because the battery goes flat while it’s recording so the app isn’t able to run the conversion script. I’ve been lucky that I haven’t really needed to use the recording, but this time is different.

This time I have a PCM file and a wav file, and the wav file contains no data, it’s a flat line although it is 600MB in size. The PCM is 900MB in size, and I’ve tried to convert the PCM to a wav file with ffmpeg using various different settings, but every time it just results in no audio, a flat line.

I haven’t been able to find information that says what the bitrate and sample rate is for the PCM file that org.lineageos.recorder creates, and there is no button for a menu to access settings in the app, so I really just don’t know what settings I should be using.

This file is actually quite important as evidence for a matter of legal clarification and I have made claims that the conversation was being recorded, I don’t feel confident that it will serve me well if I have to say that somehow the recording failed this time because they’re already of a mind to believe their imagination over and above the things I say, every chance they get.

Appreciate any pointers, thanks.

Regain your privacy! Adopt /e/OS the deGoogled mobile OS and online servicesphone

1 Like

Do you have access to a computer?

MediaInfo by MediaArea can tell you lots about the file, you can use Audacity to inspect the waveform, and you can use something like Sound Converter on Linux to re-encode it to OPUS.

Yeah thanks, I wish I was able to do all of that, but in this case unfortunately it doesn’t show any waveform in Audacity, it’s like the file is corrupted, it’s doing really weird things.

I used mediainfo on the .wav file and it gave this:

General
Complete name : /home/antz/Desktop/tmp/SoundRecord-details-redacted-for-online-submissions.wav
Format : Wave
File size : 612 MiB
Duration : 12 min 8 s
Overall bit rate mode : Constant
Overall bit rate : 7 056 kb/s
IsTruncated : Yes

Audio
Format : PCM
Format settings : Little / Signed
Codec ID : 1
Duration : 12 min 8 s
Bit rate mode : Constant
Bit rate : 7 056 kb/s
Channel(s) : 1 channel
Sampling rate : 44.1 kHz
Bit depth : 16 bits
Stream size : 612 MiB (100%)

but when I open it in Audacity it has no waveform and it’s 2hr 1min 20.640s duration. When I open it in VLC it shows as only being 12m 08s duration, and the playback is super-slow, like 10 seconds to increment 1 second on the transport, and there is no sound.

It gives an error when I try to open it with sound converter.

The PCM file doesn’t do any of that, and whenever I try to import it as raw data into Audacity it gives a zero waveform. I have tried all different settings.

I made a video that shows what’s happening:

https://streamable.com/izhp3g

see this branch for details - SoundRecorderService.java and PcmConverter.java

    private static final int SAMPLING_RATE = 44100;
    private static final int FORMAT = AudioFormat.ENCODING_PCM_16BIT;

(btw, not substantial to your demand, but I wondered on PCM vs something more space efficient: zangya goes up to Android 9 / Pie, in 11 / R the Recorder got AAC encoding added, so files aren’t so big anymore )

Hi
Please take for your future audio recordings this app:
https://f-droid.org/packages/com.github.axet.audiorecorder/
Best app for recording and tracker free.
No battery also no problem. Just continue recording after restart the phone.
In the options you take mp3 and mono if stereo is not needed. This way one hour record makes about 70mb.
Pcm and wav is crazy, do not go this way any further.

About transcoding your 600mb file, it is a huge file and i could imagine several programs have problems to open it.
My advice: transcode with ffmpeg. If this wont do it I would forget about it.

1 Like

Thanks for the info and for the link to the source code. That is the relevant information that I was looking for when I opened this thread.

I have found that this case is most likely a data corruption problem because I have found another .pcm file and have successfully decoded it by importing the RAW Data into Audacity with these settings:

Signed 16 bit
44100kHz
little-endian
mono

Here’s a screenshot of the settings for anyone needing this info in future:

Screenshot at 2024-04-17 09-58-52

I have attempted to import the .pcm in question with these settings but it again produces a flat-line instead of a waveform, and Audacity says the duration of the recording is 3hr 16m 8.012s. I tried importing the .wav file with the same settings and again, it is a flat-line instead of a waveform and the duration is 2hr 01m 20.640s.

It appears that I need to be looking for help with the recovery of corrupted data now, and I don’t think this is the right thread to be doing that.

I will consider the question answered because I was able to import a PCM file from the settings you gave, thanks for the help :slight_smile: