I have an audio app and I need to read and write the COMMENT tag of WAV and M4A files. This is all I need. I had struggled for hours without success.
The closest I arrived is using com.github.goxr3plus:jaudiotagger:2.2.7
. I had success with WAV written with AudioRecord
but exception with M4A written with MediaRecorder
.
My question is: How to write the COMMENT tag on files with AudioRecord? I know how to write a WAV file using AudioRecord, including its headers, but I had failed to find a CLEAR specification, like this one for the headers.
And yet, in any case, I do not know how to add the COMMENT header for M4A files, with or without external libraries. Clues?
After surfing the web a lot I found the solution here, where the crucial information is "where '....' represents 4 bytes that show the length of each 'chunk'". So I did the following method that builds the ICMT chunk for me:
Now it is easy:
The only thing to be careful is to choose the string
MyTextComment
with even length.Sorry if this is well known, adding it for reference since it took me waaaaay too much time.