As a side personal project, I'm coding an Android application that I plan to use to record the sounds of our first baby. I'm kind of new to the world of Android development and sound processing, so please bear with me if this question is naive :)
What I'm trying to do is to constantly save the sounds in our baby room, splitting the recordings in 2-hour intervals. I plan to keep this data for future analysis (e.g. plotting crying times, which I'll correlate with other events, and maybe cry identification).
So far the application is working fine. However, I wonder if there is an efficient codec I can use considering that 90% of the time there will be silence. I've tried modifying the PCM raw data before enters the codec setting to zero any values below a specific threshold, but this did not reduce the file size substantially. This was a wild guess, just in case this would "help" the codec (I've tried AAC/HE and MP3, not yet AMR).
Can you please point me in the right direction?...
I don't mind using a solution that requires post processing of the files. For example, I've looked into http://sox.sourceforge.net, but that strips silence periods reducing the recording length (I want to keep the timestamps and length untouched).
Note: using SoX to split the file in parts using a naming scheme that allows me to reconstitute original times it's an option... but I could not come with that script, yet).
Bonus question: will AMR-NB be enough to encode a baby cry, if I want to run some processing later? (for example this or this) or... should I stick to AMR-WB?
Thank you,
Update July 22nd:
Thanks everyone for the responses so far. The idea of using just WAV injecting zeros, and later using bzip2, etc. to compress the repetitive data is really good (thanks @MBaz).
@Fat32: I've erased the files, but I recall sizes around ~20Mb/hr, with no substantial change after replacing low PCM values (approximately 50% of the stream) with zeros.
Another update: AMR-WB is giving me better results than AAC/HE, ~6 Mb/hr. So I'll probably stick to it, however I'm not sure how the low bitrate + sampling rate will affect things if later I decide to run some infant identification analysis later (i.e. if the loss of information will remove data points crucial for the neural net).
gzip
andbzip2
are very good at compressing repetitive data. Have you tried gzipping the raw PCM? One great benefit would be that you'd have lossless compression. If there is low-level random noise in the PCM, you may try thresholding the data before compression. $\endgroup$