I've posted this question under 'Tools and SDKs' also. Apologies for the repetition.
I'm adapting the Streaming Input Audio example and am converting each completed buffer into AMR using the CPcmToAmrEncoder API.
The streaming audio example uses PCM16 (I think thats the only format supported - nothing has been changed on that front).
The destination buffer that I provide for the Encode() function is of the same length as the source buffer (16000) although I'm sure most of it is unused.
After the function returns, I write the AMR buffer to file, and I've noticed that the contents are different for different inputs - So I'm assuming that the encoder is working.
1. Only the first 32 bytes of data in the 16000 byte buffer are non-zero. Consistently. Why is this happening ?
2. The TInt& aDstLen parameter to the Encode function now has value 32 - can I safely assume that the actual length of AMR data will be returned in this ?
3. How would I go about creating an AMR file from this data - how do I add the '#AMR' header and other information ?
Any help/suggestions would be greatly appreciated.
I am working on exactly the same topic.
t seems that one call of the encode() method only produce 1 AMR frame. So you have run the encoding event (and vice versa the decoding event) in a loop by shifting the input buffer in 320 byte steps. I did this and also put the decode() methode in the playL() methode for decoding back from AMR to PCM.
Result: Strange noise during playback. The original recording was not recognizable. It also stops after sending the first 16000 byte buffer chunk to the media server.
Anyone out there who managed to get the streaming Input/Output working with AMR codec?