How can I upsample AMR audio data. The amr file consists of 6 bytes header - "!#AMR".getBytes() and after that there are frames 32bytes each with 1 byte header and 31bytes audio. How am I supposed to upsample it? I read about linear interpolation but I am not sure how to apply it here. Should I interpolate between different frames or between bytes in a frame or something else? Any help will be highly appreciated :)
Asked
Active
Viewed 822 times
1 Answers
1
You need to convert your AMR data to a raw PCM buffer, do the resampling on the PCM buffer, and then optionally convert back to AMR.

Paul R
- 208,748
- 37
- 389
- 560
-
So it isn't possible to upsample amr directly? Thats bad. Can you give me some materials on how to upsample pcm and maybe the structure of pcm data? Thanks. – gop Mar 06 '11 at 18:45
-
@gosho: PCM data is a just a contiguous raw buffer of linear sample values. You can apply any of the standard upsampling algorithms to this data, and you will then have a larger output buffer which you can convert back to AMR data. I'm wondering though: do you really mean *upsample* ? Upsampling means increasing the sample rate, while preserving the original sample data - is this really what you want to do ? It doesn't seem to make much sense in the context of AMR data ? – Paul R Mar 06 '11 at 19:00
-
@Paul R Well here is my thing. I am making voip application for mobile devices and from one device I capture AMR audio, wrap it in datagrams and send over to the other device where it is played. My problem is that the audio player has some internal buffer(which you cannot control) which needs to be filled before audio is actually played. This causes 2seconds delay, and the rest of the code(networking and other stuff) is fast enough. So my idea is to upsample(on the receiving device) and thus create more data for the player's buffer. Is upsampling a good approach here. – gop Mar 06 '11 at 19:16
-
One more thing - I am able to record in PCM, so AMR is not obligatory here. I could replace the code if it would be easier and if i could avoid some unneeded calculations. I am just not that familiar with PCM. – gop Mar 06 '11 at 19:20
-
@gosho: this sounds like a really klugey solution - say you upsample by a factor of 2, you'll still have a 1 second delay and you will have doubled your bandwidth requirements. If this is really what you want to do though, then yes, record as PCM and upsample. – Paul R Mar 06 '11 at 19:51
-
Yes I agree that this is far from a good solution but I am willing to try it unless I come up with something better. I plan to try upsample the received data so the data send over the network will be the same. Thanks for the patience for now - I will try and will write if there are good results. – gop Mar 06 '11 at 21:46